×

Discussion Board

Results 1 to 2 of 2

Hybrid View

  1. #1
    Registered User
    Join Date
    May 2012
    Posts
    16

    Change/replace widgets in layout

    Hello,

    it is a basic question but don't know the solution. I'm not an expert in programming so I use a single screen (whole app in one screen). Some of my apps require dialog boxes or privacy messages that contain more text so I have to use e.g. QTextBrowser to display the text.

    My problem is changing the widgets in one layout. If I have a layout that contains a button, a label and a slider and want to display a QTextBrowser, I probably have to remove all other three widgets and add a new one, right? Is this reasonable and does not do any illegal calls/use ? My code works but not reliably (especially when changing the layout back to the original one). I've been googling but cannot get a clear answer how to do that.
    I'm using QtSDK, C++, no QML.

    Thank you.

  2. #2
    Registered User
    Join Date
    Aug 2012
    Posts
    5

    Re: Change/replace widgets in layout

    Add your TextBrowser on creation of your widget class as a member var. Every QWidget has a show() and a hide() function. Call these functions to hide your TextBrowser at startup. When you want to switch to this TextBrowser, just call hide() on the three other widgets and call show on TextBrowser.

Similar Threads

  1. How to resize the Widgets inside the Layout
    By deepak6raji in forum Qt
    Replies: 8
    Last Post: 2010-10-08, 13:35
  2. Replies: 3
    Last Post: 2010-09-03, 12:16
  3. Replies: 6
    Last Post: 2010-08-04, 13:33

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×