Results 1 to 3 of 3

Thread: QTabWidgets: I can't remove a tab

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jun 2015
    Location
    India
    Posts
    185
    Thanks
    8
    Thanked 14 Times in 14 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QTabWidgets: I can't remove a tab

    lets say you have 3 tabs, index 0, 1, 2

    Qt Code:
    1. ui->Pestanas->setCurrentIndex(0);
    2. ui->Pestanas->removeTab(1);
    3. ui->Pestanas->removeTab(2);
    To copy to clipboard, switch view to plain text mode 

    You set current tab to first tab. //index 0
    And you removed 2nd tab with //ui->Pestanas->removeTab(1); //index 1
    Now tab indexes will changed, now tab indexes you have are : 0, 1

    And now you are trying to remove 3rd Tab(index 2) which is not there //ui->Pestanas->removeTab(2);


    Try this:
    Qt Code:
    1. ui->Pestanas->removeTab(1);
    2. ui->Pestanas->removeTab(1);
    To copy to clipboard, switch view to plain text mode 
    Thanks :-)

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

    Alberto7 (8th October 2015)

  3. #2
    Join Date
    Oct 2015
    Location
    Barcelona, Spain
    Posts
    7
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Windows Android

    Default Re: QTabWidgets: I can't remove a tab

    Your solution solved my problem!
    Very well explained.

    Thank you very much!

Similar Threads

  1. Size of Widgets in QTabWidgets
    By krassy_gochev in forum Newbie
    Replies: 1
    Last Post: 7th April 2015, 07:00
  2. remove flags?
    By konvex in forum Qt Programming
    Replies: 5
    Last Post: 18th March 2015, 02:26
  3. Remove all translators
    By EdgeLuxe in forum Newbie
    Replies: 1
    Last Post: 27th August 2010, 16:31
  4. Resize the height of QTabWidgets
    By tarod in forum Qt Programming
    Replies: 3
    Last Post: 28th July 2008, 12:48
  5. How to remove background
    By kawazoe in forum Qt Programming
    Replies: 28
    Last Post: 20th May 2007, 01:48

Tags for this Thread

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.