[Solved] Signal/slot doesn’t work
-
Hello,
I am practicing Qt5 and I tried some easy signal/slots which worked, but now I tried to open a Dialogwindow with a connect and it doesn't work. I really don't know why.. I tried to open only the window in the main and it worked, so the problem comes probably from the connect line.
MaFenetre.h
@class MaFenetre: public QWidget
{
public:
MaFenetre();
~MaFenetre();
void show();public slots:
void OuvrirDialogueQuestion();private:
QWidget *cadre;
QPushButton *bouton2;
};@MaFenetre.cpp
@MaFenetre::MaFenetre()
{
cadre = new QWidget;
cadre->setFixedSize(1905,1005);bouton2 = new QPushButton("Question!",cadre);
bouton2->setFont(QFont("Lucida Handwriting",20));
bouton2->move(300,900);
QObject::connect(bouton2, SIGNAL(clicked()), this , SLOT(OuvrirDialogueQuestion()));MaFenetre::~MaFenetre()
{
delete bouton1;
delete bouton2;
delete lcd;
delete slider1;
delete slider2;
delete barre;
delete cadre;
}void MaFenetre::show()
{
cadre->show();
}void MaFenetre::OuvrirDialogueQuestion()
{
QMessageBox::question(this,"Question","Est ce que tu aimes les nems?", QMessageBox::Yes | QMessageBox::No);
}@main.h
@int main (int argc, char *argv[])
{QApplication app(argc, argv);
MaFenetre window;
window.show();return app.exec();
}@Would anyone have an idea about where the error could be? If you have any advice about this program, I would be interested to read them too. Thank you in advance!
qxoz: moved
-