Results 1 to 3 of 3

Thread: how to check button state such as "hover"?

  1. #1
    Join Date
    Aug 2006
    Posts
    24
    Qt products
    Qt4
    Platforms
    Windows

    Angry how to check button state such as "hover"?

    hello guys,

    i want to customize my pushbutton by reimplementing paintevent. the
    problem is, i don't know how to check the button state within
    paintevent, say "hover" "pressed". i didn't find any function
    returning these state.

    thanks.

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: how to check button state such as "hover"?

    hi,

    see QWidget::underMouse() and for the pressed you have to reimplement the mouse handlers as well and save the press state in a member variable yourself.

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: how to check button state such as "hover"?

    You can call QPushButton::initStyleOption() to ask Qt to fill some of the data into the styleoption object for you.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. how to check radio button
    By tommy in forum Newbie
    Replies: 2
    Last Post: 24th February 2012, 02:50
  2. How to design a state machine in face of non-blocking I/O?
    By piotr.dobrogost in forum Qt Programming
    Replies: 26
    Last Post: 14th August 2009, 19:48
  3. Help: How to save Check box state
    By Garibalde in forum Qt Programming
    Replies: 4
    Last Post: 1st July 2009, 20:24
  4. button background color when it is clicked
    By navi1084 in forum Qt Programming
    Replies: 4
    Last Post: 9th December 2008, 15:02

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.