首页| 论坛| 消息

标题:Qtimer信号槽问题
作者:zxwmail
日期:2018-03-31 10:18
内容:

Qt5自带的例程《chartthemes》,想加个timer事件,
但这个widget是手动创建的,qtimer加上后,编译显示:
QObject::connect: invalid null parameter
创建timer:
chartTimer=new QTimer(this);
chartTimer->start(600);信号槽连接:
void ThemeWidget::connectSignals()
{
connect(m_themeComboBox,
static_cast(&QComboBox::currentIndexChanged),
this, &ThemeWidget::updateUI);
connect(m_antialiasCheckBox, &QCheckBox::toggled, this, &ThemeWidget::updateUI);
connect(m_animatedComboBox,
static_cast(&QComboBox::currentIndexChanged),
this, &ThemeWidget::updateUI);
connect(m_legendComboBox,
static_cast(&QComboBox::currentIndexChanged),
this, &ThemeWidget::updateUI);
connect(chartTimer, &QTimer::timeout, this,&ThemeWidget::updateLineChart);
}最后一个connect是我后期增加的,其余为源码。
如果是在自动创建widget的情况下,标注的地方应该没有问题。
但现在是手动创建widget窗体,在不考虑事件的方式下,想请教下这个信号槽该怎么加?怎么理解?谢谢。


#1 [dosmlp 04-02 09:50]
不明白在说什么

回复 发表
主题 版块