Unsolved 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) -
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. -
This post is deleted! -
@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 -
Can you please share some code snippet?? so that its easy to identify what is the actual problem
-
private 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.