7979#include " FloatingDockContainer.h"
8080#include " DockComponentsFactory.h"
8181#include " StatusDialog.h"
82-
82+ # include " DockSplitter.h "
8383
8484
8585/* *
@@ -417,6 +417,22 @@ void MainWindowPrivate::createContent()
417417 DockWidget = createCalendarDockWidget ();
418418 DockWidget->setTabToolTip (QString (" Tab ToolTip\n Hodie est dies magna" ));
419419 auto DockArea = DockManager->addDockWidget (ads::CenterDockWidgetArea, DockWidget, TopDockArea);
420+ // Now we create a action to test resizing of DockArea widget
421+ auto Action = ui.menuTests ->addAction (QString (" Resize %1" ).arg (DockWidget->windowTitle ()));
422+ QObject::connect (Action, &QAction::triggered, [DockArea]()
423+ {
424+ // Resizing only works, if the Splitter is visible and has a valid
425+ // sizes
426+ auto Splitter = ads::internal::findParent<ads::CDockSplitter*>(DockArea);
427+ if (!Splitter)
428+ {
429+ return ;
430+ }
431+ // We change the sizes of the splitter that contains the Calendar 1 widget
432+ // to resize the dock widget
433+ int Width = Splitter->width ();
434+ Splitter->setSizes ({Width * 2 /3 , Width * 1 /3 });
435+ });
420436
421437 // Now we add a custom button to the dock area title bar that will create
422438 // new editor widgets when clicked
@@ -443,13 +459,14 @@ void MainWindowPrivate::createContent()
443459 DockManager->addDockWidget (ads::CenterDockWidgetArea, createLongTextLabelDockWidget (), RighDockArea);
444460 DockManager->addDockWidget (ads::CenterDockWidgetArea, createLongTextLabelDockWidget (), BottomDockArea);
445461
446- auto Action = ui.menuTests ->addAction (QString (" Set %1 Floating" ).arg (DockWidget->windowTitle ()));
462+ Action = ui.menuTests ->addAction (QString (" Set %1 Floating" ).arg (DockWidget->windowTitle ()));
447463 DockWidget->connect (Action, SIGNAL (triggered ()), SLOT (setFloating ()));
448464 Action = ui.menuTests ->addAction (QString (" Set %1 As Current Tab" ).arg (DockWidget->windowTitle ()));
449465 DockWidget->connect (Action, SIGNAL (triggered ()), SLOT (setAsCurrentTab ()));
450466 Action = ui.menuTests ->addAction (QString (" Raise %1" ).arg (DockWidget->windowTitle ()));
451467 DockWidget->connect (Action, SIGNAL (triggered ()), SLOT (raise ()));
452468
469+
453470#ifdef Q_OS_WIN
454471#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
455472 if (!ads::CDockManager::testConfigFlag (ads::CDockManager::OpaqueUndocking))
@@ -613,6 +630,9 @@ CMainWindow::CMainWindow(QWidget *parent) :
613630 // uncomment if you would like to enable an equal distribution of the
614631 // available size of a splitter to all contained dock widgets
615632 // CDockManager::setConfigFlag(CDockManager::EqualSplitOnInsertion, true);
633+
634+ // uncomment if you would like to close tabs with the middle mouse button, web browser style
635+ // CDockManager::setConfigFlag(CDockManager::MiddleMouseButtonClosesTab, true);
616636
617637 // Now create the dock manager and its content
618638 d->DockManager = new CDockManager (this );
0 commit comments