forked from qt-creator/qt-creator
QmlDesigner: Rework SpinBox dragging functionality
* Replace DragHandler with MouseArea due to the DragHandler not being able to accept MouseEvents * Replace TapHandler with MouseArea due to MouseArea stealing press signals from TapHandler, but needed to get press events due to removal of DragHandler * Add functionality to keep cursor in place while dragging * Keep ActionIndicator visible while dragging * Fix qsTr in RectangleSpecifics Change-Id: I6558623287e1864359128d4194c9db78736ee3a4 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
committed by
Thomas Hartmann
parent
fcb3fabd13
commit
15db0bb173
@@ -42,6 +42,7 @@
|
||||
#include <QFontDatabase>
|
||||
#include <QMessageBox>
|
||||
#include <QQmlContext>
|
||||
#include <QWindow>
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
|
||||
@@ -495,7 +496,9 @@ void PropertyEditorContextObject::hideCursor()
|
||||
return;
|
||||
|
||||
QApplication::setOverrideCursor(QCursor(Qt::BlankCursor));
|
||||
m_lastPos = QCursor::pos();
|
||||
|
||||
if (QWidget *w = QApplication::activeWindow())
|
||||
m_lastPos = QCursor::pos(w->screen());
|
||||
}
|
||||
|
||||
void PropertyEditorContextObject::restoreCursor()
|
||||
@@ -503,8 +506,19 @@ void PropertyEditorContextObject::restoreCursor()
|
||||
if (!QApplication::overrideCursor())
|
||||
return;
|
||||
|
||||
QCursor::setPos(m_lastPos);
|
||||
QApplication::restoreOverrideCursor();
|
||||
|
||||
if (QWidget *w = QApplication::activeWindow())
|
||||
QCursor::setPos(w->screen(), m_lastPos);
|
||||
}
|
||||
|
||||
void PropertyEditorContextObject::holdCursorInPlace()
|
||||
{
|
||||
if (!QApplication::overrideCursor())
|
||||
return;
|
||||
|
||||
if (QWidget *w = QApplication::activeWindow())
|
||||
QCursor::setPos(w->screen(), m_lastPos);
|
||||
}
|
||||
|
||||
QStringList PropertyEditorContextObject::styleNamesForFamily(const QString &family)
|
||||
|
||||
@@ -91,6 +91,7 @@ public:
|
||||
|
||||
Q_INVOKABLE void hideCursor();
|
||||
Q_INVOKABLE void restoreCursor();
|
||||
Q_INVOKABLE void holdCursorInPlace();
|
||||
|
||||
Q_INVOKABLE QStringList styleNamesForFamily(const QString &family);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user