Modifying custom style, derived from QPlastiqueStyle to prevent rollover highlighting
Hello,
I am developing a Qt for embedded Linux application to be used with a touchscreen. I'm using a custom style, derived from QPlastiqueStyle but with "chunky" scrollbars to ease use with a touchscreen.
It is inappropriate how QPlastiqueStyle has a rollover effect, given that this application will only ever be used with a touchscreen.
Is there a way to prevent the rollover highlight effect from appearing?
Thanks,
Sternocera
Re: Modifying custom style, derived from QPlastiqueStyle to prevent rollover highligh
which element's rollover event are you talking about..whichever element it is..u can disable it by using "hover" property in stylesheets.
Re: Modifying custom style, derived from QPlastiqueStyle to prevent rollover highligh
I am referring to QPushButton's "hover" events....when they take on blue highlights while the mouse cursor is rolled over. That's all I want to change.
I'm already using a custom style. Can I further extend it to suppress this hover behaviour?
Regards,
Sternocera
Re: Modifying custom style, derived from QPlastiqueStyle to prevent rollover highligh
try:
Code:
urPushButton->setAttribute(Qt::WA_Hover, false);
Re: Modifying custom style, derived from QPlastiqueStyle to prevent rollover highligh
talk2amulya,
Hmm....I appreciate the suggestion, but that will create a lot of boiler plate that will have to be maintained for dozens of QPushButtons. I was hoping to achieve the same end by modifying my application's custom, QPlastiqueStyle derived style.
I realised that I could do what you've suggested for all widgets in my style:
Code:
void QMyStyle
::polish(QWidget* widget
) // re-implement virtual function from QStyle {
widget->setAttribute(Qt::WA_Hover, false);
}
This works; the rollover effect disappears. However, I now have another problem: When I actually press a button, the blue highlighting "sticks" to it until it is re-drawn.
I have no idea why this might be. Do you?
Regards,
Sternocera
Re: Modifying custom style, derived from QPlastiqueStyle to prevent rollover highligh
maybe you have done certain stuff with QStyle::State_Sunken, if not, u can work on drawPrimitive() for your button and resolve the issue