mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2024-12-25 15:41:34 +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);
|
||||
if (!FocusWidget)
|
||||
{
|
||||
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)
|
||||
{
|
||||
return;
|
||||
|
@ -285,6 +285,7 @@ CDockWidgetTab::CDockWidgetTab(CDockWidget* DockWidget, QWidget *parent) :
|
||||
setAttribute(Qt::WA_NoMousePropagation, true);
|
||||
d->DockWidget = DockWidget;
|
||||
d->createLayout();
|
||||
setFocusPolicy(Qt::ClickFocus);
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
|
Loading…
Reference in New Issue
Block a user