Results 1 to 5 of 5

Thread: Display one widget at a time

  1. #1
    Join Date
    May 2012
    Posts
    23
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Display one widget at a time

    I have a menu option and under it is extract and embedd.
    This is the default interface (which is the embedd interface)
    1.png

    Now when the user clicks on the extract option a different window should apper. Like the one below
    2.png

    And when the user switches back to the embedd option the interface should look like the first image

    Any suggestions???

  2. #2
    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: Display one widget at a time


  3. #3
    Join Date
    May 2012
    Posts
    23
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Display one widget at a time

    can you give a simple sample?

  4. #4
    Join Date
    May 2012
    Location
    Bangalore, India
    Posts
    271
    Thanks
    29
    Thanked 50 Times in 47 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Display one widget at a time

    Read Documentation---->


    Qt Code:
    1. QWidget *firstPageWidget = new QWidget;
    2. QWidget *secondPageWidget = new QWidget;
    3. QWidget *thirdPageWidget = new QWidget;
    4.  
    5. QStackedWidget *stackedWidget = new QStackedWidget;
    6. stackedWidget->addWidget(firstPageWidget);
    7. stackedWidget->addWidget(secondPageWidget);
    8. stackedWidget->addWidget(thirdPageWidget);
    9.  
    10. QVBoxLayout *layout = new QVBoxLayout;
    11. layout->addWidget(stackedWidget);
    12. setLayout(layout);
    To copy to clipboard, switch view to plain text mode 

    QStackedWidget provides no intrinsic means for the user to switch page. This is typically done through a QComboBox or a QListWidget that stores the titles of the QStackedWidget's pages. For example:
    Qt Code:
    1. QComboBox *pageComboBox = new QComboBox;
    2. pageComboBox->addItem(tr("Page 1"));
    3. pageComboBox->addItem(tr("Page 2"));
    4. pageComboBox->addItem(tr("Page 3"));
    5. connect(pageComboBox, SIGNAL(activated(int)),
    6. stackedWidget, SLOT(setCurrentIndex(int)));
    To copy to clipboard, switch view to plain text mode 

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Display one widget at a time

    Quote Originally Posted by stbb24 View Post
    can you give a simple sample?
    Things marked green on this forum are hyperlinks, most often to Qt documentation. If you click such link, you'll be redirected to aforementioned documentation. Once you do that, you'll learn that Qt class manuals contain embedded examples or links to external examples of using the class being documented.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. real time data display
    By hammer256 in forum Qt Programming
    Replies: 13
    Last Post: 25th March 2013, 16:47
  2. how to display video at a certain time?
    By cic in forum Qt Programming
    Replies: 1
    Last Post: 17th November 2011, 12:01
  3. How to display time in Progress Bar?
    By Gokulnathvc in forum Newbie
    Replies: 8
    Last Post: 12th August 2011, 11:56
  4. display time as as string ?
    By Petr_Kropotkin in forum Newbie
    Replies: 26
    Last Post: 29th January 2010, 15:46
  5. Replies: 10
    Last Post: 21st July 2009, 14:22

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.