PDA

View Full Version : Fix element in risizing window



JoZCaVaLLo
25th June 2009, 15:25
Hi... Started last week programming with QT after a couple of years of .NET and c#...

I have to reproduce the main window of our current application with QT and I have one thing I cannot figure out, maybe because I'm still with .NET approach.

In this main window I have 2 elements, a big QTextBrowser on top and a small QTextEdit on bottom. the QTextEdit has a fix height of 100 and must always be visible. It means that when the user resizes the window, the QTextBrowser resizes and the QTextEdit moves... remaining on bottom of the window.

My question is: is there some parameters I missed (in QSplitter or anything else) or do I have to program this behaviour by myself?

If you find this a stupid question, can you point me to a good site where they easily explain how to migrate my mind from .NET to QT philosphy?

Thanks in advance

jano_alex_es
25th June 2009, 15:36
there are no stupid questions, at least not in the newbie forum :P

you need to take a look to theQLayout. In the editor you add a some layouts to the document and with them, some properties and the spacers you will achieve the proper behavior.

Lykurg
25th June 2009, 15:58
Hi, as mentioned you may want take a closer look to the layout system which is used by Qt, which is indeed very powerful and usable..

For your case it is always good to play in the designer and see how the widgets behave. Select your "parent/container widget" and place in this your browser and your edit. then lay them out. Use for that a QVBoxLayout. In that options you can edit the margin and spacing... then select the editor and set its min and max height to 100. then you should have your desired behavior.

Lykurg

EDIT: I have attached a simple ui of what you want. If you don't want use the designer translate the ui via uic to a h file and look inside and "steal" the pure c++ code.

JoZCaVaLLo
26th June 2009, 09:36
Thank you guys... You were really helpful!

I have to say that this layout seems to work much better then the .NET split panel...

Lykurg
26th June 2009, 10:35
I have to say that this layout seems to work much better then the .NET split panel...

Listen.


ah, there, or?




Listen carefully!



can you hear it? No? Yeah, there is no opposition to you statement:D