@@ -320,7 +320,10 @@ void CFloatingDockContainer::closeEvent(QCloseEvent *event)
320
320
// https://bugreports.qt.io/browse/QTBUG-73295
321
321
// The following code is a workaround for Qt versions > 5.9.2 that seems
322
322
// to work
323
- #if (QT_VERSION > 0x050902)
323
+ // Starting from Qt version 5.12.2 this seems to work again. But
324
+ // now the QEvent::NonClientAreaMouseButtonPress function returns always
325
+ // Qt::RightButton even if the left button was pressed
326
+ #if (QT_VERSION > QT_VERSION_CHECK(5, 9, 2) && QT_VERSION < QT_VERSION_CHECK(5, 12, 2))
324
327
event->ignore ();
325
328
this ->hide ();
326
329
#else
@@ -352,13 +355,6 @@ void CFloatingDockContainer::hideEvent(QHideEvent *event)
352
355
void CFloatingDockContainer::showEvent (QShowEvent *event)
353
356
{
354
357
Super::showEvent (event);
355
- /* for (auto DockArea : d->DockContainer->openedDockAreas())
356
- {
357
- for (auto DockWidget : DockArea->openedDockWidgets())
358
- {
359
- DockWidget->setToggleViewActionChecked(true);
360
- }
361
- }*/
362
358
}
363
359
364
360
@@ -368,11 +364,28 @@ bool CFloatingDockContainer::event(QEvent *e)
368
364
switch (d->DraggingState )
369
365
{
370
366
case DraggingInactive:
371
- if (e->type () == QEvent::NonClientAreaMouseButtonPress && QGuiApplication::mouseButtons () == Qt::LeftButton)
367
+ {
368
+ // Normally we would check here, if the left mouse button is pressed.
369
+ // But from QT version 5.12.2 on the mouse events from
370
+ // QEvent::NonClientAreaMouseButtonPress return the wrong mouse button
371
+ // The event always returns Qt::RightButton even if the left button
372
+ // is clicked.
373
+ // It is really great to work around the whole NonClientMouseArea
374
+ // bugs
375
+ #if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 2))
376
+ if (e->type () == QEvent::NonClientAreaMouseButtonPress /* && QGuiApplication::mouseButtons().testFlag(Qt::LeftButton)*/ )
377
+ {
378
+ qDebug () << " FloatingWidget::event Event::NonClientAreaMouseButtonPress" << e->type ();
379
+ d->setState (DraggingMousePressed);
380
+ }
381
+ #else
382
+ if (e->type () == QEvent::NonClientAreaMouseButtonPress && QGuiApplication::mouseButtons ().testFlag (Qt::LeftButton))
372
383
{
373
384
qDebug () << " FloatingWidget::event Event::NonClientAreaMouseButtonPress" << e->type ();
374
385
d->setState (DraggingMousePressed);
375
386
}
387
+ #endif
388
+ }
376
389
break ;
377
390
378
391
case DraggingMousePressed:
0 commit comments