【发布时间】:2014-06-03 08:49:52
【问题描述】:
我想连接到已选中的图例标签 SIGNAL。使用 Qts 旧 Signal/Slot-Syntax 一切都很完美,但我想使用新连接来启用编译时检查?关于如何通过新的 Signal/Slot-Syntax 连接它的任何想法?
这是我的代码:
connect( m_plotLegend, SIGNAL( checked( const QVariant &, bool, int ) ), SLOT(legendChecked( const QVariant &, bool ) ) );
//connect(m_plotLegend, &QwtLegend::checked, this, &MeasurePlot::legendChecked);
使用旧语法一切都很好,使用新语法永远无法到达插槽。有任何想法吗?非常感谢!
【问题讨论】:
-
你检查
connect()函数调用的返回值了吗? -
是的。没有成功。错误信息:QObject::connect: signal not found in QwtLegend
-
无论您的问题是什么 - 它应该与 Qwt 无关。该消息来自 qobject.cpp 中的 QObject::connectImpl ,使用调试器时,您应该能够找出在您的情况下为什么 senderMetaObject 是 nullptr。
标签: qt syntax signals qwt slot