mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2024-12-25 07:31:33 +08:00
fix(issue-350): on RedHat/CentOS, sometimes there will be one more move event after user release their mouse which will cause the floating overlay can not be hide. Here we use the WindowActivate and WindowDeactivate event to check whether user release their mouse. (#401)
This commit is contained in:
parent
6a1ea6c7de
commit
ad06241c9d
@ -1239,12 +1239,12 @@ void CFloatingDockContainer::resizeEvent(QResizeEvent *event)
|
|||||||
Super::resizeEvent(event);
|
Super::resizeEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool s_mousePressed = false;
|
||||||
//============================================================================
|
//============================================================================
|
||||||
void CFloatingDockContainer::moveEvent(QMoveEvent *event)
|
void CFloatingDockContainer::moveEvent(QMoveEvent *event)
|
||||||
{
|
{
|
||||||
Super::moveEvent(event);
|
Super::moveEvent(event);
|
||||||
if (!d->IsResizing && event->spontaneous())
|
if (!d->IsResizing && event->spontaneous() && s_mousePressed)
|
||||||
{
|
{
|
||||||
d->DraggingState = DraggingFloatingWidget;
|
d->DraggingState = DraggingFloatingWidget;
|
||||||
d->updateDropOverlays(QCursor::pos());
|
d->updateDropOverlays(QCursor::pos());
|
||||||
@ -1252,6 +1252,23 @@ void CFloatingDockContainer::moveEvent(QMoveEvent *event)
|
|||||||
d->IsResizing = false;
|
d->IsResizing = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
bool CFloatingDockContainer::event(QEvent *e)
|
||||||
|
{
|
||||||
|
bool result = Super::event(e);
|
||||||
|
switch (e->type())
|
||||||
|
{
|
||||||
|
case QEvent::WindowActivate:
|
||||||
|
s_mousePressed = false;
|
||||||
|
break;
|
||||||
|
case QEvent::WindowDeactivate:
|
||||||
|
s_mousePressed = true;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
bool CFloatingDockContainer::hasNativeTitleBar()
|
bool CFloatingDockContainer::hasNativeTitleBar()
|
||||||
|
@ -188,6 +188,7 @@ protected: // reimplements QWidget
|
|||||||
#ifdef Q_OS_LINUX
|
#ifdef Q_OS_LINUX
|
||||||
virtual void moveEvent(QMoveEvent *event) override;
|
virtual void moveEvent(QMoveEvent *event) override;
|
||||||
virtual void resizeEvent(QResizeEvent *event) override;
|
virtual void resizeEvent(QResizeEvent *event) override;
|
||||||
|
virtual bool event(QEvent *e) override;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
|
Loading…
Reference in New Issue
Block a user