Results 1 to 7 of 7

Thread: Layout resizing problem

  1. #1

    Question Layout resizing problem

    Hi, I've got this application: Capture.jpg
    As you can see, I've got two PushButtons with black arrows. Those buttons are supposed to make the corresponding widget (either the tabWidget on the left or the normal widget on the right) take the entire size of the application window. I've tried to resize using the corresponding function but it's not working... I've also seen that showFullScreen() only works for independant windows...
    Can you please tell me why my resize is not working? Here's what I have done so far:
    Qt Code:
    1. ui.LayoutCahiers->setSizeConstraint(QLayout::SizeConstraint::SetNoConstraint); // I'm trying to destroy all constraints that may interfere with the resize function
    2. ui.Onglets->resize(200, 500); //trying to resize with random values (just to see if it works)
    To copy to clipboard, switch view to plain text mode 

    Thanks for your replies.

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Layout resizing problem

    My first idea would be to use a QSplitter for the separation. It allows sections to be collapsed

    Another approach would be to hide the part that should no longer be visible.

    Cheers,
    _

  3. #3

    Default Re: Layout resizing problem

    Thanks for your reply.
    I've just realised I had understood it all wrong: when you push the button, the widget needs to be fullscreen. If I manage to make the corresponding widget an independent window and use showFullScreen() it'll be great.
    Could it be possible to "detach" the widget from the main application window? And reatach it to the window afterwards?

    I tried this:
    Qt Code:
    1. ui.Onglets->setParent(0);
    2. ui.Onglets->showFullScreen();
    To copy to clipboard, switch view to plain text mode 
    but it's not working


    Added after 14 minutes:


    Sorry it actually works. My connect was messing it up. I've got one more problem though, when I come back from fullscreen (using showNormal() ) my widget takes the entire page (the second is in background I guess).
    How could I come back to the layout I had done?
    I tried setLayout() but which layout should I take? My window layout, my widget layout? Another one I haven't thought about?

    I've tried with every single layout I got in my ui, not working.
    Last edited by Yaoming; 15th January 2014 at 15:44.

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Layout resizing problem

    You'll need to show more code.
    Ideally a small example program that can be built and run to demonstrate the problem.

    Cheers,
    _

  5. #5

    Default Re: Layout resizing problem

    Qt Code:
    1. if(!widgetIsFullscreen)
    2. {
    3. ui.Geom->setParent(0);
    4. ui.Geom->showFullScreen();
    5. ui.GeomPleinEcran->setIcon(QIcon("Resources/SortieFullscreen.gif"));
    6. widgetIsFullscreen = true;
    7. return;
    8. }
    9. else
    10. {
    11. ui.Geom->setParent(ui.centralWidget);
    12. ui.Geom->showNormal();
    13. ui.GeomPleinEcran->setIcon(QIcon("Resources/Fullscreen.gif"));
    14. widgetIsFullscreen = false;
    15. return;
    16. }
    To copy to clipboard, switch view to plain text mode 
    This is what I've done for the left widget (sorry I'm French so my attributes names are in french). Anyway, I got a boolean that is either true (if the widget is fullscreen) or false (if it isn't). I put the icon corresponding to the state of the widget (fullscreen or not). If the button is clicked, if we are in fullScreen, then we go out of it (setParent and setLayout?) if not then we toggle our fullscreen mode (setParent(0)).
    Thanks for helping me

  6. #6
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Layout resizing problem

    You need to add the widget to the layout it was in before you removed and maximised it.
    Qt Code:
    1. ui.layoutCahiers.addWidget(ui.Geom);
    2. // or
    3. ui.layoutCahiers.insertWidget(0, ui.Geom);
    To copy to clipboard, switch view to plain text mode 

  7. #7

    Default Re: Layout resizing problem

    Thanks a lot it works perfectly now.

Similar Threads

  1. resize problem with QHeaderView using qt4.5.3
    By drawat in forum Qt Programming
    Replies: 0
    Last Post: 4th August 2010, 08:42
  2. QGLWidget resize problem
    By Term Dickem in forum Qt Programming
    Replies: 0
    Last Post: 26th May 2010, 14:12
  3. resize problem
    By yuvaraj.yadav in forum Qt Programming
    Replies: 3
    Last Post: 4th May 2009, 17:42
  4. QGLWidget Resize Problem
    By Sandip in forum Qt Programming
    Replies: 2
    Last Post: 28th February 2008, 06:47
  5. Resize Problem
    By mambo in forum Qt Programming
    Replies: 1
    Last Post: 9th October 2006, 15: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.