mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2024-12-26 08:01:32 +08:00
Changes to work around new QT issues in non client area code that comes with the new Qt version 5.12.2
This commit is contained in:
parent
49a7682e74
commit
9b56ca08e1
@ -320,7 +320,10 @@ void CFloatingDockContainer::closeEvent(QCloseEvent *event)
|
|||||||
// https://bugreports.qt.io/browse/QTBUG-73295
|
// https://bugreports.qt.io/browse/QTBUG-73295
|
||||||
// The following code is a workaround for Qt versions > 5.9.2 that seems
|
// The following code is a workaround for Qt versions > 5.9.2 that seems
|
||||||
// to work
|
// to work
|
||||||
#if (QT_VERSION > 0x050902)
|
// Starting from Qt version 5.12.2 this seems to work again. But
|
||||||
|
// now the QEvent::NonClientAreaMouseButtonPress function returns always
|
||||||
|
// Qt::RightButton even if the left button was pressed
|
||||||
|
#if (QT_VERSION > QT_VERSION_CHECK(5, 9, 2) && QT_VERSION < QT_VERSION_CHECK(5, 12, 2))
|
||||||
event->ignore();
|
event->ignore();
|
||||||
this->hide();
|
this->hide();
|
||||||
#else
|
#else
|
||||||
@ -352,13 +355,6 @@ void CFloatingDockContainer::hideEvent(QHideEvent *event)
|
|||||||
void CFloatingDockContainer::showEvent(QShowEvent *event)
|
void CFloatingDockContainer::showEvent(QShowEvent *event)
|
||||||
{
|
{
|
||||||
Super::showEvent(event);
|
Super::showEvent(event);
|
||||||
/*for (auto DockArea : d->DockContainer->openedDockAreas())
|
|
||||||
{
|
|
||||||
for (auto DockWidget : DockArea->openedDockWidgets())
|
|
||||||
{
|
|
||||||
DockWidget->setToggleViewActionChecked(true);
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -368,11 +364,28 @@ bool CFloatingDockContainer::event(QEvent *e)
|
|||||||
switch (d->DraggingState)
|
switch (d->DraggingState)
|
||||||
{
|
{
|
||||||
case DraggingInactive:
|
case DraggingInactive:
|
||||||
if (e->type() == QEvent::NonClientAreaMouseButtonPress && QGuiApplication::mouseButtons() == Qt::LeftButton)
|
{
|
||||||
|
// Normally we would check here, if the left mouse button is pressed.
|
||||||
|
// But from QT version 5.12.2 on the mouse events from
|
||||||
|
// QEvent::NonClientAreaMouseButtonPress return the wrong mouse button
|
||||||
|
// The event always returns Qt::RightButton even if the left button
|
||||||
|
// is clicked.
|
||||||
|
// It is really great to work around the whole NonClientMouseArea
|
||||||
|
// bugs
|
||||||
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 2))
|
||||||
|
if (e->type() == QEvent::NonClientAreaMouseButtonPress /*&& QGuiApplication::mouseButtons().testFlag(Qt::LeftButton)*/)
|
||||||
{
|
{
|
||||||
qDebug() << "FloatingWidget::event Event::NonClientAreaMouseButtonPress" << e->type();
|
qDebug() << "FloatingWidget::event Event::NonClientAreaMouseButtonPress" << e->type();
|
||||||
d->setState(DraggingMousePressed);
|
d->setState(DraggingMousePressed);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
if (e->type() == QEvent::NonClientAreaMouseButtonPress && QGuiApplication::mouseButtons().testFlag(Qt::LeftButton))
|
||||||
|
{
|
||||||
|
qDebug() << "FloatingWidget::event Event::NonClientAreaMouseButtonPress" << e->type();
|
||||||
|
d->setState(DraggingMousePressed);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DraggingMousePressed:
|
case DraggingMousePressed:
|
||||||
|
Loading…
Reference in New Issue
Block a user