• 3055阅读
  • 1回复

Qtimer信号槽问题 [复制链接]

上一主题 下一主题
离线zxwmail
 

只看楼主 倒序阅读 楼主  发表于: 2018-03-31
Qt5自带的例程《chartthemes》,想加个timer事件,
但这个widget是手动创建的,qtimer加上后,编译显示
QObject::connect: invalid null parameter

创建timer:
  1. chartTimer=new QTimer(this);
  2.     chartTimer->start(600);
信号槽连接:
  1. void ThemeWidget::connectSignals()
  2. {
  3.     connect(m_themeComboBox,
  4.             static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
  5.             this, &ThemeWidget::updateUI);
  6.     connect(m_antialiasCheckBox, &QCheckBox::toggled, this, &ThemeWidget::updateUI);
  7.     connect(m_animatedComboBox,
  8.             static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
  9.             this, &ThemeWidget::updateUI);
  10.     connect(m_legendComboBox,
  11.             static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
  12.             this, &ThemeWidget::updateUI);
  13.     connect(chartTimer, &QTimer::timeout, this,&ThemeWidget::updateLineChart);
  14. }
最后一个connect是我后期增加的,其余为源码。
如果是在自动创建widget的情况下,标注的地方应该没有问题
但现在是手动创建widget窗体,在不考虑事件的方式下,想请教下这个信号槽该怎么加?怎么理解?谢谢。



离线dosmlp

只看该作者 1楼 发表于: 2018-04-02
不明白在说什么
快速回复
限100 字节
 
上一个 下一个