Merge remote-tracking branch 'origin/focused_dockwidget' into focused_dockwidget

This commit is contained in:
Uwe Kindler 2020-05-22 19:26:54 +02:00
commit 333d2920db
2 changed files with 20 additions and 3 deletions

View File

@ -1459,6 +1459,8 @@ void CDockContainerWidget::dropFloatingWidget(CFloatingDockContainer* FloatingWi
// level widget anymore // level widget anymore
CDockWidget::emitTopLevelEventForWidget(SingleDockWidget, false); CDockWidget::emitTopLevelEventForWidget(SingleDockWidget, false);
} }
window()->activateWindow();
} }
@ -1490,7 +1492,7 @@ void CDockContainerWidget::dropWidget(QWidget* Widget, DockWidgetArea DropArea,
} }
} }
this->window()->activateWindow(); window()->activateWindow();
d->DockManager->emitWidgetDroppedSignals(Widget); d->DockManager->emitWidgetDroppedSignals(Widget);
} }

View File

@ -458,6 +458,7 @@ void updateDockAreaFocusStyle(CDockAreaWidget* DockArea, bool Focused)
//=========================================================================== //===========================================================================
void updateFloatingWidgetFocusStyle(CFloatingDockContainer* FloatingWidget, bool Focused) void updateFloatingWidgetFocusStyle(CFloatingDockContainer* FloatingWidget, bool Focused)
{ {
#ifdef Q_OS_LINUX
auto TitleBar = qobject_cast<CFloatingWidgetTitleBar*>(FloatingWidget->titleBarWidget()); auto TitleBar = qobject_cast<CFloatingWidgetTitleBar*>(FloatingWidget->titleBarWidget());
if (!TitleBar) if (!TitleBar)
{ {
@ -465,6 +466,10 @@ void updateFloatingWidgetFocusStyle(CFloatingDockContainer* FloatingWidget, bool
} }
TitleBar->setProperty("focused", Focused); TitleBar->setProperty("focused", Focused);
TitleBar->updateStyle(); TitleBar->updateStyle();
#else
Q_UNUSED(FloatingWidget)
Q_UNUSED(Focused)
#endif
} }
@ -495,7 +500,9 @@ void DockManagerPrivate::updateDockWidgetFocus(CDockWidget* DockWidget)
updateDockAreaFocusStyle(FocusedArea, true); updateDockAreaFocusStyle(FocusedArea, true);
QObject::connect(FocusedArea, SIGNAL(viewToggled(bool)), _this, SLOT(onFocusedDockAreaViewToggled(bool))); QObject::connect(FocusedArea, SIGNAL(viewToggled(bool)), _this, SLOT(onFocusedDockAreaViewToggled(bool)));
// Linux specific focus stuff #ifdef Q_OS_LINUX
// This code is required for styling the floating widget titlebar for linux
// depending on the current focus state
auto NewFloatingWidget = FocusedDockWidget->dockContainer()->floatingWidget(); auto NewFloatingWidget = FocusedDockWidget->dockContainer()->floatingWidget();
if (FloatingWidget == NewFloatingWidget) if (FloatingWidget == NewFloatingWidget)
{ {
@ -512,6 +519,7 @@ void DockManagerPrivate::updateDockWidgetFocus(CDockWidget* DockWidget)
{ {
updateFloatingWidgetFocusStyle(FloatingWidget, true); updateFloatingWidgetFocusStyle(FloatingWidget, true);
} }
#endif
} }
@ -990,10 +998,17 @@ void CDockManager::onFocusChanged(QWidget* focusedOld, QWidget* focusedNow)
DockWidget = internal::findParent<CDockWidget*>(focusedNow); DockWidget = internal::findParent<CDockWidget*>(focusedNow);
} }
if (!DockWidget /*|| !DockWidget->tabWidget()->isVisible()*/) #ifdef Q_OS_LINUX
if (!DockWidget)
{ {
return; return;
} }
#else
if (!DockWidget || !DockWidget->tabWidget()->isVisible())
{
return;
}
#endif
std::cout << "CDockManager::onFocusChanged " << DockWidget->tabWidget()->text().toStdString() << std::endl; std::cout << "CDockManager::onFocusChanged " << DockWidget->tabWidget()->text().toStdString() << std::endl;
d->updateDockWidgetFocus(DockWidget); d->updateDockWidgetFocus(DockWidget);