Fixed FloatingDockContainer.cpp to properly post the dragging start event

This commit is contained in:
Uwe Kindler 2022-11-15 09:28:23 +01:00
parent 7f58877a47
commit f554df9e7a
3 changed files with 11 additions and 14 deletions

View File

@ -529,16 +529,6 @@ bool CAutoHideDockContainer::eventFilter(QObject* watched, QEvent* event)
// should get collapsed
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)
{
collapseView(true);

View File

@ -404,13 +404,20 @@ struct FloatingDockContainerPrivate
return StateId == DraggingState;
}
/**
* Sets the dragging state and posts a FloatingWidgetDragStartEvent
* if dragging starts
*/
void setState(eDragState StateId)
{
auto OldState = DraggingState;
if (DraggingState == StateId)
{
return;
}
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));
}
}

View File

@ -50,10 +50,10 @@ namespace ads
namespace internal
{
const int FloatingWidgetDragStartEvent = QEvent::registerEventType();
#ifdef Q_OS_LINUX
static QString _window_manager;
static QHash<QString, xcb_atom_t> _xcb_atom_cache;
const int FloatingWidgetDragStartEvent = QEvent::registerEventType();
//============================================================================