Results 1 to 7 of 7

Thread: New to QSplitter

  1. #1
    Join Date
    Jan 2007
    Posts
    91
    Thanks
    21
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default New to QSplitter

    Hello,
    I have two controls, one a QTreeWidget and another a QStackedDialog.

    When I add these to a QSplitter and I attempt to drag the splitter, it flashes, but goes back to the original size. If I drag it far enough, the whole screen is replaced either by the left side or the right side, but I can't get it to stretch. I'm adding QGroupBoxes to the splitter, could that be my problem?

    - BRC

    Here's my code snippet:

    QSplitter *splitter = new QSplitter(this);
    splitter->addWidget(m_pNavGroupBox); // QGroupBox
    splitter->addWidget(m_pDataGroupBox); // QGroupBox
    splitter->setStretchFactor(0, 10);
    splitter->setStretchFactor(1, 10);

    QVBoxLayout *pMainLayout = new QVBoxLayout();
    pMainLayout->addWidget(m_pTitleImageLabel, 3, Qt::AlignCenter); // label -
    pMainLayout->addWidget(splitter);

    setLayout(pMainLayout); // for main window

  2. #2
    Join Date
    Jan 2007
    Posts
    91
    Thanks
    21
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: New to QSplitter

    I hate to keep answering my own questions, but just in case someone else tries this, I had a tabbed dialog on the right hand side that had a tab that would not shrink, so, until I increased the size of the window, I couldn't drag the splitter bar. Once I eliminated that particular tab, I found that I could move it.

    In my case I had stacked dialogs and the dialogs had tabbed dialogs underneath and one of the tabbed dialogs wouldn't fit in a smaller area, so none of them would.

  3. #3
    Join Date
    Jul 2007
    Location
    California, USA
    Posts
    62
    Thanks
    17
    Thanked 7 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: New to QSplitter

    I am running into the same problem. It has to do with layouts in the tabs.

    I have a tab widget in one part of my splitter. As long as I have a layout in the tabs, I cannot make the splitter shrink that side. I need the layouts because I want the tab to look nice but is there any way to tell it that it can shrink that side?

    I have a QMdiArea on the other side and I am able to shrink that side.

    Thanks.

  4. #4
    Join Date
    Jun 2006
    Location
    Regensburg, Bavaria
    Posts
    5
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: New to QSplitter

    Hi
    Maybe some of the widgets' minimum size(hint) is too great, so that the layout prevents the splitter from further shrinking them.
    Hope this helps.

  5. #5
    Join Date
    Jul 2007
    Location
    California, USA
    Posts
    62
    Thanks
    17
    Thanked 7 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: New to QSplitter

    I checked and I have no minimum sizes on any of the widgets and I set all the policies to preferred. (The only things I left as expanding were the spacers.)

    I even created a minimumSizeHint() method to return (0,0) for each of the tabs but that didn't make a difference.

    Thanks for the suggestions.

  6. #6
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: New to QSplitter

    Did you create the form in designer? Sometimes spacers get relatively large size hint values while working with designer. I suggest you to go through spacers and check their size hints.
    J-P Nurmi

  7. #7
    Join Date
    Jul 2007
    Location
    California, USA
    Posts
    62
    Thanks
    17
    Thanked 7 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: New to QSplitter

    Somewhere along the way my tabWidget->setMinimumWidth(20); got deleted. Putting that back in fixed it. I have set my layouts to be minimum, minimumExpanding, and a few preferred. I also have removed all minimumWidths. I think the combination of all three solved the problem.

Similar Threads

  1. Override QSplitter to draw new handle
    By grogan in forum Qt Programming
    Replies: 4
    Last Post: 27th September 2006, 03:40
  2. Remove widgets from a QSplitter
    By blukske in forum Qt Programming
    Replies: 1
    Last Post: 14th July 2006, 10:38
  3. QSplitter synchronization
    By sreedhar in forum Qt Programming
    Replies: 2
    Last Post: 11th July 2006, 17:22
  4. qSplitter settings
    By ovidiu.sabou in forum Qt Tools
    Replies: 4
    Last Post: 14th March 2006, 18:24
  5. To put Image on QSplitter
    By moizahamedv in forum Qt Programming
    Replies: 10
    Last Post: 3rd March 2006, 12:05

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.