mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2024-12-27 00:11:33 +08:00
Fixed FloatingDockContainer.cpp to properly post the dragging start event
This commit is contained in:
parent
7f58877a47
commit
f554df9e7a
@ -529,16 +529,6 @@ bool CAutoHideDockContainer::eventFilter(QObject* watched, QEvent* event)
|
|||||||
// should get collapsed
|
// should get collapsed
|
||||||
collapseView(true);
|
collapseView(true);
|
||||||
}
|
}
|
||||||
else if (event->type() == QEvent::NonClientAreaMouseButtonPress)
|
|
||||||
{
|
|
||||||
// If the user starts dragging a floating widget, then we collapse
|
|
||||||
// the auto hide widget
|
|
||||||
CFloatingDockContainer* FloatingWidget = qobject_cast<CFloatingDockContainer*>(watched);
|
|
||||||
if (FloatingWidget)
|
|
||||||
{
|
|
||||||
collapseView(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (event->type() == internal::FloatingWidgetDragStartEvent)
|
else if (event->type() == internal::FloatingWidgetDragStartEvent)
|
||||||
{
|
{
|
||||||
collapseView(true);
|
collapseView(true);
|
||||||
|
@ -404,13 +404,20 @@ struct FloatingDockContainerPrivate
|
|||||||
return StateId == DraggingState;
|
return StateId == DraggingState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the dragging state and posts a FloatingWidgetDragStartEvent
|
||||||
|
* if dragging starts
|
||||||
|
*/
|
||||||
void setState(eDragState StateId)
|
void setState(eDragState StateId)
|
||||||
{
|
{
|
||||||
auto OldState = DraggingState;
|
if (DraggingState == StateId)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
DraggingState = StateId;
|
DraggingState = StateId;
|
||||||
if (DraggingInactive == OldState && DraggingFloatingWidget == DraggingState)
|
if (DraggingFloatingWidget == DraggingState)
|
||||||
{
|
{
|
||||||
qDebug() << "Start dragging floating widget " << internal::FloatingWidgetDragStartEvent;
|
|
||||||
qApp->postEvent(DockManager, new QEvent((QEvent::Type)internal::FloatingWidgetDragStartEvent));
|
qApp->postEvent(DockManager, new QEvent((QEvent::Type)internal::FloatingWidgetDragStartEvent));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -50,10 +50,10 @@ namespace ads
|
|||||||
|
|
||||||
namespace internal
|
namespace internal
|
||||||
{
|
{
|
||||||
|
const int FloatingWidgetDragStartEvent = QEvent::registerEventType();
|
||||||
#ifdef Q_OS_LINUX
|
#ifdef Q_OS_LINUX
|
||||||
static QString _window_manager;
|
static QString _window_manager;
|
||||||
static QHash<QString, xcb_atom_t> _xcb_atom_cache;
|
static QHash<QString, xcb_atom_t> _xcb_atom_cache;
|
||||||
const int FloatingWidgetDragStartEvent = QEvent::registerEventType();
|
|
||||||
|
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
Loading…
Reference in New Issue
Block a user