Click not working for QPushButton
-
Re: [[SOLVED] QPushButton. I click on the button](but nothing not happend.)
Here is my code,
QPushButton *textBtnWin;
textBtnWin = new QPushButton(parent);
connect(textBtnWin, SIGNAL (clicked()), this, SLOT (handleButton()));handleButton(void) {
blnBtnPressed = !blnBtnPressed;
qDebug() << blnBtnPressed;
}for some buttons, the click is not working. In fact the mouse hover also does no changes for these buttons.
-
Hi
Please show real code. :)
Also if some buttons dont work and some do, it means
you have some sort of bug. (as slot works then) -
Re: [[SOLVED] QPushButton. I click on the button](but nothing not happend.)
Here is my code,
QPushButton *textBtnWin;
textBtnWin = new QPushButton(parent);
connect(textBtnWin, SIGNAL (clicked()), this, SLOT (handleButton()));handleButton(void) {
blnBtnPressed = !blnBtnPressed;
qDebug() << blnBtnPressed;
}for some buttons, the click is not working. In fact the mouse hover also does no changes for these buttons.
Hi,
Is Your handleButton() function is declared as public slots??
If it is normal public function you cant connect to the signal by above connect statement. -
Hi,
Is Your handleButton() function is declared as public slots??
If it is normal public function you cant connect to the signal by above connect statement.@Venkatesh-V No I need it as private slot() because I use this class as base and create many buttons.
Still, I tried it making as public slot() but it didn't work -
@Venkatesh-V No I need it as private slot() because I use this class as base and create many buttons.
Still, I tried it making as public slot() but it didn't workCan you please share some code snippet?? so that its easy to identify what is the actual problem
-
@Venkatesh-V No I need it as private slot() because I use this class as base and create many buttons.
Still, I tried it making as public slot() but it didn't workprivate or public slots have no significance with Qt C++ environment if you are using slots in the context of signal-to-slot communication. If you are interested to call this slots as normal member function then public/private is applicable. Also if you are trying to call the slots from QML environment, then slots need to be public only.