Comment 21 for bug 995330

Revision history for this message
In , Jan-Marek Glogowski (jmglogow) wrote :

I did some research on this bug while thinking of a resolution for #74416.

Currently the KDE4 backend works like this:

* Get a control request
* Generate a QImage with the requested size
* Fill image with the QPalette::Window color
* Draw the control with the theme style to the QImage
* Blit / copy the image to the actual target

This results in this - actually unstyled - dropdown menus.

So for a test I changed the menu generation to a more Gtk+ backend approach:

* Get the control request from vcl
* Create a QMenu object
* Resize the menu to the requested size
* Copy the QMenu to a QImage using QImage(QPixmap::grabWidget(...).toImage())
* Draw the control with the theme style to the QImage
* Blit / copy the image to the actual target

This generates the correct background (yeah); but now I realized (to my increasing frustration), that the highlighting is actually drawn based on the background image with a different color. Probably just the opaque value is adapted - I didn't actually check the Oxygen code.

To make the KDE theming using VCL even harder, Oxygen uses some kind of animation to fade the highlighting to the correct color, which won't work using the QImage based copy approach (and I also don't know how this actually works in the Oxygen Qt style engine).

Additionally the QPixmap::toImage() call has additional drawbacks: "Note that for the moment, alpha masks on monochrome images are ignored." (http://qt-project.org/doc/qt-4.8/qpixmap.html#toImage)

From my current point of understanding of all the interaction, the only realistic way to fix the styling problems is to draw LO native widgets using a real Qt widgets stack and let LO draw it's specific objects. I guess this will result in a complete rewrite of the KDE4 backend based on a new architecture - if this is possible using VCL.

And there is already an abstraction for (popup) menus, which uses the same approach (SalMenu).

Now I need to get some feedback, if this approach is implementable at all. I would start a kde4v2 backend, but this is a lot more work then I have currently time for: GSoC 2014 anyone?