Results 1 to 4 of 4

Thread: qgridlayout and hiding widgets

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2010
    Posts
    9
    Qt products
    Platforms
    Windows

    Default qgridlayout and hiding widgets

    hi!
    i have a QGridLayout which contents for example 3*3 widgets, and let the middle widget be named as 'GL_SL'.
    Also i have some button , and when i press it i want to hide all widgets in gridlayout except my main - and the main should be 'maximized' to the size of gridlayout.

    hiding:
    Qt Code:
    1. for i in range(self.gridLayout.count() - 1, -1, -1):
    2. x = self.gridLayout.itemAt(i).widget()
    3. if x.objectName() != 'GL_LS':
    4. x.hide()
    5. self.gridLayout.activate()
    6. self.opengl.adjustSize() ## self.opengl is 'GL_SL'
    To copy to clipboard, switch view to plain text mode 

    show:
    Qt Code:
    1. for i in range(self.gridLayout.count() - 1, -1, -1):
    2. x = self.gridLayout.itemAt(i).widget()
    3. if x.objectName() != 'GL_LS':
    4. x.show()
    5. self.gridLayout.activate()
    6. self.adjustSize()
    To copy to clipboard, switch view to plain text mode 

    and that of course isn't right, cause all stuff disappears, but the 'GL_SL' is not maximized, because there are still other widgets in gridlayout, they are only hidden now, but layout.activate and adjustSize can't help to make my center widget 'maximized' in layout.

    the way i can solve the problem - add and remove widgets (instead of show and hide)..)

    what is the best solution foir my problem?

    thank you!
    Last edited by Michael_Levin; 21st May 2010 at 11:18.

Similar Threads

  1. Replies: 2
    Last Post: 23rd October 2012, 01:10
  2. space between widgets in qgridlayout
    By demol in forum Qt Programming
    Replies: 2
    Last Post: 6th January 2010, 20:07
  3. Delete a QGridLayout and New QGridLayout at runtime
    By sabeesh in forum Qt Programming
    Replies: 1
    Last Post: 5th November 2007, 13:01
  4. Qt 3.3 QGridLayout
    By ToddAtWSU in forum Qt Programming
    Replies: 2
    Last Post: 23rd February 2007, 17:40
  5. Performance in hiding/showing widgets
    By Paalrammer in forum Newbie
    Replies: 12
    Last Post: 14th February 2007, 18:57

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
  •  
Qt is a trademark of The Qt Company.