mcarter
1st February 2013, 00:07
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.
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.