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. Indentation of QWidgets
QtWS25 Last Chance

Indentation of QWidgets

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 3.7k Views
  • 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
    ephe
    wrote on last edited by
    #1

    Is it possible to set the indentation of a QWidget?

    E.g. if I've got a checkbox which hides/unhides some widgets, so that I can indent the ones which will be hidden by the checkbox?
    I know that I can set the x-coordinate of the widget, but I would like to know if there is something similar to the setIndent() of the QLabel for the other widgets as well?

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on last edited by
      #2

      No, there is no such thing. It is a bit tricky to get right. I ended up creating my own spacer-widget. It is basically nothing more than a QWidget subclass that uses QStyle::subElementRect() with the QStyle::SE_CheckBoxContents sub element to set the size hint for the widget width.

      1 Reply Last reply
      0
      • T Offline
        T Offline
        tobias.hunger
        wrote on last edited by
        #3

        How about using this: http://doc.trolltech.com/latest/qwidget.html#setContentsMargins

        1 Reply Last reply
        0
        • A Offline
          A Offline
          andre
          wrote on last edited by
          #4

          Would that work with, for instance, a QGroupBox?

          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