mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2025-01-13 16:42:06 +08:00
Improved setting of CDockWidgetTab focus
This commit is contained in:
parent
835a20f03f
commit
f54869fbf7
@ -879,14 +879,29 @@ CIconProvider& CDockManager::iconProvider()
|
|||||||
|
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
void CDockManager::onFocusObjectChanged(QObject *focusObject)
|
void CDockManager::onFocusObjectChanged(QObject *focusObject)
|
||||||
{
|
{
|
||||||
auto FocusWidget = qobject_cast<QWidget*>(focusObject);
|
auto FocusWidget = qobject_cast<QWidget*>(focusObject);
|
||||||
if (!FocusWidget)
|
if (!FocusWidget)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto DockWidget = internal::findParent<CDockWidget*>(FocusWidget);
|
|
||||||
|
CDockWidget* DockWidget = nullptr;
|
||||||
|
|
||||||
|
std::cout << "CDockManager::onFocusObjectChanged " << focusObject->objectName().toStdString()
|
||||||
|
<< " meta: " << focusObject->metaObject()->className() << std::endl;
|
||||||
|
|
||||||
|
auto DockWidgetTab = qobject_cast<CDockWidgetTab*>(focusObject);
|
||||||
|
if (DockWidgetTab)
|
||||||
|
{
|
||||||
|
DockWidget = DockWidgetTab->dockWidget();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DockWidget = internal::findParent<CDockWidget*>(FocusWidget);
|
||||||
|
}
|
||||||
|
|
||||||
if (!DockWidget)
|
if (!DockWidget)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
@ -285,6 +285,7 @@ CDockWidgetTab::CDockWidgetTab(CDockWidget* DockWidget, QWidget *parent) :
|
|||||||
setAttribute(Qt::WA_NoMousePropagation, true);
|
setAttribute(Qt::WA_NoMousePropagation, true);
|
||||||
d->DockWidget = DockWidget;
|
d->DockWidget = DockWidget;
|
||||||
d->createLayout();
|
d->createLayout();
|
||||||
|
setFocusPolicy(Qt::ClickFocus);
|
||||||
}
|
}
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
Loading…
Reference in New Issue
Block a user