How to link label with push Button
-
Hi i am new to Qt and my question is i want to link my label with push button. For example: i have taken a label and set an image on it,now i want that when i click on the label my push button should get enable and before that it should be disable.
And also i want to make my label clickable.
please anybody help me out with this with a proper example so that it will be easier for me to understand.
Thank You in advance. -
Hi and welcome to devnet,
I suggest to use a flat pushButton instead of label + button.
It's the easiest way and you may work with icons as well. -
Thank you for your reply. But in my project i require to use label and have to make it clickable.
-
Hi,
There are 2 ways for making it clickable:
-
If you have subclassed the QLabel, override "mouseReleaseEvent":http://qt-project.org/doc/qt-5/qwidget.html#mouseReleaseEvent of your Label.
-
If not subclassed then use "eventFilter":http://qt-project.org/doc/qt-4.8/qobject.html#eventFilter method.
-
-
OK so you want to make your label clickable..
see
https://qt-project.org/wiki/Make-a-QLabel-Clickablehope it helps !!
-
Thanks to Every One.
-
Hello Debjani..
If you did it successfully then update this thread as SOLVED before the title.
Thanks.