PDA

View Full Version : disable pushbutton focus after mouse released



saman_artorious
20th April 2013, 13:51
I set the attributes with stylesheet:

pb_Down->setStyleSheet("border-image: url(:/ArrowKey/Down_Default.jpg);border-width: 1px;border-style: solid; border-radius: 4px;");


when push button is clicked it becomes red inside and border is shown as written above. When button released I want the button to get back to its normal shape, not red anymore. for this I am using


pb_Jack1Up->setFocusPolicy(Qt::FocusPolicy);

inside released slot (we're dealing with pressed() and released() slots), but this gives the error:


error: expected primary-expression before ')' token

how to resolve this?

amleto
20th April 2013, 14:24
you need to specify a VALUE of the ENUM, not try and pass the ENUM itself...

http://qt-project.org/doc/qt-4.8/qt.html#FocusPolicy-enum


pb_Jack1Up->setFocusPolicy(Qt::ClickFocus);Anyway, not sure that that will give you your desired result.

saman_artorious
20th April 2013, 14:58
no, that's not what I want.

amleto
20th April 2013, 15:31
I know. Using the focus policy will not help you. You need to unset the focus manually.