Results 1 to 12 of 12

Thread: auto resize component in main window when main windows is resized

  1. #1
    Join Date
    Jul 2008
    Posts
    12
    Thanks
    2

    Default auto resize component in main window when main windows is resized

    Dear all, I know this is kind of newbie question. But I tried to search forum but can not find the solution. Below is the capture of my main windows.



    Basically the left hand side is a label(please select file....) and right hand side is a tab. When user use this application and change the size I want the label to expand horizontally and vertically to fit the screen. And the tab to expand vertically. Can anyone suggest me how to do that ??

    And if possible, can I hide the tab first and when people move the mouse near it then show it ( like a windows autohide task bar ) ???

    thank in advance
    Attached Images Attached Images

  2. #2
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: auto resize component in main window when main windows is resized

    Basically the left hand side is a label(please select file....) and right hand side is a tab. When user use this application and change the size I want the label to expand horizontally and vertically to fit the screen. And the tab to expand vertically. Can anyone suggest me how to do that ??
    change sizePolicy for tabWidget Horizantal=Fixed.

  3. #3
    Join Date
    Jul 2008
    Posts
    12
    Thanks
    2

    Default Re: auto resize component in main window when main windows is resized

    I tried, that would fix the tab. But how to automatically expand it(vertically) when user change the main windows size ?

  4. #4
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: auto resize component in main window when main windows is resized

    did you put label and tab in layout?

  5. #5
    Join Date
    Jul 2008
    Posts
    12
    Thanks
    2

    Default Re: auto resize component in main window when main windows is resized

    Quote Originally Posted by spirit View Post
    did you put label and tab in layout?
    No. And I just tried to put label and tab in horizontal layout. But no different. It is still not expand automatically when main windows is expand.

  6. #6
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: auto resize component in main window when main windows is resized

    can you post ui-file?

  7. The following user says thank you to spirit for this useful post:

    jirach_gag (11th August 2008)

  8. #7
    Join Date
    Jul 2008
    Posts
    12
    Thanks
    2

    Default Re: auto resize component in main window when main windows is resized

    Dear spirit, I have attached my ui file. Thank a lot for helping
    Attached Files Attached Files

  9. #8
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: auto resize component in main window when main windows is resized

    is than what you need?
    Attached Files Attached Files

  10. The following user says thank you to spirit for this useful post:

    jirach_gag (11th August 2008)

  11. #9
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: auto resize component in main window when main windows is resized

    sorry, I forgot one more: in SizePolicy of tabWidget you should set next values:
    hSizeType == Fixed (was initial)
    vSizeType == Preferred

  12. #10
    Join Date
    Jul 2008
    Posts
    12
    Thanks
    2

    Default Re: auto resize component in main window when main windows is resized

    Thank a lot spirit !! It's work.

    Can you explain what I did wrong -.-

  13. #11
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: auto resize component in main window when main windows is resized

    you set layout for label and tabWidget wrong. you would better click on widget and select "Lay out->Lay out Horizantally" from context menu.

  14. #12
    Join Date
    Jul 2008
    Posts
    12
    Thanks
    2

    Default Re: auto resize component in main window when main windows is resized

    Thank again spirit

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.