mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2024-12-24 23:31:32 +08:00
Fixed #527 - updateDockWidgetFocusStyle() function error
This commit is contained in:
parent
36cdf4a252
commit
34cc91a9af
@ -49,6 +49,7 @@ struct DockFocusControllerPrivate
|
||||
#endif
|
||||
CDockManager* DockManager;
|
||||
bool ForceFocusChangedSignal = false;
|
||||
bool TabPressed = false;
|
||||
|
||||
/**
|
||||
* Private data constructor
|
||||
@ -267,7 +268,9 @@ void CDockFocusController::onApplicationFocusChanged(QWidget* focusedOld, QWidge
|
||||
{
|
||||
Q_UNUSED(focusedOld);
|
||||
|
||||
if (d->DockManager->isRestoringState())
|
||||
// Ignore focus changes if we are restoring state, or if user clicked
|
||||
// a tab wich in turn caused the focus change
|
||||
if (d->DockManager->isRestoringState() || d->TabPressed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -418,6 +421,12 @@ CDockWidget* CDockFocusController::focusedDockWidget() const
|
||||
return d->FocusedDockWidget.data();
|
||||
}
|
||||
|
||||
|
||||
//==========================================================================
|
||||
void CDockFocusController::setDockWidgetTabPressed(bool Value)
|
||||
{
|
||||
d->TabPressed = Value;
|
||||
}
|
||||
} // namespace ads
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -80,6 +80,12 @@ public:
|
||||
*/
|
||||
void clearDockWidgetFocus(CDockWidget* dockWidget);
|
||||
|
||||
/**
|
||||
* Notifies the dock focus controller, that a the mouse is pressed or
|
||||
* released
|
||||
*/
|
||||
void setDockWidgetTabPressed(bool Value);
|
||||
|
||||
public Q_SLOTS:
|
||||
/**
|
||||
* Request a focus change to the given dock widget
|
||||
|
@ -79,6 +79,7 @@ struct DockWidgetTabPrivate
|
||||
QSpacerItem* IconTextSpacer;
|
||||
QPoint TabDragStartPosition;
|
||||
QSize IconSize;
|
||||
bool MousePressed = false;
|
||||
|
||||
/**
|
||||
* Private data constructor
|
||||
@ -372,10 +373,12 @@ void CDockWidgetTab::mousePressEvent(QMouseEvent* ev)
|
||||
if (ev->button() == Qt::LeftButton)
|
||||
{
|
||||
ev->accept();
|
||||
d->MousePressed = true;
|
||||
d->saveDragStartMousePosition(internal::globalPositionOf(ev));
|
||||
d->DragState = DraggingMousePressed;
|
||||
if (CDockManager::testConfigFlag(CDockManager::FocusHighlighting))
|
||||
{
|
||||
d->focusController()->setDockWidgetTabPressed(true);
|
||||
d->focusController()->setDockWidgetTabFocused(this);
|
||||
}
|
||||
Q_EMIT clicked();
|
||||
@ -391,6 +394,7 @@ void CDockWidgetTab::mouseReleaseEvent(QMouseEvent* ev)
|
||||
{
|
||||
if (ev->button() == Qt::LeftButton)
|
||||
{
|
||||
d->MousePressed = false;
|
||||
auto CurrentDragState = d->DragState;
|
||||
d->GlobalDragStartMousePosition = QPoint();
|
||||
d->DragStartMousePosition = QPoint();
|
||||
@ -412,7 +416,9 @@ void CDockWidgetTab::mouseReleaseEvent(QMouseEvent* ev)
|
||||
d->FloatingWidget->finishDragging();
|
||||
break;
|
||||
|
||||
default:; // do nothing
|
||||
default:
|
||||
d->focusController()->setDockWidgetTabPressed(false);
|
||||
break; // do nothing
|
||||
}
|
||||
}
|
||||
else if (ev->button() == Qt::MiddleButton)
|
||||
@ -802,6 +808,7 @@ void CDockWidgetTab::setIconSize(const QSize& Size)
|
||||
d->IconSize = Size;
|
||||
d->updateIcon();
|
||||
}
|
||||
|
||||
} // namespace ads
|
||||
//---------------------------------------------------------------------------
|
||||
// EOF DockWidgetTab.cpp
|
||||
|
@ -178,6 +178,12 @@ public:
|
||||
*/
|
||||
void setIconSize(const QSize& Size);
|
||||
|
||||
/**
|
||||
* Returns true, if the tab has been clicked and the mouse is currently
|
||||
* pressed.
|
||||
*/
|
||||
bool mousePressed() const;
|
||||
|
||||
public Q_SLOTS:
|
||||
virtual void setVisible(bool visible) override;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user