Results 1 to 4 of 4

Thread: TabWidget Problem

  1. #1
    Join Date
    Mar 2010
    Posts
    38
    Qt products
    Qt4
    Platforms
    Windows Symbian S60

    Question TabWidget Problem

    So, i create tabs with close button.

    Connected close signal with close slot

    Qt Code:
    1. connect(tabWidget, SIGNAL(tabCloseRequested(int)), this, SLOT(closeTab(int)));
    To copy to clipboard, switch view to plain text mode 

    and here is the close slot:
    Qt Code:
    1. void MainWindow::closeTab(int idx1)
    2. {
    3. tabWidget->removeTab(idx1);
    4.  
    5. }
    To copy to clipboard, switch view to plain text mode 


    if i trying to close the second tab im reciving



    so
    if im trying to close the last tab, it works normally but if i close the second, all tabs after it are deleting too. What i do wrong??

  2. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: TabWidget Problem

    I can not reproduce that with the code you have given.

  3. #3
    Join Date
    Aug 2009
    Location
    Belgium
    Posts
    310
    Thanks
    10
    Thanked 31 Times in 25 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: TabWidget Problem

    Hi,

    Seems similar to the problem in the following thread : Removing-a-tab-in-QTabWidget-removes-tabs-to-right-as-well

    Regards,
    Marc

  4. #4
    Join Date
    Mar 2010
    Posts
    38
    Qt products
    Qt4
    Platforms
    Windows Symbian S60

    Smile Re: TabWidget Problem

    Thanks. After reading that topic i decided that the best way to delete a tab is delete it in such way:

    Qt Code:
    1. void MainWindow::closeTab(int idx1)
    2. {
    3. tabWidget->widget(idx1)->deleteLater();
    4. }
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. tabWidget in Designer
    By ShamusVW in forum Newbie
    Replies: 1
    Last Post: 10th August 2010, 09:21
  2. Add tab to tabwidget thru Designer.
    By phillip_Qt in forum Qt Programming
    Replies: 2
    Last Post: 13th January 2010, 11:00
  3. Problem drowing in tabWidget...
    By dspfen in forum Qt Programming
    Replies: 5
    Last Post: 10th December 2009, 02:54
  4. TabWidget
    By Salazaar in forum Newbie
    Replies: 5
    Last Post: 17th May 2007, 21:07
  5. tabWidget Question
    By phlash in forum Qt Tools
    Replies: 1
    Last Post: 28th March 2007, 10:54

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.