C++ (Qt)#include "widget.h"#include "ui_widget.h" Widget::Widget(QWidget *parent) : QWidget(parent), ui(new Ui::Widget){ ui->setupUi(this); connect(&m_timer, SIGNAL(timeout()), this, SLOT(timeoutSlot())); m_timer.start(0);} void Widget::timeoutSlot(){ static size_t t = 0; t++;} Widget::~Widget(){ delete ui;}