Results 1 to 3 of 3

Thread: QTabBar Select added Bar

  1. #1
    Join Date
    Jul 2012
    Location
    Switzerland
    Posts
    32
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Windows

    Default QTabBar Select added Bar

    Hello everyone,

    My program contains a QTabBar. When I open a File, I do tabBar.addTab("blabla"). If I add another tab, I've got the problem that this one isn't selected, because the first one is still selected. I want to select everytime the new Tab which is inserted. I'm really stuck

    thank you for your help

    airglide

  2. #2
    Join Date
    May 2012
    Posts
    136
    Thanks
    2
    Thanked 27 Times in 24 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QTabBar Select added Bar

    Use setCurrentIndex(int index) the index of the new tab is the return value of addTab see the next code:

    Qt Code:
    1. myTabBar->setCurrentIndex(myTabBar->addTab("Some title"));
    To copy to clipboard, switch view to plain text mode 


    if you use a tabwidget you can also use setCurrentWidget(QWidget *widget)

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

    airglide (25th October 2012)

  4. #3
    Join Date
    Jul 2012
    Location
    Switzerland
    Posts
    32
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QTabBar Select added Bar

    great, thank you, that's what I've looked for

Similar Threads

  1. Replies: 0
    Last Post: 17th November 2011, 11:51
  2. Replies: 14
    Last Post: 2nd August 2011, 12:42
  3. Replies: 1
    Last Post: 28th October 2010, 22:36
  4. Save added Data to a GUI
    By bostero22 in forum Qt Programming
    Replies: 1
    Last Post: 8th June 2010, 15:27
  5. QTabBar??
    By anupamgee in forum Qt Programming
    Replies: 12
    Last Post: 30th April 2009, 18:13

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.