Results 1 to 4 of 4

Thread: QWidget display on 2 stack widget page

  1. #1
    Join Date
    Apr 2006
    Posts
    14
    Qt products
    Qt4
    Platforms
    Windows

    Default QWidget display on 2 stack widget page

    Hi all,

    Is it possible to display the same widget on two different page in the stack widget?

    For example, my stack widget store different page view 1, 2 and 3.
    I want to same widget to appear on page 1 and page 3.

    I tried to add the same widget to both page but it will only appear in the later page.

    Any hint on this?


    Thanks

  2. #2
    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: QWidget display on 2 stack widget page

    Either insert another copy of the page and synchronise them or simply don't call page "3" but call "1" instead. You can achieve this either by changing the argument of the setCurrentIndex slot (if possible) or by subclassing QStackedWidget and reimplementing setCurrentIndex to show page "1" instead of "3" (but I don't advise this). You can also use an additional signal-slot connection (with a custom slot) which will change the page to "1" whenever something changes it to "3" (this might result in a slight flicker though).

  3. #3
    Join Date
    Apr 2006
    Posts
    14
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QWidget display on 2 stack widget page

    Quote Originally Posted by wysota
    Either insert another copy of the page and synchronise them or simply don't call page "3" but call "1" instead. You can achieve this either by changing the argument of the setCurrentIndex slot (if possible) or by subclassing QStackedWidget and reimplementing setCurrentIndex to show page "1" instead of "3" (but I don't advise this). You can also use an additional signal-slot connection (with a custom slot) which will change the page to "1" whenever something changes it to "3" (this might result in a slight flicker though).
    Thanks for the reply.

    So I guess it is not possible to have the 2 pages pointing to the same widget for display.
    Everytime I have to display the page, I have to shift the widget to the display, right?

  4. #4
    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: QWidget display on 2 stack widget page

    Correct. The thing you want is achievable but requires subclassing QStackedWidget or implementing your own stack using QStackedLayout.

Similar Threads

  1. Replies: 5
    Last Post: 16th May 2006, 21:38
  2. Replies: 3
    Last Post: 12th April 2006, 09:20

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.