Results 1 to 7 of 7

Thread: QStackedWidget

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jun 2007
    Location
    India
    Posts
    1,042
    Thanks
    8
    Thanked 133 Times in 128 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QStackedWidget

    Quote Originally Posted by sattu View Post
    Thanks Nish, but what about this 2 methods:

    Qt Code:
    1. previousInFocusChain (), nextInFocusChain ()
    To copy to clipboard, switch view to plain text mode 
    dont you see "focus" in these methods also? they all fall in the same criteria i mentioned you about.

    This 2 methods return Widget*. When I use them like this:
    Qt Code:
    1. ui->stackedWidget->setCurrentWidget(ui->stackedWidget->previousInFocusChain());
    To copy to clipboard, switch view to plain text mode 

    But I get the following Application Output:


    My main purpose is that I need a more general way of achieving this type of operations, instead of hard-coating the WidgetNames. Please help.
    use index instead of widgets. something like-

    Qt Code:
    1. void setPreviousWidget()
    2. {
    3. int index = stackWidget->currentIndex() - 1;
    4.  
    5. if ( index < 0 )
    6. index = stackWidget->count() - 1;//go to last widget (or do not change if you like, return from here).
    7.  
    8. statckWidget->setCurrentIndex(index);
    9.  
    10. }
    To copy to clipboard, switch view to plain text mode 

  2. The following user says thank you to nish for this useful post:

    sattu (28th September 2011)

  3. #2
    Join Date
    Sep 2010
    Location
    Bangalore
    Posts
    169
    Thanks
    59
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QStackedWidget

    Thanks a lot Nish,

    This INDEX stuff works a lot great. Thanks once again for the help.

    With Regards,
    Sattu.
    Last edited by sattu; 28th September 2011 at 13:43.

  4. #3
    Join Date
    Jun 2007
    Location
    India
    Posts
    1,042
    Thanks
    8
    Thanked 133 Times in 128 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QStackedWidget

    Quote Originally Posted by sattu View Post
    Thanks a lot Chris,
    You got my nick wrong.

  5. #4
    Join Date
    Sep 2010
    Location
    Bangalore
    Posts
    169
    Thanks
    59
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QStackedWidget

    Oops sorry, My mistake. Thanks Giving Statement modified

Similar Threads

  1. QStackedLayout / QStackedWidget
    By morraine in forum Newbie
    Replies: 15
    Last Post: 12th July 2013, 09:16
  2. get my widget from QStackedWidget
    By szisziszilvi in forum Newbie
    Replies: 4
    Last Post: 22nd August 2011, 08:14
  3. problem with QStackedwidget
    By psantofe in forum Qt Programming
    Replies: 3
    Last Post: 14th April 2010, 12:41
  4. QTableWidget along with QStackedWidget
    By smiling in forum Qt Programming
    Replies: 5
    Last Post: 13th March 2010, 12:46
  5. Help with QStackedWidget
    By onírico in forum Newbie
    Replies: 6
    Last Post: 12th November 2009, 16:34

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.