Hi,
i need a QPushbutton not clickable but not greyed as disabled...
Is there a way to reach this result ?
The button text must remain not greyed.
The background not greyed...
Thanks
Hi,
i need a QPushbutton not clickable but not greyed as disabled...
Is there a way to reach this result ?
The button text must remain not greyed.
The background not greyed...
Thanks
Subclass QPushButton and reimplement mousePressEvent.
you could do it with an event filter as well.
If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.
Sounds more like a label right ? You could use a label with pushbutton image as background.i need a QPushbutton not clickable but not greyed as disabled...
Or you can go as suggested above.. subclass QPushButton and reimplement mousepressevent and ignore it.
Thanks to all...at the moment i've no code,
my apps need 2 buttons, when it starts i want only one disabled, but i need that the style of disabled button is the same of the enabled button, so no greyed....as setEnabled(false) property do.
I need only that one button is unclickable...
use Stylesheets and set a style to QPushButton without explicitly specifying QPushButton[enabled=false]
I would question your design.
Why you need a button that looks like enabled but it isn't?
One thing you'll get for sure is user confusion.
Yes you are right !! But this button will work like a led GREEN/RED. And the only widget to make a like led is a QPushButton...!!!
A QLineEdit is flat so i think a QPUSHButton is the best solution...
I still think you need to re-think your design.
You need a button which is not a button, but looks like a button but it fact is a label...
Read what you're saying - the idea of a button is that it can be interacted with. You're looking for something that will not be interacted with.
What about QLabel? That's exacly what it is for.
You can style the label as you want, even to look like a PushButton (I still fail to see a reason for that).
Qt Code:
l->setAlignment( Qt::AlignCenter ); l->setStyleSheet( "QLabel {" "margin: 1px;" "border-color: #0c457e;" "border-style: outset;" "border-radius: 3px;" "border-width: 1px;" "color: black;" "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #EBEBEB, stop: 1 #CCCCCC );" "}" );To copy to clipboard, switch view to plain text mode
Bookmarks