Aybars Kenan
Aybars Kenan

Reputation: 3

Not working QPushButton

In my QMainWindow class, i have another class named MyDialog that inherits from qdialog. In there i redefine my MyDialog as following:

MyDialog en = new MyDialog(this);

inwhich I have inserted a qpushbutton named myButton; i wrote this code in my MyDialog constructor to use that button

connect(ui.myButton,SIGNAL(clicked()),this,SLOT(this->do_Method()));

and the slot do_Method() function is bit strange. Every time I click on myButton it runs not do_Method(). What is my problem?

Upvotes: 0

Views: 1315

Answers (2)

salomon
salomon

Reputation: 1269

First of all, remove your this:

connect(ui.myButton,SIGNAL(clicked()),this,SLOT(do_Method()));

Upvotes: 1

Wes
Wes

Reputation: 5067

change your code to:

connect( ui.myButton, SIGNAL( clicked() ), this, SLOT( do_Method() ) );

Upvotes: 0

Related Questions