16,203
社区成员
发帖
与我相关
我的任务
分享
Widget::Widget(QWidget *parent) :
QWidget(parent),
ui(new Ui::Widget)
{
ui->setupUi(this);
QTimer *t1 = new QTimer(this);
connect(t1, SIGNAL(timeout()), this, SLOT(TimerUpData()));
//t1->start(100); 放在这里就正常
}
void Widget::on_pushButton_clicked()
{
Widget::t1->start();//放在这里,程序可以运行,但是单击按钮会卡死退出
}
private:
Ui::Widget *ui;
QTimer *t1;
这样算不算?