Added test for CDockWidget::setWindowTitle function

This commit is contained in:
Uwe Kindler 2020-07-05 21:48:48 +02:00
parent 0d242297ff
commit e6e83d5775
2 changed files with 23 additions and 0 deletions

View File

@ -165,6 +165,7 @@ struct MainWindowPrivate
QWidgetAction* PerspectiveListAction = nullptr;
QComboBox* PerspectiveComboBox = nullptr;
ads::CDockManager* DockManager = nullptr;
ads::CDockWidget* WindowTitleTestDockWidget = nullptr;
MainWindowPrivate(CMainWindow* _public) : _this(_public) {}
@ -382,6 +383,7 @@ void MainWindowPrivate::createContent()
}
DockWidget = createLongTextLabelDockWidget();
WindowTitleTestDockWidget = DockWidget;
DockWidget->setFeature(ads::CDockWidget::DockWidgetFocusable, false);
DockManager->addDockWidget(ads::LeftDockWidgetArea, DockWidget);
auto FileSystemWidget = createFileSystemTreeDockWidget();
@ -496,6 +498,9 @@ void MainWindowPrivate::createActions()
ui.menuTests->addSeparator();
a = ui.menuTests->addAction("Show Status Dialog");
_this->connect(a, SIGNAL(triggered()), SLOT(showStatusDialog()));
a = ui.menuTests->addAction("Toggle Label 0 Window Title");
_this->connect(a, SIGNAL(triggered()), SLOT(toggleDockWidgetWindowTitle()));
ui.menuTests->addSeparator();
}
@ -745,3 +750,20 @@ void CMainWindow::showStatusDialog()
Dialog.exec();
}
//============================================================================
void CMainWindow::toggleDockWidgetWindowTitle()
{
QString Title = d->WindowTitleTestDockWidget->windowTitle();
int i = Title.indexOf(" (Test)");
if (-1 == i)
{
Title += " (Test)";
}
else
{
Title = Title.left(i);
}
d->WindowTitleTestDockWidget->setWindowTitle(Title);
}

View File

@ -64,6 +64,7 @@ private slots:
void createTable();
void onEditorCloseRequested();
void showStatusDialog();
void toggleDockWidgetWindowTitle();
};
#endif // MAINWINDOW_H