Results 1 to 5 of 5

Thread: Fix element in risizing window

  1. #1
    Join Date
    Jun 2009
    Posts
    37
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Fix element in risizing window

    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

  2. #2
    Join Date
    Apr 2009
    Location
    Valencia (Spain)
    Posts
    245
    Thanks
    38
    Thanked 19 Times in 19 Posts
    Qt products
    Qt4
    Platforms
    Symbian S60

    Default Re: Fix element in risizing window

    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.

  3. #3
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Fix element in risizing window

    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.
    Attached Files Attached Files

  4. #4
    Join Date
    Jun 2009
    Posts
    37
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Fix element in risizing window

    Thank you guys... You were really helpful!

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

  5. #5
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Fix element in risizing window

    Quote Originally Posted by JoZCaVaLLo View Post
    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

Similar Threads

  1. How to set Qt window transparent?
    By montylee in forum Qt Programming
    Replies: 17
    Last Post: 24th December 2013, 20:11
  2. QMain Window Problem
    By maveric in forum Qt Programming
    Replies: 1
    Last Post: 24th May 2008, 15:51
  3. Set a window as child at runtime
    By sabeesh in forum Qt Programming
    Replies: 1
    Last Post: 26th November 2007, 09:30
  4. Change shape of window / animate window
    By sabeesh in forum Qt Programming
    Replies: 3
    Last Post: 31st October 2007, 08:16
  5. move parent window to the front.
    By hvengel in forum Qt Programming
    Replies: 4
    Last Post: 2nd February 2007, 08:41

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.