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. Resize widgets in a splitter

Resize widgets in a splitter

Scheduled Pinned Locked Moved Unsolved General and Desktop
adjustsplitter
6 Posts 4 Posters 1.9k 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.
  • N Offline
    N Offline
    nzur
    wrote on 4 Apr 2019, 10:17 last edited by
    #1

    Hi, I have a horizontal splitter with 2 widgets.
    The widget on the right is a table with an unknown number of columns.
    I would like to grammatically adjust the splitter position so that the table on the right is fully in view.
    I tried setting the widget on the right sizePolicy to preferred, but it doesn't to the trick.
    Thx in advance

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 4 Apr 2019, 21:07 last edited by
      #2

      Hi,

      do you mean that you want that table view to always be fully visible ?

      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
      1
      • N Offline
        N Offline
        nzur
        wrote on 7 Apr 2019, 10:22 last edited by
        #3

        Exactly :)

        C 1 Reply Last reply 7 Apr 2019, 14:59
        0
        • N nzur
          7 Apr 2019, 10:22

          Exactly :)

          C Offline
          C Offline
          Cobra91151
          wrote on 7 Apr 2019, 14:59 last edited by
          #4

          @nzur

          Hi! You can set the setMinimumWidth to the widget and setHorizontalStretch (https://doc.qt.io/qt-5/qsizepolicy.html#setHorizontalStretch) to the QSizePolicy.

          1 Reply Last reply
          0
          • N Offline
            N Offline
            NoumanYosuf
            wrote on 7 Apr 2019, 15:40 last edited by NoumanYosuf 4 Jul 2019, 15:41
            #5

            @nzur so you want your table widget to get adjusted automatically when splitter is moved ? please correct me if i have misunderstood your question.
            Ideally, resized event is called of the added widgets in qsplitter when splitter is resized. And if the added widgets resize fine individually (when not added to splitter), it should work well.
            Or if they don't and you want to handle resizing in the qsplitter, you can over ride resize event of qsplitter and then resize particular widget.

            1 Reply Last reply
            0
            • N Offline
              N Offline
              nzur
              wrote on 10 Apr 2019, 10:21 last edited by
              #6

              I just wanted to locate the splitter so that all the table columns are visible.
              I tried using QSplitter::setSizes() with the table width but it wasn't updated right after creation.
              I solved it by overriding the table's resizeEvent() and emitting a signal to the parent widget

              1 Reply Last reply
              1

              1/6

              4 Apr 2019, 10:17

              • Login

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