• 4997阅读
  • 2回复

[提问]新手问关于QTimer的小白问题,no such slot QTimer::start(500) [复制链接]

上一主题 下一主题
离线flyingluffy
 
只看楼主 倒序阅读 楼主  发表于: 2011-06-09
其实只是想把一个START按键和Timer连起来,点一下START计时器开始工作,程序编译没有问题,但是运行时显示:

Object::connect: No such slot QTimer::start(500)

代码如下:
     QTimer *timer = new QTimer(this);
     connect(startbutton, SIGNAL(clicked()), timer, SLOT(start(500)));
     connect(stopbutton, SIGNAL(clicked()), timer, SLOT(stop()));
     connect(timer, SIGNAL(timeout()), native, SLOT(animate()));
     setWindowTitle(tr("Data Display"));

STOP按键是可以用的,但是START不行...求助啊求助
离线alexltr

只看该作者 1楼 发表于: 2011-06-09
试试看:

  QTimer *timer = new QTimer(this);
     timer->setInterval(500);
     connect(startbutton, SIGNAL(clicked()), timer, SLOT(start()));
     ......
我不从事IT,只是喜欢Qt。
我不是程序员,只是与程序有缘。
我写程序,只是为了让工作变得简单有序!

                      ----  一个一直在入门的编程学习者
离线flyingluffy
只看该作者 2楼 发表于: 2011-06-10
非常感謝!问题解决了..看来SLOT里的函数不能带参数嘛,再次感谢~~
快速回复
限100 字节
 
上一个 下一个