Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED]Styling QDockWidget
Qt 6.11 is out! See what's new in the release blog

[SOLVED]Styling QDockWidget

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 3.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jake007
    wrote on last edited by
    #1

    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


    Code is poetry

    1 Reply Last reply
    0
    • Chris KawaC Offline
      Chris KawaC Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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 Reply Last reply
      0
      • J Offline
        J Offline
        Jake007
        wrote on last edited by
        #3
        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


        Code is poetry

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved