I’m creating TabWidget using designer, before running the program and adding widget in runtime…in this case....i'm creating "tab one", "tab two", "tab three"....
if i close “tab threeâ€, then “tab three†closes thats fine,,,,
But if i close “tab twoâ€, then both “tab two†and “tab three†closes
and if i close “tab oneâ€, then all tab closes…i,e “tab one “, “tab two†and “tab three†closes….
whats wrong here? please help me,,,,,
MainWin.h
{
Q_OBJECT
public slots:
void slotCloseTab(int index);
}
{
Q_OBJECT
public slots:
void slotCloseTab(int index);
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public slots:
void slotCloseTab(int index);
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public slots:
void slotCloseTab(int index);
}
To copy to clipboard, switch view to plain text mode
MainWin.cpp
void MainWindow
::DisplayFileContent(QString string
) {
ui->tabWidget->addTab(textBox,string);
connect(ui->tabWidget,SIGNAL(tabCloseRequested(int)),this,SLOT(slotCloseTab(int)));
f.close();
}
void MainWindow::DisplayFileContent(QString string)
{
textBox = new QTextBrowser;
ui->tabWidget->addTab(textBox,string);
connect(ui->tabWidget,SIGNAL(tabCloseRequested(int)),this,SLOT(slotCloseTab(int)));
f.close();
}
To copy to clipboard, switch view to plain text mode
void MainWindow::slotCloseTab(int index)
{
this->ui->tabWidget->removeTab(index);
}
void MainWindow::slotCloseTab(int index)
{
this->ui->tabWidget->removeTab(index);
}
To copy to clipboard, switch view to plain text mode
Bookmarks