forked from qt-creator/qt-creator
QmlDesigner: hotfix for Qt 5.3.2 to ungrab the mouse
At the moment the QML world does not get the release event if a drag started in QML and ends up on QWidget world. Hotfix: 3.2 Task-number: QTCREATORBUG-12510 Change-Id: I4f4c023e177221af61ba9e754f27a5087013fb08 Reviewed-by: Marco Bubke <marco.bubke@digia.com>
This commit is contained in:
@@ -55,6 +55,10 @@
|
|||||||
#include <QShortcut>
|
#include <QShortcut>
|
||||||
#include <QQuickItem>
|
#include <QQuickItem>
|
||||||
|
|
||||||
|
#include <private/qquickwidget_p.h> // mouse ungrabbing workaround on quickitems
|
||||||
|
#include <private/qquickwindow_p.h> // mouse ungrabbing workaround on quickitems
|
||||||
|
|
||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
ItemLibraryWidget::ItemLibraryWidget(QWidget *parent) :
|
ItemLibraryWidget::ItemLibraryWidget(QWidget *parent) :
|
||||||
@@ -369,6 +373,13 @@ void ItemLibraryWidget::setResourcePath(const QString &resourcePath)
|
|||||||
updateSearch();
|
updateSearch();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void ungrabMouseOnQMLWorldWorkAround(QQuickWidget *quickWidget)
|
||||||
|
{
|
||||||
|
const QQuickWidgetPrivate *widgetPrivate = QQuickWidgetPrivate::get(quickWidget);
|
||||||
|
if (widgetPrivate && widgetPrivate->offscreenWindow && widgetPrivate->offscreenWindow->mouseGrabberItem())
|
||||||
|
widgetPrivate->offscreenWindow->mouseGrabberItem()->ungrabMouse();
|
||||||
|
}
|
||||||
|
|
||||||
void ItemLibraryWidget::startDragAndDrop(QVariant itemLibraryId)
|
void ItemLibraryWidget::startDragAndDrop(QVariant itemLibraryId)
|
||||||
{
|
{
|
||||||
m_currentitemLibraryEntry = itemLibraryId.value<ItemLibraryEntry>();
|
m_currentitemLibraryEntry = itemLibraryId.value<ItemLibraryEntry>();
|
||||||
@@ -380,6 +391,8 @@ void ItemLibraryWidget::startDragAndDrop(QVariant itemLibraryId)
|
|||||||
drag->setMimeData(mimeData);
|
drag->setMimeData(mimeData);
|
||||||
|
|
||||||
drag->exec();
|
drag->exec();
|
||||||
|
|
||||||
|
ungrabMouseOnQMLWorldWorkAround(m_itemViewQuickWidget.data());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ItemLibraryWidget::removeImport(const QString &name)
|
void ItemLibraryWidget::removeImport(const QString &name)
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
QT += quickwidgets
|
QT += quickwidgets
|
||||||
|
QT += widgets-private quick-private quickwidgets-private core-private gui-private #mouse ungrabbing workaround on quickitems
|
||||||
CONFIG += exceptions
|
CONFIG += exceptions
|
||||||
|
|
||||||
INCLUDEPATH += $$PWD
|
INCLUDEPATH += $$PWD
|
||||||
|
Reference in New Issue
Block a user