Results 1 to 6 of 6

Thread: Modifying custom style, derived from QPlastiqueStyle to prevent rollover highlighting

  1. #1
    Join Date
    Sep 2007
    Posts
    15
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default 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

  2. #2
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    517
    Thanks
    21
    Thanked 66 Times in 62 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default 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.

  3. #3
    Join Date
    Sep 2007
    Posts
    15
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default 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

  4. #4
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    517
    Thanks
    21
    Thanked 66 Times in 62 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Modifying custom style, derived from QPlastiqueStyle to prevent rollover highligh

    try:

    Qt Code:
    1. urPushButton->setAttribute(Qt::WA_Hover, false);
    To copy to clipboard, switch view to plain text mode 

  5. #5
    Join Date
    Sep 2007
    Posts
    15
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default 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:
    Qt Code:
    1. void QMyStyle::polish(QWidget* widget) // re-implement virtual function from QStyle
    2. {
    3. widget->setAttribute(Qt::WA_Hover, false);
    4. }
    To copy to clipboard, switch view to plain text mode 
    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

  6. #6
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    517
    Thanks
    21
    Thanked 66 Times in 62 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default 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

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.