0

I want some of window controls being highlighted somehow on each change (generated internally by application) to indicate user.

I found a nice method: manipulate background color via palette and QVariantAnimation. The only widget which caused huge problem is QComboBox, because its background color requires a very tricky handling. The only(!) platform-independent and proper way to change it is applying this hack and setting "background-color" property of stylesheet. The problem is to get default value from stylesheet, required to smoothly set color back to initial state.

Is there are any way to handle this in "uni-widget" manner (more specifically: QAbstractButton, QLineEdit, QComboBox, QSlider, QListView, QGroupBox) ? Maybe there are alternative approaches to animate highlight of widgets ?

Community
  • 1
  • 1
Artem Pisarenko
  • 123
  • 1
  • 2
  • 13

1 Answers1

0

I finally ended up with conclusion: it's not possible to add animation effect to widget without breaking its default/initial/non-animated appearance.

So I animate background-color stylesheet property, using widget-specific color role from palette as expected(!) initial color (picking it in animation constructor, before applying stylesheet). Although I wasn't able to make QPalette::Base color of QComboBox to keep displayed white (it shows white only at startup, but then it somehow changes to gray, seems like a bug) on my Windows 7 with Aero enabled, I'm satisfied with result. (Also it didn't required apply this hack)

Here is my code: http://pastebin.com/PDyS1Mn1

Community
  • 1
  • 1
Artem Pisarenko
  • 123
  • 1
  • 2
  • 13