17 #include <QApplication> 18 #include <QAbstractButton> 44 QPointer<CFloatingDockContainer> FloatingWidget =
nullptr;
66 DockWidget->setProperty(
"focused", Focused);
67 DockWidget->
tabWidget()->setProperty(
"focused", Focused);
76 DockArea->setProperty(
"focused", Focused);
86 if (FloatingWidget->hasNativeTitleBar())
95 TitleBar->setProperty(
"focused", Focused);
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);
175 if (DockWidget->isVisible())
182 QObject::connect(DockWidget, SIGNAL(visibilityChanged(
bool)),
_this, SLOT(onDockWidgetVisibilityChanged(
bool)));
191 auto Sender = sender();
193 disconnect(Sender, SIGNAL(visibilityChanged(
bool)),
this, SLOT(onDockWidgetVisibilityChanged(
bool)));
196 emit
d->DockManager->focusedDockWidgetChanged(
d->OldFocusedDockWidget,
DockWidget);
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();
256 DockWidget = DockWidgetTab->dockWidget();
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);
286 if (!DockWidget || DockWidget->
tabWidget()->isHidden())
312 if (!DockArea || Open)
318 if (OpenedDockAreas.isEmpty())
363 auto vDockWidget = FloatingWidget->property(
"FocusedDockWidget");
364 if (!vDockWidget.isValid())
static bool testConfigFlag(eConfigFlag Flag)
bool isRestoringState() const
void updateDockWidgetFocus(CDockWidget *DockWidget)
Declaration of CDockFocusController class.
void onFocusedDockAreaViewToggled(bool Open)
Declaration of CFloatingDockContainer class.
void notifyFloatingWidgetDrop(CFloatingDockContainer *FloatingWidget)
void repolishStyle(QWidget *w, eRepolishChildOptions Options=RepolishIgnoreChildren)
static void updateDockWidgetFocusStyle(CDockWidget *DockWidget, bool Focused)
If enabled the tab close buttons will be QToolButtons instead of QPushButtons - disabled by default...
static void setWidgetFocus(QWidgetPtr widget)
void setDockWidgetFocused(CDockWidget *focusedNow)
bool ForceFocusChangedSignal
CDockWidget * OldFocusedDockWidget
CDockWidget * focusedDockWidget() const
CDockFocusController(CDockManager *DockManager)
QPointer< CDockAreaWidget > FocusedArea
DockFocusControllerPrivate * d
private data (pimpl)
void onApplicationFocusChanged(QWidget *old, QWidget *now)
CDockManager * DockManager
static void updateDockAreaFocusStyle(CDockAreaWidget *DockArea, bool Focused)
QPointer< CDockWidget > FocusedDockWidget
CDockFocusController * _this
Declaration of CDockManager class.
void focusedDockWidgetChanged(ads::CDockWidget *old, ads::CDockWidget *now)
Declaration of CDockAreaTitleBar class.
void onDockWidgetVisibilityChanged(bool Visible)
virtual ~CDockFocusController()
void notifyWidgetOrAreaRelocation(QWidget *RelocatedWidget)
DockFocusControllerPrivate(CDockFocusController *_public)