[PySide] sliding widgets into position

Frank Rueter | OHUfx frank at ohufx.com
Mon Apr 30 22:54:47 CEST 2012


ok, thanks

On 1/05/12 12:53 AM, Tibold Kandrai wrote:
> Hi!
>
> There I just needed a SIGNAL for the resizeEvent, to be able to resize 
> the sliding widgets, so their size will always conform with the window.
>
> Cheers,
> Tibold
>
> On 2012-04-30 00:59, Frank Rueter | OHUfx wrote:
>> Hi Tibold,
>>
>> I'm starting to go through your example code and was wondering why 
>> it's necessary to subclass QFrame and re-implement the resizeEvent 
>> for "CentralFrame"?!
>> To my novice eye it looks like what you did here should be working 
>> for QFrame out of the box, but it doesn't.
>>
>> Would you mind explaining?
>>
>> Cheers and thanks again for this example!
>> frank
>>
>> On 4/27/12 5:47 PM, Tibold Kandrai wrote:
>>> Try this out ;)
>>> http://pastebin.com/a04tvY0U
>>>
>>> Cheers,
>>> Tibold
>>>
>>> On 2012-04-27 02:11, Frank Rueter | OHUfx wrote:
>>>> So I've followed Tibold's advice and sorted out some other ugly 
>>>> stuff and am a bit closer.
>>>> My problem now is that, because I am not adding the top and bottom 
>>>> frames to the layout anymore (to avoid the middle frame shifting), 
>>>> I now can't get the right size and position relative to the centre 
>>>> frame.
>>>>
>>>> This is what I have now a bit cleaned up and with comments:
>>>> http://pastebin.com/wrUX5Ce0
>>>>
>>>> By making the middle frame the parent to the top and bottom frames 
>>>> they line up to it now in the upper left corner - cool, one step 
>>>> forward.
>>>> But I can't get the top and bottom frames to have the same width as 
>>>> the parent and also don't know how to control the position properly 
>>>> so that the bottom frame is always positioned in the bottom left 
>>>> corner of the centre frame.
>>>> The size policy isn't inherited either which I'm a bit clueless a 
>>>> bout too.
>>>>
>>>> Sorry for the noob questions but have looked online for tutorials 
>>>> on this sort of positioning to no avail.
>>>>
>>>> Thanks in advance for any help!
>>>>
>>>> Cheers,
>>>> frank
>>>>
>>>>
>>>> On 4/27/12 10:08 AM, Frank Rueter | OHUfx wrote:
>>>>> Thanks Tibold, I will have a look at that.
>>>>> I'm still not sure how to figure out the positioning in a 
>>>>> procedural way though.
>>>>> Will investigate more.
>>>>>
>>>>> Cheers,
>>>>> frank
>>>>>
>>>>> On 4/26/12 6:53 PM, Tibold Kandrai wrote:
>>>>>> Hi,
>>>>>>
>>>>>> Try to subclass QDockWidget. You will have to set it's geometry
>>>>>> manually. Also if you want the widgets to pop up above the centralWidget
>>>>>> than don't add the dock widgets to any layout. Simply add them with the
>>>>>> main window as their parent, and raise them when you show them.
>>>>>> Using this technique I managed to implement auto hiding widgets like in
>>>>>> Visual Studio. It's not trivial, but it's possible.
>>>>>> Actually if you don't need any of the QDockWIdget's functionality you
>>>>>> can do the same with a QFrame as well. Same logic, override it's
>>>>>> geometry, and don't add them to the grid layout. Adding the widgets to
>>>>>> the grid layout will always push the central widget.
>>>>>>
>>>>>> Cheers,
>>>>>> Tibold
>>>>>>
>>>>>> On 2012-04-26 08:42, Frank Rueter | OHUfx wrote:
>>>>>>> Hi,
>>>>>>>
>>>>>>> end of day for me and my brain has gone numb, so I'm probably missing
>>>>>>> the obvious:
>>>>>>>
>>>>>>> I'm trying to create a widget with three areas: top, middle and bottom
>>>>>>> (using QFrames as place holders for now).
>>>>>>> The middle frame is meant to be visible from the start containing some
>>>>>>> text and other widgets, when the button is pushed, the top frame is
>>>>>>> meant to slide down into view and the bottom frame is meant to slide up
>>>>>>> into view, so that I'm left with a controllable vertical arrangements of
>>>>>>> those three frames.
>>>>>>> Here is my ugly attempt so far:
>>>>>>> http://pastebin.com/index/bNJ9zeUm
>>>>>>>
>>>>>>> Things do move but I can't control the start and end positions properly
>>>>>>> and the GridLayout adjusts itself when showing the extra frames, so that
>>>>>>> the middle frame jumps. I have no idea how to set the size hints etc. to
>>>>>>> define the start and end positions of the sliding QFrames generically
>>>>>>> and avoid the jumping middle frame (might have to go with an alternative
>>>>>>> approach to QGridLayout?!).
>>>>>>>
>>>>>>> Any help would be greatly appreciated.
>>>>>>>
>>>>>>> Frank
>>>>>>> _______________________________________________
>>>>>>> PySide mailing list
>>>>>>> PySide at qt-project.org
>>>>>>> http://lists.qt-project.org/mailman/listinfo/pyside
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> PySide mailing list
>>>>>> PySide at qt-project.org
>>>>>> http://lists.qt-project.org/mailman/listinfo/pyside
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> PySide mailing list
>>>>> PySide at qt-project.org
>>>>> http://lists.qt-project.org/mailman/listinfo/pyside
>>>>
>>>>
>>>> _______________________________________________
>>>> PySide mailing list
>>>> PySide at qt-project.org
>>>> http://lists.qt-project.org/mailman/listinfo/pyside
>>>
>>> -- 
>>> Tibold Kandrai,
>>> CEO @ Dotz Team I/S,
>>> Software developer, consultant
>>>
>>>
>>> _______________________________________________
>>> PySide mailing list
>>> PySide at qt-project.org
>>> http://lists.qt-project.org/mailman/listinfo/pyside
>>
>>
>> _______________________________________________
>> PySide mailing list
>> PySide at qt-project.org
>> http://lists.qt-project.org/mailman/listinfo/pyside
>
> -- 
> Tibold Kandrai,
> CEO @ Dotz Team I/S,
> Software developer, consultant
>
>
> _______________________________________________
> PySide mailing list
> PySide at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/pyside
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/pyside/attachments/20120501/70015e39/attachment.html>


More information about the PySide mailing list