Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Problem in deleting QTabWidget's Widget...
Forum Update on Monday, May 27th 2025

Problem in deleting QTabWidget's Widget...

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 3.6k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    M_31
    wrote on 12 Oct 2011, 14:34 last edited by
    #1

    HI All,
    I have added a QDialog into the QTabWidget...and while i try to remove first QWidget's TabBar...
    All TabBar is getting removed from my QTabWidget

    @
    void CTestDlg::addWidget()
    {
    CQuestionDlg *questionDlg = new CQuestionDlg();
    ui->tabExams->addTab( questionDlg , "Question1");
    }

    void CTestDlg::tabClose(int nCurIndex)
    {
    QWidget *wdgt = ui->tabWidget->widget( nCurIndex );
    if( wdgt )
    {
    delete wdgt;
    wdgt = 0;
    }
    ui->tabWidget->removeTab( nCurIndex );

    }
    @

    please let me know whether i am doing anything wrong on this..

    1 Reply Last reply
    0
    • V Offline
      V Offline
      vsorokin
      wrote on 12 Oct 2011, 15:00 last edited by
      #2

      You should call removeTab first

      @
      QWidget *wdgt = ui->tabWidget->widget( nCurIndex );
      ui->tabWidget->removeTab( nCurIndex );
      if( wdgt )
      delete wdgt;
      @

      wdgt = 0; Not needed because wdgt is local.

      --
      Vasiliy

      1 Reply Last reply
      0
      • M Offline
        M Offline
        M_31
        wrote on 12 Oct 2011, 15:07 last edited by
        #3

        Thanks Vass ..its working fine....
        Thanks for your Valuable inputs..

        1 Reply Last reply
        0

        1/3

        12 Oct 2011, 14:34

        • Login

        • Login or register to search.
        1 out of 3
        • First post
          1/3
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved