2 Attachment(s)
How to highlight a QWidget
Hello everyone! Here is my question:
I've derived the QToolButton so that buttons in QToolBar can be accessed by tabbing, but when it gains focus it is not highlighted like when i hover with the cursor over it. I've overriden the focusInEvent function, but when it comes to actually highlighting the button I don't know what property/attribute to set or what method to call.
Here is what it looks like when I hover with the cursor over the button:
Attachment 10361
How can I achieve this by replacing the line marked?
Here is what is currently happening:
Attachment 10362
Code:
if(e->gotFocus() && e->reason() == Qt::TabFocusReason){
setGraphicsEffect(new QGraphicsColorizeEffect()); //line to be replaced
}
}
Thank you for your help! :)
Re: How to highlight a QWidget
Try style sheet for the widget focus, see below style sheet example for QWidget focus...
QWidget:focus {border: 3px solid green;}