Added test for resizing of DockAera

This commit is contained in:
Uwe Kindler 2021-08-03 14:59:28 +02:00
parent 401e8cf492
commit bbdf0ef29d

View File

@ -79,7 +79,7 @@
#include "FloatingDockContainer.h"
#include "DockComponentsFactory.h"
#include "StatusDialog.h"
#include "DockSplitter.h"
/**
@ -417,6 +417,22 @@ void MainWindowPrivate::createContent()
DockWidget = createCalendarDockWidget();
DockWidget->setTabToolTip(QString("Tab ToolTip\nHodie est dies magna"));
auto DockArea = DockManager->addDockWidget(ads::CenterDockWidgetArea, DockWidget, TopDockArea);
// Now we create a action to test resizing of DockArea widget
auto Action = ui.menuTests->addAction(QString("Resize %1").arg(DockWidget->windowTitle()));
QObject::connect(Action, &QAction::triggered, [DockArea]()
{
// Resizing only works, if the Splitter is visible and has a valid
// sizes
auto Splitter = ads::internal::findParent<ads::CDockSplitter*>(DockArea);
if (!Splitter)
{
return;
}
// We change the sizes of the splitter that contains the Calendar 1 widget
// to resize the dock widget
int Width = Splitter->width();
Splitter->setSizes({Width * 2/3, Width * 1/3});
});
// Now we add a custom button to the dock area title bar that will create
// new editor widgets when clicked
@ -443,13 +459,14 @@ void MainWindowPrivate::createContent()
DockManager->addDockWidget(ads::CenterDockWidgetArea, createLongTextLabelDockWidget(), RighDockArea);
DockManager->addDockWidget(ads::CenterDockWidgetArea, createLongTextLabelDockWidget(), BottomDockArea);
auto Action = ui.menuTests->addAction(QString("Set %1 Floating").arg(DockWidget->windowTitle()));
Action = ui.menuTests->addAction(QString("Set %1 Floating").arg(DockWidget->windowTitle()));
DockWidget->connect(Action, SIGNAL(triggered()), SLOT(setFloating()));
Action = ui.menuTests->addAction(QString("Set %1 As Current Tab").arg(DockWidget->windowTitle()));
DockWidget->connect(Action, SIGNAL(triggered()), SLOT(setAsCurrentTab()));
Action = ui.menuTests->addAction(QString("Raise %1").arg(DockWidget->windowTitle()));
DockWidget->connect(Action, SIGNAL(triggered()), SLOT(raise()));
#ifdef Q_OS_WIN
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
if (!ads::CDockManager::testConfigFlag(ads::CDockManager::OpaqueUndocking))