yes, you can.
{
layout->addWidget(m_pbNewWindow);
tabWidget->addTab(page, tr("Test"));
connect(m_pbNewWindow, SIGNAL(clicked()), SLOT(newWindow()));
setCentralWidget(tabWidget);
}
void Test::newWindow()
{
Test *test = new Test(this);
test->setAttribute(Qt::WA_DeleteOnClose);
test->show();
}
Test::Test(QWidget *parent)
: QMainWindow(parent)
{
QTabWidget *tabWidget = new QTabWidget();
QWidget *page = new QWidget();
QHBoxLayout *layout = new QHBoxLayout(page);
m_pbNewWindow = new QPushButton(tr("New window"));
layout->addWidget(m_pbNewWindow);
tabWidget->addTab(page, tr("Test"));
connect(m_pbNewWindow, SIGNAL(clicked()), SLOT(newWindow()));
setCentralWidget(tabWidget);
}
void Test::newWindow()
{
Test *test = new Test(this);
test->setAttribute(Qt::WA_DeleteOnClose);
test->show();
}
To copy to clipboard, switch view to plain text mode
Bookmarks