Results 1 to 8 of 8

Thread: TabWidget index

  1. #1
    Join Date
    Jul 2011
    Posts
    6
    Qt products
    Qt3
    Platforms
    Unix/X11

    Question TabWidget index

    Hello,
    I would like to know what the signal when I move between the tabs ....
    Then if I create 5 tabs and I want to save into a variable my current position, i.e. the index of the tab in the foreground ... how do I? What is the method??

    Thanks !!!!!!!

  2. #2
    Join Date
    Sep 2011
    Posts
    1,241
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    3
    Thanked 127 Times in 126 Posts

    Default Re: TabWidget index

    answered elsewhere

  3. #3
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Wiki edits
    5

    Default Re: TabWidget index

    For everyone who don't want to change the forum: QTabWidget::currentChanged().

  4. #4
    Join Date
    Sep 2011
    Posts
    1,241
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    3
    Thanked 127 Times in 126 Posts

    Default Re: TabWidget index

    actually currentIndex() is a better solution since it does the job for you already.

  5. #5
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Wiki edits
    5

    Default Re: TabWidget index

    Actually QTabWidget::currentIndex() is a property whereas QTabWidget::currentChanged() is the signal which notifies you about a tab change. That is the main question. Furthermore have a look at the argument of QTabWidget::currentChanged() ... you don't have to call QTabWidget::currentIndex() at all.

  6. #6
    Join Date
    Sep 2011
    Posts
    1,241
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    3
    Thanked 127 Times in 126 Posts

    Default Re: TabWidget index

    Implicit in the question is the actual need - the current index. since there is no need to use signal to store the value to check it later, currentIndex is the correct approach - any time you want to know the index, just check it! No need for connecting signals/slots. no need for storing a value that is already stored in the tab widget!!!

  7. #7
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Wiki edits
    5

    Default Re: TabWidget index

    Quote Originally Posted by beppuz View Post
    I would like to know what the signal when I move between the tabs ....
    Asked for a signal.
    Then if I create 5 tabs and I want to save into a variable my current position, i.e. the index of the tab in the foreground ... how do I? What is the method?
    QList<int> is also a variable and could be used for some sort of history. But neither you nor me can tell what the better solution is since we don't know what beppuz really wants.

  8. #8
    Join Date
    Jul 2011
    Posts
    6
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Re: TabWidget index

    Thanks for your answers ....
    it works! thank you very much

Similar Threads

  1. TabWidget Problem
    By TJSonic in forum Qt Programming
    Replies: 3
    Last Post: 21st October 2010, 15:25
  2. tabWidget in Designer
    By ShamusVW in forum Newbie
    Replies: 1
    Last Post: 10th August 2010, 10:21
  3. Add tab to tabwidget thru Designer.
    By phillip_Qt in forum Qt Programming
    Replies: 2
    Last Post: 13th January 2010, 12:00
  4. TabWidget's Tab's parent
    By alisami in forum Qt Programming
    Replies: 12
    Last Post: 31st March 2009, 14:30
  5. TabWidget
    By Salazaar in forum Newbie
    Replies: 5
    Last Post: 17th May 2007, 22:07

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.