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. QGroupBox::title positioning
Forum Updated to NodeBB v4.3 + New Features

QGroupBox::title positioning

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 7.9k 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.
  • E Offline
    E Offline
    elephanten
    wrote on last edited by
    #1

    Hello,

    I'm setting this stylesheet on QGroupBox:
    @QGroupBox {
    border: 1px solid rgb(100, 100, 100);
    border-radius: 3px;
    margin-top: 8px;
    }
    QGroupBox::title {
    subcontrol-origin: margin;
    subcontrol-position: top left;
    }@

    and my title is in the upper-left corner. So, how do I move it a little to the right? The trick here is to keep the groupbox top-left corner drawn.

    1 Reply Last reply
    0
    • E Offline
      E Offline
      elephanten
      wrote on last edited by
      #2

      Oh!.. It was simple. The answer is to use "left" property like this:
      @QGroupBox::title {
      ...
      left: 15px;
      }@

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi,

        You can try using the "alignment property":http://qt-project.org/doc/qt-5.1/qtwidgets/qgroupbox.html#alignment-prop

        Hope it helps

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        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