forked from qt-creator/qt-creator
QmlDesigner: Focus the content widget of the dock when focusing tab
When DockWidgetTab or DockWidget is focused, typically user actually wants to focus the content widget, so we now do that. Focusing content widget is done asynchronously to avoid complications from doing another setFocus in middle of setFocus handling. Fixes: QDS-9104 Change-Id: I569639c2f36f0721aafcdcab3498c875e98993a9 Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io> Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -162,6 +162,8 @@ namespace ADS
|
||||
if (!dockWidget)
|
||||
dockWidget = qobject_cast<DockWidget *>(focusedNow);
|
||||
|
||||
bool focusActual = dockWidget && dockWidget->widget();
|
||||
|
||||
if (!dockWidget)
|
||||
dockWidget = internal::findParent<DockWidget *>(focusedNow);
|
||||
|
||||
@@ -174,6 +176,12 @@ namespace ADS
|
||||
#endif
|
||||
|
||||
d->updateDockWidgetFocus(dockWidget);
|
||||
|
||||
if (focusActual) {
|
||||
// Do this async to avoid issues when changing focus in middle of another focus handling
|
||||
QMetaObject::invokeMethod(dockWidget->widget(), QOverload<>::of(&QWidget::setFocus),
|
||||
Qt::QueuedConnection);
|
||||
}
|
||||
}
|
||||
|
||||
void DockFocusController::setDockWidgetFocused(DockWidget *focusedNow)
|
||||
|
||||
Reference in New Issue
Block a user