[SOLVED]Styling QDockWidget



  • Hi!

    I'm looking for a way how to style floating QDockWidget ( frame more precisely). Bellow is a image how it looks by default ( right image), and one of the possible desired looks (left image, taken from Visual Studio 2012).

    !http://imageshack.us/scaled/landing/5/examplej.png(Example)!

    I've looked through examples "here":http://qt-project.org/doc/qt-4.8/stylesheet-examples.html#customizing-qdockwidget , but it didn't help.

    Regards,
    Jake


  • Moderators

    Well there is no (easy) way to style frames in Qt as they are platform specific.
    There are basically two ways, both with their drawbacks and considerable amount of work:

    1. Subclass QDockWidget, and handle the topLevelChanged(bool) signal to make it a frameless window (change widget flags and re-show). Then you would increase margins, draw the frames in paint event and handle all the stuff like resize handles, close button etc in appropriate event handlers.

    2. (Windows specific) Subclass QDockWidget and in winEvent() handle the WM_NCPAINT message by painting with GDI or other machinery.

    I'm no expert on linux so I won't help much there.



    1. way is not an options since is OS dependent.

    I'll try to put first options to practice.

    Thanks!

    Marked as solved.

    Regards,
    Jake


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.