17 #include <QApplication>
18 #include <QAbstractButton>
44 QPointer<CFloatingDockContainer> FloatingWidget =
nullptr;
76 DockArea->setProperty(
"focused", Focused);
84 static void updateFloatingWidgetFocusStyle(CFloatingDockContainer* FloatingWidget,
bool Focused)
86 if (FloatingWidget->hasNativeTitleBar())
90 auto TitleBar = qobject_cast<CFloatingWidgetTitleBar*>(FloatingWidget->titleBarWidget());
95 TitleBar->setProperty(
"focused", Focused);
96 TitleBar->updateStyle();
128 if (NewFocusedDockArea && (
FocusedArea != NewFocusedDockArea))
132 QObject::disconnect(
FocusedArea, SIGNAL(viewToggled(
bool)),
_this, SLOT(onFocusedDockAreaViewToggled(
bool)));
138 QObject::connect(
FocusedArea, SIGNAL(viewToggled(
bool)),
_this, SLOT(onFocusedDockAreaViewToggled(
bool)));
143 if (NewFloatingWidget)
145 NewFloatingWidget->setProperty(
"FocusedDockWidget", QVariant::fromValue(
DockWidget));
152 if (FloatingWidget == NewFloatingWidget)
159 updateFloatingWidgetFocusStyle(FloatingWidget,
false);
161 FloatingWidget = NewFloatingWidget;
165 updateFloatingWidgetFocusStyle(FloatingWidget,
true);
182 QObject::connect(
DockWidget, SIGNAL(visibilityChanged(
bool)),
_this, SLOT(onDockWidgetVisibilityChanged(
bool)));
191 auto Sender = sender();
192 auto DockWidget = qobject_cast<ads::CDockWidget*>(Sender);
207 connect(QApplication::instance(), SIGNAL(focusChanged(QWidget*, QWidget*)),
227 ADS_PRINT(
"CDockFocusController::onApplicationFocusChanged "
228 <<
" old: " << focusedOld <<
" new: " << focusedNow);
240 auto OtherDockWidgetTab = internal::findParent<CDockWidgetTab*>(focusedNow);
241 if (OtherDockWidgetTab && focusedOld)
243 auto OldFocusedDockWidget = internal::findParent<CDockWidget*>(focusedOld);
244 if (OldFocusedDockWidget)
246 focusedOld->setFocus();
253 auto DockWidgetTab = qobject_cast<CDockWidgetTab*>(focusedNow);
262 auto OldFocusedDockWidget = internal::findParent<CDockWidget*>(focusedOld);
263 if (OldFocusedDockWidget && OldFocusedDockWidget ==
DockWidget)
265 focusedOld->setFocus();
272 DockWidget = qobject_cast<CDockWidget*>(focusedNow);
277 DockWidget = internal::findParent<CDockWidget*>(focusedNow);
312 if (!DockArea || Open)
318 if (OpenedDockAreas.isEmpty())
338 CDockAreaWidget* DockArea = qobject_cast<CDockAreaWidget*>(DroppedWidget);
363 auto vDockWidget = FloatingWidget->property(
"FocusedDockWidget");
364 if (!vDockWidget.isValid())