Results 1 to 6 of 6

Thread: qsplitter children resizing help

  1. #1
    Join Date
    Nov 2009
    Location
    San Antonio, TX
    Posts
    69
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt Jambi
    Platforms
    Unix/X11 Windows

    Default qsplitter children resizing help

    I have a custom widget (panel) that consists of a "titlebar" and another widget, eg scrollarea or a "canvas" widget for drawing. I have added multiple instances of these to a QSplitter widget. This works fine . . . the user can re-proportion the widgets to the sizes they like.

    I have a feature request that I am trying to figure out. The user wants to be able to double-click on the titlebar and have the panel shrink to just the titlebar itself and then resize back when the action is performed again. I have implemented the double-click and I call hide/show on the internal widget. This all seems to work fine . . . except . . . when I shrink down to the titlebar itself, I cannot seem to get the occupied space of the child to shrink to just the titlebar. Only the titlebar is displayed when the other widget is hidden, but it is centered in the previous childs height. If I grab the handle with the mouse, I can manually shrink the child widget to the size of just the titlebar. I am also interested in finding a way so that the panel with just a titlebar cannot be resized with the splitter handle. I have tried different combinations of QSizePolicy on the panel widget to get the needed effect, but to no avail.

    For right now, I have two panels in the qsplitter. What I am looking for is a way to shrink one of the panels to the size of the titlebar and have the other panel take the remaining space. Also, if both are double-clicked, I would like to see the whole main window be resized to the smaller size, and then resized as they are shown again.

    Is it doable within the normal qsplitter implementation, or will I need to subclass QSplitter to get this additional functionality.

  2. #2
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: qsplitter children resizing help

    I don't clearly understand your pproblem, could you show us a screenshot?
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

  3. #3
    Join Date
    Nov 2009
    Location
    San Antonio, TX
    Posts
    69
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt Jambi
    Platforms
    Unix/X11 Windows

    Default Re: qsplitter children resizing help

    Yeah, sometimes I ramble and do not quite get across my point . . .
    So i created a sample program (not sure how to attach tgz file)
    There are 3 panels (0,1,2) in use; the bottom two are in a QSplitter.

    So here are 3 snapshots,

    panel1.jpg panel2.jpg panel3.jpg

    1) normal startup
    2) double clicked on titlebar of "Panel 1" with the unwanted effect
    3) manually resizing window to show wanted effect

  4. #4
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: qsplitter children resizing help

    May be you can try connecting the a signal to this slot
    Qt Code:
    1. void QSplitter::moveSplitter ( int pos, int index ) [protected]
    To copy to clipboard, switch view to plain text mode 

    This signal should be emitted when the panel widget are hidden. When the panel widgets are visible, splitter should readjsut iteself by expanding
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

  5. #5
    Join Date
    Nov 2009
    Location
    San Antonio, TX
    Posts
    69
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt Jambi
    Platforms
    Unix/X11 Windows

    Default Re: qsplitter children resizing help

    moveSplitter is not a slot in QSplitter . . . also it is a protected method

  6. #6
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: qsplitter children resizing help

    Hmm... then you may need to have custom QSplitter
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

Similar Threads

  1. QTableWidget resizing when is part of QSplitter
    By godi in forum Qt Programming
    Replies: 4
    Last Post: 18th October 2011, 16:05
  2. Replies: 3
    Last Post: 2nd March 2010, 20:58
  3. Only get children
    By wirasto in forum Newbie
    Replies: 1
    Last Post: 24th January 2010, 17:15
  4. Bug in QSplitter with Qt4.5.1
    By araglin in forum Qt Programming
    Replies: 1
    Last Post: 28th April 2009, 07:45
  5. children()
    By vermarajeev in forum Qt Programming
    Replies: 2
    Last Post: 14th May 2007, 15:15

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.