Results 1 to 3 of 3

Thread: Shared widget by pages in a QStackedWidget

  1. #1
    Join Date
    Feb 2010
    Posts
    61
    Thanks
    18
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Shared widget by pages in a QStackedWidget

    Hi guys,

    I have QStackedWidget object with 3 pages. There several different widgets in every pages and QStackedWidget ensures that only one page at a time is visible.

    Nevertheless I would like these pages to share one common QListWidget. This list displays results that should be visible no matter in where page the user is. So I created one QListWidget that I passed in all pages. But it looks like only the last page displays the widget. Of course if I remove the widget from the last page, the widget is then visible in the second page but not in the first one.

    I guess this is related to the QStackedWidget properties. But I'm wondering whether there is a way for this widget to be visible in all pages.

    Any ideas ?

  2. #2
    Join Date
    Feb 2010
    Posts
    27
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Symbian S60

    Default Re: Shared widget by pages in a QStackedWidget

    you could add the QListWidget to the same layout that the QStackedWidget is added to.

    for example:

    mainLayout->addLayout(QStackedWidgetLayout);
    mainLayout->addWidget(QListWidget);

    The QListWidget will then always be available.

  3. The following user says thank you to dubstar_04 for this useful post:

    ouekah (7th March 2010)

  4. #3
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Shared widget by pages in a QStackedWidget

    QStackedWidget doesnt seem right for your problem. You could simply use a QTabBar and catch the currentChanged signal.
    Then you can update the QListWidget.

Similar Threads

  1. Shared widget by pages in a QStackedWidget
    By ouekah in forum Newbie
    Replies: 1
    Last Post: 7th March 2010, 11:01
  2. Shared widget by pages in a QStackedWidget
    By ouekah in forum Newbie
    Replies: 1
    Last Post: 7th March 2010, 11:00
  3. Help with QStackedWidget
    By onírico in forum Newbie
    Replies: 6
    Last Post: 12th November 2009, 16:34
  4. stack widget pages using pushbutton
    By arunvv in forum Newbie
    Replies: 4
    Last Post: 21st March 2008, 11:09
  5. Replies: 4
    Last Post: 13th August 2007, 15:28

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.