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. Problem with QSplitter - won't resize widgets? [Fixed]
QtWS25 Last Chance

Problem with QSplitter - won't resize widgets? [Fixed]

Scheduled Pinned Locked Moved General and Desktop
8 Posts 3 Posters 9.0k 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.
  • L Offline
    L Offline
    LiamMaru
    wrote on last edited by
    #1

    I'm trying to get QSplitter to work with a simple aggregate widget, created as follows:

    @ // Assemble small area for tree view and etc.
    QWidget* leftWidget = new QWidget();
    QVBoxLayout* leftLayout = new QVBoxLayout();
    leftWidget->setLayout(leftLayout);
    leftLayout->addWidget(StepsTreeView);@

    However, the created widget doesn't occupy the space the splitter allows it to:

    !http://img809.imageshack.us/img809/6623/resultsj.png(Widget not occupying space afforded it.)!

    Any ideas?

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mkoskim
      wrote on last edited by
      #2

      How about setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum)

      http://doc.qt.nokia.com/stable/qwidget.html#sizePolicy-prop

      http://mkoskim.wordpress.com
      http://mkoskim.drivehq.com
      http://mkoskim.deviantart.com

      1 Reply Last reply
      0
      • L Offline
        L Offline
        LiamMaru
        wrote on last edited by
        #3

        [quote author="mkoskim" date="1319747300"]How about setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum)

        http://doc.qt.nokia.com/stable/qwidget.html#sizePolicy-prop[/quote]

        Tried the following:

        @
        // Assemble small area for tree view and etc.
        QWidget* leftWidget = new QWidget();
        QVBoxLayout* leftLayout = new QVBoxLayout();
        leftWidget->setLayout(leftLayout);
        leftWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
        leftLayout->addWidget(StepsTreeView);@

        Same result.

        1 Reply Last reply
        0
        • M Offline
          M Offline
          mkoskim
          wrote on last edited by
          #4

          Hmmh, I looked your picture, but I can't see the splitter bar, so I could know which of the widgets do not resize. In your picture, it seems that both widgets (treeview and notebook) are happy with their sizes.

          I search for these kind of problems by changing item's background colors e.g yellow (setStyleSheet("background-color: yellow;");), and watch what widget/layout does not resize.

          Furthermore, it would be nice to see the code with QSplitter, too.

          http://mkoskim.wordpress.com
          http://mkoskim.drivehq.com
          http://mkoskim.deviantart.com

          1 Reply Last reply
          0
          • L Offline
            L Offline
            LiamMaru
            wrote on last edited by
            #5

            [quote author="mkoskim" date="1319748058"]Hmmh, I looked your picture, but I can't see the splitter bar, so I could know which of the widgets do not resize. In your picture, it seems that both widgets (treeview and notebook) are happy with their sizes.

            I search for these kind of problems by changing item's background colors e.g yellow (setStyleSheet("background-color: yellow;");), and watch what widget/layout does not resize.

            Furthermore, it would be nice to see the code with QSplitter, too.[/quote]

            Here's the code to setup the splitter:

            @QSplitter* tableSplitter = new QSplitter();@

            And here's the code where I place widgets in the splitter:

            @ // Assemble the splitter.
            tableSplitter->addWidget(leftWidget);
            tableSplitter->addWidget(EditWidget);@

            I've highlighted in the image where the wasted space is. The splitter bar is the the right of that.

            1 Reply Last reply
            0
            • G Offline
              G Offline
              goetz
              wrote on last edited by
              #6

              The code should work. Can you provide a complete, compilable test case that we can look into?

              http://www.catb.org/~esr/faqs/smart-questions.html

              1 Reply Last reply
              0
              • L Offline
                L Offline
                LiamMaru
                wrote on last edited by
                #7

                [quote author="Volker" date="1319753171"]The code should work. Can you provide a complete, compilable test case that we can look into?[/quote]

                Okay, I'll put one together later today.

                1 Reply Last reply
                0
                • L Offline
                  L Offline
                  LiamMaru
                  wrote on last edited by
                  #8

                  Aaaargh, just found out one of my team members added a QSizePolicy::Fixed in the wrong spot ><.

                  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