Hello you all!
I'm a newbie in Qt programming so my question will probably seem a stupid question but all guides I read didn't help me...
I'm developing a C/C++ program in Win Vista & Qt Creator IDE with the Qt framework. It is a Qt GUI Application (the one you can create by clicking New -> project)
I'd like to connect the event of clicking a PushButton with a function I wrote earlier. Here is the code of my mainwindow.cpp file:
Code:
#include "mainwindow.h" #include "ui_mainwindow.h" #include <QPushButton> #include<QMessageBox> { public slots: void buttonClicked() { QMessageBox("Title","Msg",QMessageBox::NoIcon,QMessageBox::Ok,QMessageBox::NoButton,QMessageBox::NoButton); } }; ui(new Ui::MainWindow) { PB->setText("Button text"); act a; connect(PB, SIGNAL(clicked()), &a,SLOT(buttonClicked())); PB->show(); } MainWindow::~MainWindow() { delete ui; }
It is executed correctly but when I push the button the message doesn't show!
What could be the problem?
Thanks a lot, harmodrew