Results 1 to 3 of 3

Thread: Hiding layouts in BorderLayout - how to?

  1. #1
    Join Date
    Aug 2013
    Posts
    13
    Thanks
    6
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Question Hiding layouts in BorderLayout - how to?

    Hi

    I write application which uses BorderLayout.

    I have one main layout in the center, and additionaly one in the bottom, and one on the left side:
    • Center layout has only QTextEdit, and it's filling almost entire space of the window
    • South layout has few QLabels and QLineEdit
    • West layout has little more various controls (and will have more in future, so I plan to add here QDockWidget)


    I want to have possiblity to toggle hide/show South and West layout with custom keyboard shortcut when QTextEdit is active. Unfortunately BorderLayouts don't have hide() option.
    I could hide one control by one, but:
    • this could be laborious
    • even if I did this, there is small space visible in the rest of South or West panel, I can set this in BorderLayout.cpp constructor, but as I said, manual hiding all controls will be hard


    My question: how can I easily toggle show/hide some layouts in BorderLayout? I appreciate any help.

  2. #2
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 453 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: Hiding layouts in BorderLayout - how to?

    I have one main layout in the center, and additionaly one in the bottom, and one on the left side:
    - Center layout has only QTextEdit, and it's filling almost entire space of the window
    - South layout has few QLabels and QLineEdit
    - West layout has little more various controls (and will have more in future, so I plan to add here QDockWidget)
    As per border layout example you should have
    - Central Widget as QTextEdit
    - South widget containng another layout which contains few QLabels and QlineEdit
    - West widget containing another layout which contains little more various widges

    -West layout has little more various controls (and will have more in future, so I plan to add here QDockWidget)
    Why are messing with QDockWidget here?

    My question: how can I easily toggle show/hide some layouts in BorderLayout? I appreciate any help.
    Note you should have only one border layout which should contain muliple widgets, each of which may contain their specific layouts. Bottom line is you will have to hide/show the widget not the layout in a widget. So get the west / south widget and call hide on it.
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

  3. #3
    Join Date
    Aug 2013
    Posts
    13
    Thanks
    6
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Hiding layouts in BorderLayout - how to?

    Thank you for your reply and your corrections, but I'm not sure if I understod you right (I'm not native english speaker).
    Quote Originally Posted by Santosh Reddy View Post
    get the west / south widget and call hide on it.
    I can't use something like:
    Qt Code:
    1. WestWidget->hide();
    To copy to clipboard, switch view to plain text mode 
    Even if I'd put in WestWidget some QHBoxLayout, nor I can't do this:
    Qt Code:
    1. qhboxLayoutInWestWidget->hide();
    To copy to clipboard, switch view to plain text mode 
    What do you mean to call hide on them?


    Quote Originally Posted by Santosh Reddy View Post
    Why are messing with QDockWidget here?
    West widget has another BorderLayout, and its Center Widget will cotain a lot of layouts and widgets which I want to switch with something (something like TabDialog), but I haven't decided about it yet.

Similar Threads

  1. Replies: 2
    Last Post: 23rd October 2012, 01:10
  2. Need Help with Layouts
    By baluk in forum Qt Programming
    Replies: 2
    Last Post: 21st October 2010, 07:30
  3. Layouts
    By csvivek in forum Qt Tools
    Replies: 3
    Last Post: 7th May 2008, 07:22
  4. Layouts
    By Dumbledore in forum Qt Tools
    Replies: 1
    Last Post: 14th October 2007, 01:01
  5. Layouts - Name cant be set
    By manivannan_1984 in forum Qt Programming
    Replies: 1
    Last Post: 14th September 2006, 18:38

Tags for this Thread

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.