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. Using stylesheets to change position of QDockWidget buttons
Forum Updated to NodeBB v4.3 + New Features

Using stylesheets to change position of QDockWidget buttons

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 4.1k 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.
  • ? This user is from outside of this forum
    ? This user is from outside of this forum
    Guest
    wrote on last edited by
    #1

    I am creating a GUI using Qt. I use stylesheets to change the positions of close-button and float-button to the left side of the titlebars of DockWidgets in Mac OS X. My code looks like this:

    @
    QString macOSXButtonStyle = "";
    #ifdef MACOSX
    macOSXButtonStyle = "QDockWidget::close-button, QDockWidget::float-button { subcontrol-position: left; } QDockWidget::close-button { left: 4px; } QDockWidget::float-button { left: 20px; }";
    #endif

    activeDockWidget->setStyleSheet(macOSXButtonStyle);
    @

    Repositioning does work. But the buttons appear smaller than before.

    !http://www.informatik.uni-bremen.de/~cargath/buttons_before.png(before)!
    !http://www.informatik.uni-bremen.de/~cargath/buttons_after.png(after)!

    I tried resizing them with different combinations of icon-size, size, width and height, but nothing seems to work. Any idea what's causing the problem / how i could fix it?

    1 Reply Last reply
    0
    • P Offline
      P Offline
      prajnaranjan.das
      wrote on last edited by
      #2

      I think you may try it by using Layouts....

      Prajnaranjan Das

      e mail: prajnaranjan.das@gmail.com

      1 Reply Last reply
      0
      • G Offline
        G Offline
        giesbert
        wrote on last edited by
        #3

        If those are the in widget button, layouts will not help Prajnaranjan.

        Did you look at this "examples":http://doc.qt.nokia.com/4.7/stylesheet-examples.html#customizing-qdockwidget ?

        By the way, which Qt version do you use?

        Nokia Certified Qt Specialist.
        Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

        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