PDA

View Full Version : how to check button state such as "hover"?



billconan
11th November 2009, 21:13
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.

Lykurg
11th November 2009, 21:20
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.

wysota
12th November 2009, 01:45
You can call QPushButton::initStyleOption() to ask Qt to fill some of the data into the styleoption object for you.