Highlighting parts of complex widgets in themes
Anders Lund
anders.lund at lund.tdcadsl.dk
Wed Dec 17 14:26:09 GMT 2003
On Wednesday 17 December 2003 15:05, Karl Vogel wrote:
> Since I like the gnome Simple theme that much and I couldn't find it for
> KDE, I
> thought I'd have a look at implementing it.
>
> The thinice engine (the gtk engine used in the simple theme) has
> highlighting of
> the buttons if you move over them. For normal widgets (e.g. buttons) this
> can be
> achieved by installing an event filter that listens for Enter and Leave
> events.
> (like it's also done in the Plastik theme)
>
> However, this doesn't work for complex widgets like the scrollbar, as it is
> composed of smaller Primitive Elements (arrow up, down, slider). The enter
> and
> leave event is for the entire scrollbar, so that alone can't be used as you
> would highlight the entire widget, while only the Primitive Element should
> be
> highlight.
>
> I currently implemented this by installing an eventfilter on the scrollbar
> that
> also listens for mouse move events and then records the current mouse
> position
> within the widget. Then I issue a repaint and in the drawing code of the
> Primitive Element, I check if the recorded mouse position is within the
> element.
>
> In order to receive the mouse move events, I had to enable mouse tracking
> on the
> widget, which I actived in the polish method of the style.
>
> While this works, I'm wondering if there isn't a better way to do this.. as
> this
> feels kind of hackish and would mock things up if the application changes
> the
> tracking state.
I'd take a look at the docs for QStyle::styleFlags ;)
-anders
--
*** NEW ID *** Jabber: anderslund at jabber.dk
GPG fingerprint: 4B50 66DE CF6E 35E3 4446 5DC1 CB23 1264 0F2C 0826
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: signature
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20031217/4d5a6f49/attachment.sig>
More information about the kde-core-devel
mailing list