Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Indentation of QWidgets

    General and Desktop
    3
    4
    3213
    Loading More Posts
    • 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
      ephe last edited by

      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 Reply Quote 0
      • A
        andre last edited by

        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 Reply Quote 0
        • T
          tobias.hunger last edited by

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

          1 Reply Last reply Reply Quote 0
          • A
            andre last edited by

            Would that work with, for instance, a QGroupBox?

            1 Reply Last reply Reply Quote 0
            • First post
              Last post