mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2025-01-24 13:32:06 +08:00
Improved focus handling when dropping a dock widget
This commit is contained in:
parent
c5333a2414
commit
e760d3e967
@ -413,6 +413,7 @@ void CDockAreaWidget::insertDockWidget(int index, CDockWidget* DockWidget,
|
|||||||
bool Activate)
|
bool Activate)
|
||||||
{
|
{
|
||||||
d->ContentsLayout->insertWidget(index, DockWidget);
|
d->ContentsLayout->insertWidget(index, DockWidget);
|
||||||
|
DockWidget->setDockArea(this);
|
||||||
DockWidget->tabWidget()->setDockAreaWidget(this);
|
DockWidget->tabWidget()->setDockAreaWidget(this);
|
||||||
auto TabWidget = DockWidget->tabWidget();
|
auto TabWidget = DockWidget->tabWidget();
|
||||||
// Inserting the tab will change the current index which in turn will
|
// Inserting the tab will change the current index which in turn will
|
||||||
@ -428,7 +429,6 @@ void CDockAreaWidget::insertDockWidget(int index, CDockWidget* DockWidget,
|
|||||||
{
|
{
|
||||||
setCurrentIndex(index);
|
setCurrentIndex(index);
|
||||||
}
|
}
|
||||||
DockWidget->setDockArea(this);
|
|
||||||
d->updateTitleBarButtonStates();
|
d->updateTitleBarButtonStates();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -463,15 +463,21 @@ void CDockWidgetTab::setActiveTab(bool active)
|
|||||||
bool AllTabsHaveCloseButton = d->testConfigFlag(CDockManager::AllTabsHaveCloseButton);
|
bool AllTabsHaveCloseButton = d->testConfigFlag(CDockManager::AllTabsHaveCloseButton);
|
||||||
bool TabHasCloseButton = (ActiveTabHasCloseButton && active) | AllTabsHaveCloseButton;
|
bool TabHasCloseButton = (ActiveTabHasCloseButton && active) | AllTabsHaveCloseButton;
|
||||||
d->CloseButton->setVisible(DockWidgetClosable && TabHasCloseButton);
|
d->CloseButton->setVisible(DockWidgetClosable && TabHasCloseButton);
|
||||||
if (d->IsActiveTab == active)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
bool UpdateFocusStyle = false;
|
||||||
if (active && !hasFocus())
|
if (active && !hasFocus())
|
||||||
{
|
{
|
||||||
std::cout << "setFocus(Qt::OtherFocusReason);" << std::endl;
|
|
||||||
setFocus(Qt::OtherFocusReason);
|
setFocus(Qt::OtherFocusReason);
|
||||||
|
UpdateFocusStyle = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (d->IsActiveTab == active)
|
||||||
|
{
|
||||||
|
if (UpdateFocusStyle)
|
||||||
|
{
|
||||||
|
updateStyle();
|
||||||
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
d->IsActiveTab = active;
|
d->IsActiveTab = active;
|
||||||
updateStyle();
|
updateStyle();
|
||||||
|
Loading…
Reference in New Issue
Block a user