Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "mywidget.h"
- #include "ui_mywidget.h"
- #include "myclass.h"
- MyWidget::MyWidget(QWidget *parent) :
- QWidget(parent),
- ui(new Ui::MyWidget)
- {
- ui->setupUi(this);
- m_Timer = new QTimer(this);
- connect(m_Timer, SIGNAL(timeout()), this, SLOT(TimerSlot()));
- }
- MyWidget::~MyWidget()
- {
- delete ui;
- }
- void MyWidget::TimerSlot()
- {
- // As an example I want to execute a QMessageBox each second
- QMessageBox::information(nullptr, "Title", "Test");
- }
- void MyWidget::on_pushButton_clicked()
- {
- // Like this the code works just fine and the MessageBox is fired up each second
- // m_Timer->start(1000);
- // Create an instance, the constructor will run and connect the signal and slots
- // But nothing happens...
- MyClass m_Class;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement