aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@qt.io>2020-08-13 09:53:25 +0200
committerRichard Moe Gustavsen <richard.gustavsen@qt.io>2020-08-13 09:53:25 +0200
commitae2dfc52cfc7e627eab6f0aeadb5bed4ec2e8752 (patch)
tree573a3b66577879a278dd758bc52af2900a737b6d
parentc2aaf8ee66ebd56cf4b0b0eedd1e10b80d6c1907 (diff)
parent0ba45442f3f1102af73ec2666e4e5c24ed516331 (diff)
Merge branch 'dev' into nativestyle
-rw-r--r--CMakeLists.txt2
-rw-r--r--dependencies.yaml7
-rw-r--r--examples/quickcontrols2/texteditor/creatorKateHighlighter.pngbin0 -> 106622 bytes
-rw-r--r--examples/quickcontrols2/texteditor/documenthandler.cpp27
-rw-r--r--examples/quickcontrols2/texteditor/documenthandler.h2
-rw-r--r--examples/quickcontrols2/texteditor/einstein.pngbin0 -> 19989 bytes
-rw-r--r--examples/quickcontrols2/texteditor/example.md173
-rw-r--r--examples/quickcontrols2/texteditor/qml/texteditor.qml10
-rw-r--r--examples/quickcontrols2/texteditor/red.pngbin0 -> 130 bytes
-rw-r--r--src/imports/controls/qtquickcontrols2plugin.cpp2
-rw-r--r--src/quicktemplates2/qquickcontrol.cpp28
-rw-r--r--src/quicktemplates2/qquickdial.cpp10
-rw-r--r--src/quicktemplates2/qquickdrawer.cpp12
-rw-r--r--src/quicktemplates2/qquickoverlay.cpp12
-rw-r--r--src/quicktemplates2/qquickpopup.cpp8
-rw-r--r--src/quicktemplates2/qquickrangeslider.cpp8
-rw-r--r--src/quicktemplates2/qquickslider.cpp6
-rw-r--r--src/quicktemplates2/qquickswitch.cpp2
-rw-r--r--src/quicktemplates2/qquickswitchdelegate.cpp2
19 files changed, 247 insertions, 64 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 05dcd0a7..2c31a50f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -10,7 +10,7 @@ project(QtQuickControls2
LANGUAGES CXX C
)
-find_package(Qt6 ${PROJECT_VERSION} CONFIG REQUIRED COMPONENTS BuildInternals Core Gui Widgets Network Qml Quick QmlTools # special case
+find_package(Qt6 ${PROJECT_VERSION} CONFIG REQUIRED COMPONENTS BuildInternals Core Gui Widgets Network Qml Quick # special case
OPTIONAL_COMPONENTS QuickTest # special case
)
if(NOT TARGET Qt::Quick)
diff --git a/dependencies.yaml b/dependencies.yaml
index 448e1e02..21c29eee 100644
--- a/dependencies.yaml
+++ b/dependencies.yaml
@@ -1,10 +1,7 @@
dependencies:
../qtdeclarative:
- ref: 08dbc9940bcb4d139313f03f2aec5a1cbccdbfd3
+ ref: 3baa87d0697368aea1a236b47c9971071a7b33ae
required: true
- ../qtgraphicaleffects:
- ref: 91f09163d8f818e94387dc17ab316eb85ade77ae
- required: false
../qtimageformats:
- ref: b9e758061a118d212ad0cab5de9425de6bb134c8
+ ref: 16c7cb0f04adb8a9e64c6bfab8b24aad9ea2f7f0
required: false
diff --git a/examples/quickcontrols2/texteditor/creatorKateHighlighter.png b/examples/quickcontrols2/texteditor/creatorKateHighlighter.png
new file mode 100644
index 00000000..7dd81950
--- /dev/null
+++ b/examples/quickcontrols2/texteditor/creatorKateHighlighter.png
Binary files differ
diff --git a/examples/quickcontrols2/texteditor/documenthandler.cpp b/examples/quickcontrols2/texteditor/documenthandler.cpp
index 090e0684..72608910 100644
--- a/examples/quickcontrols2/texteditor/documenthandler.cpp
+++ b/examples/quickcontrols2/texteditor/documenthandler.cpp
@@ -53,6 +53,7 @@
#include <QFile>
#include <QFileInfo>
#include <QFileSelector>
+#include <QMimeDatabase>
#include <QQmlFile>
#include <QQmlFileSelector>
#include <QQuickTextDocument>
@@ -293,19 +294,25 @@ void DocumentHandler::load(const QUrl &fileUrl)
const QUrl path = QQmlFileSelector::get(engine)->selector()->select(fileUrl);
const QString fileName = QQmlFile::urlToLocalFileOrQrc(path);
if (QFile::exists(fileName)) {
+ QMimeType mime = QMimeDatabase().mimeTypeForFile(fileName);
QFile file(fileName);
if (file.open(QFile::ReadOnly)) {
- if (QTextDocument *doc = textDocument())
- doc->setModified(false);
-
QByteArray data = file.readAll();
- auto encoding = QStringConverter::encodingForHtml(data.constData(), data.size());
- if (encoding) {
- QStringDecoder decoder(*encoding);
- emit loaded(decoder(data));
- } else {
- // fall back to utf8
- emit loaded(QString::fromUtf8(data));
+ if (QTextDocument *doc = textDocument()) {
+ doc->setBaseUrl(path.adjusted(QUrl::RemoveFilename));
+ doc->setModified(false);
+ if (mime.inherits("text/markdown")) {
+ emit loaded(QString::fromUtf8(data), Qt::MarkdownText);
+ } else {
+ auto encoding = QStringConverter::encodingForHtml(data.constData(), data.size());
+ if (encoding) {
+ QStringDecoder decoder(*encoding);
+ emit loaded(decoder(data), Qt::AutoText);
+ } else {
+ // fall back to utf8
+ emit loaded(QString::fromUtf8(data), Qt::AutoText);
+ }
+ }
}
reset();
diff --git a/examples/quickcontrols2/texteditor/documenthandler.h b/examples/quickcontrols2/texteditor/documenthandler.h
index 1a34f0e0..3863eb49 100644
--- a/examples/quickcontrols2/texteditor/documenthandler.h
+++ b/examples/quickcontrols2/texteditor/documenthandler.h
@@ -152,7 +152,7 @@ Q_SIGNALS:
void textChanged();
void fileUrlChanged();
- void loaded(const QString &text);
+ void loaded(const QString &text, int format);
void error(const QString &message);
void modifiedChanged();
diff --git a/examples/quickcontrols2/texteditor/einstein.png b/examples/quickcontrols2/texteditor/einstein.png
new file mode 100644
index 00000000..3611284d
--- /dev/null
+++ b/examples/quickcontrols2/texteditor/einstein.png
Binary files differ
diff --git a/examples/quickcontrols2/texteditor/example.md b/examples/quickcontrols2/texteditor/example.md
new file mode 100644
index 00000000..169ff433
--- /dev/null
+++ b/examples/quickcontrols2/texteditor/example.md
@@ -0,0 +1,173 @@
+# Markdown in Qt Quick
+
+The Text, TextEdit and TextArea items support rich text formatted in HTML.
+Since Qt 5.14, they now support two dialects of Markdown as well:
+[The CommonMark Specification](https://spec.commonmark.org/0.29/) is the
+conservative formal specification, while
+[GitHub Flavored Markdown](https://guides.github.com/features/mastering-markdown/#GitHub-flavored-markdown)
+adds extra features such as task lists and tables.
+
+If you are viewing this document in the Qt Quick Controls Text Editor example,
+you can edit this document to explore Qt's rich text editing features.
+We have included some comments in each of the following sections to
+encourage you to experiment.
+
+## Font and Paragraph Styles
+
+Markdown supports **bold**, *italic*, ~~strikethrough~~ and `monospace` font
+styles.
+
+> A block quote is indented according to the convention for email quoting.
+
+ A block of code;
+ can be indented;
+ with 4 spaces or a tab;
+
+or
+
+```
+Block {
+ id: code
+ CanBe {
+ wrappedBy: "triple backticks"
+ }
+}
+```
+
+Block quotes can be nested, and block quotes can include indented code blocks.
+
+In [The CommonMark Specification](https://spec.commonmark.org/0.29/)
+John MacFarlane writes:
+
+> What distinguishes Markdown from many other lightweight markup syntaxes,
+> which are often easier to write, is its readability. As Gruber writes:
+
+> > The overriding design goal for Markdown's formatting syntax is to make it
+> > as readable as possible. The idea is that a Markdown-formatted document should
+> > be publishable as-is, as plain text, without looking like it's been marked up
+> > with tags or formatting instructions. (
+> > [http://daringfireball.net/projects/markdown/](http://daringfireball.net/projects/markdown/))
+
+> The point can be illustrated by comparing a sample of AsciiDoc with an
+> equivalent sample of Markdown. Here is a sample of AsciiDoc from the AsciiDoc
+> manual:
+
+> 1. List item one.
+> +
+> List item one continued with a second paragraph followed by an
+> Indented block.
+> +
+> .................
+> $ ls *.sh
+> $ mv *.sh ~/tmp
+> .................
+> +
+> List item continued with a third paragraph.
+>
+> 2. List item two continued with an open block.
+> ...
+>
+
+## Hyperlinks
+
+Hyperlinks can be written with the link text first, and the URL immediately
+following: [Qt Assistant](http://doc.qt.io/qt-5/qtassistant-index.html)
+
+A plain url is automatically recognized: https://doc.qt.io/qt-5/qml-qtquick-text.html
+
+There are also "reference links" where the link text is first labeled
+and then the URL for the label is given elsewhere:
+[The Qt Creator Manual][creatormanual]
+
+## Images
+
+Inline images like this one ![red square](red.png) flow with the surrounding text.
+
+The code for including an image is just a link that starts with a bang.
+An image in its own paragraph is given its own space:
+
+![Albert Einstein image](einstein.png)
+
+## Lists
+
+Different kinds of lists can be included. Standard bullet lists can be nested,
+using different symbols for each level of the list. List items can have nested
+items such as block quotes, code blocks and images. Check boxes can be included
+to form a task list.
+
+- Disc symbols are typically used for top-level list items.
+ * Circle symbols can be used to distinguish between items in lower-level
+ lists.
+ + Square symbols provide a reasonable alternative to discs and circles.
+ * Lists can be continued...
+ * further down
+- List items can include images: ![red square](red.png)
+- and even nested quotes, like this:
+
+ The [Qt Documentation](https://doc.qt.io/qt-5/qml-qtquick-textedit.html#details)
+ points out that
+ > The TextEdit item displays a block of editable, formatted text.
+ >
+ > It can display both plain and rich text. For example:
+ >
+ > TextEdit {
+ > width: 240
+ > text: "<b>Hello</b> <i>World!</i>"
+ > font.family: "Helvetica"
+ > font.pointSize: 20
+ > color: "blue"
+ > focus: true
+ > }
+- List items with check boxes allow task lists to be incorporated:
+ * [ ] This task is not yet done
+ * [x] We aced this one!
+
+Ordered lists can be used for tables of contents, for example. Each number
+should end with a period or a parenthesis:
+
+1. Markdown in Qt Quick
+ 1) Font and Paragraph Styles
+ 5) Hyperlinks
+ 3) Images ![red square](red.png)
+ 2) Lists
+ 4) Tables
+2. Related work
+
+The list will automatically be renumbered during rendering.
+
+## Tables
+
+One of the GitHub extensions is support for tables:
+
+| |Development Tools |Programming Techniques |Graphical User Interfaces|
+|-------------|------------------------------------|---------------------------|-------------------------|
+|9:00 - 11:00 |Introduction to Qt |||
+|11:00 - 13:00|Using Qt Creator |QML and its runtime |Layouts in Qt |
+|13:00 - 15:00|Qt Quick Designer Tutorial |Extreme Programming |Writing Custom Styles |
+|15:00 - 17:00|Qt Linguist and Internationalization| | |
+
+# Related Work
+
+Some Qt Widgets also support Markdown.
+[QTextEdit](https://doc.qt.io/qt-5/qtextedit.html) has similar WYSIWYG
+editing features as TextEdit and TextArea: you can edit the rendered text
+directly. You can use
+[QTextDocument::toMarkdown](https://doc-snapshots.qt.io/qt5-dev/qtextdocument.html#toMarkdown)
+to rewrite the Markdown format, and save it back to a file.
+
+If you have the [KDE Kate Editor](https://kate-editor.org/) installed on your
+system, you probably also have the `markdown.xml` syntax highlighting
+definition file; that can be reused to add Markdown syntax highlighting to
+Qt Creator.
+
+![creator markdown highlighting from Kate](creatorKateHighlighter.png)
+
+Qt owes thanks to the authors of the [MD4C parser](https://github.com/mity/md4c)
+for making markdown import possible. The QTextMarkdownWriter class does not
+have such dependencies, and also has not yet been tested as extensively, so we
+do not yet guarantee that we are able to rewrite every Markdown document that
+you are able to read and display with Text or TextEdit. But you are free to
+write [bugs](https://bugreports.qt.io) about any troublesome cases that you
+encounter.
+
+[creatormanual]: https://doc.qt.io/qtcreator/ "Qt Creator Manual"
diff --git a/examples/quickcontrols2/texteditor/qml/texteditor.qml b/examples/quickcontrols2/texteditor/qml/texteditor.qml
index 6c95335b..b1485582 100644
--- a/examples/quickcontrols2/texteditor/qml/texteditor.qml
+++ b/examples/quickcontrols2/texteditor/qml/texteditor.qml
@@ -173,7 +173,7 @@ ApplicationWindow {
id: openDialog
fileMode: FileDialog.OpenFile
selectedNameFilter.index: 1
- nameFilters: ["Text files (*.txt)", "HTML files (*.html *.htm)"]
+ nameFilters: ["Text files (*.txt)", "HTML files (*.html *.htm)", "Markdown files (*.md *.markdown)"]
folder: StandardPaths.writableLocation(StandardPaths.DocumentsLocation)
onAccepted: document.load(file)
}
@@ -383,8 +383,14 @@ ApplicationWindow {
selectionStart: textArea.selectionStart
selectionEnd: textArea.selectionEnd
textColor: colorDialog.color
- Component.onCompleted: document.load("qrc:/texteditor.html")
+ Component.onCompleted: {
+ if (Qt.application.arguments.length === 2)
+ document.load("file:" + Qt.application.arguments[1]);
+ else
+ document.load("qrc:/texteditor.html")
+ }
onLoaded: {
+ textArea.textFormat = format
textArea.text = text
}
onError: {
diff --git a/examples/quickcontrols2/texteditor/red.png b/examples/quickcontrols2/texteditor/red.png
new file mode 100644
index 00000000..9038fef7
--- /dev/null
+++ b/examples/quickcontrols2/texteditor/red.png
Binary files differ
diff --git a/src/imports/controls/qtquickcontrols2plugin.cpp b/src/imports/controls/qtquickcontrols2plugin.cpp
index 6730848f..53868d16 100644
--- a/src/imports/controls/qtquickcontrols2plugin.cpp
+++ b/src/imports/controls/qtquickcontrols2plugin.cpp
@@ -271,7 +271,7 @@ QList<QQuickStylePlugin *> QtQuickControls2Plugin::loadStylePlugins()
const auto plugins = QPluginLoader::staticInstances();
for (QObject *instance : plugins) {
QQuickStylePlugin *stylePlugin = qobject_cast<QQuickStylePlugin *>(instance);
- if (!stylePlugin || parser.className() != QLatin1String(instance->metaObject()->className()))
+ if (!stylePlugin || !parser.classNames().contains(QLatin1String(instance->metaObject()->className())))
continue;
stylePlugins += stylePlugin;
}
diff --git a/src/quicktemplates2/qquickcontrol.cpp b/src/quicktemplates2/qquickcontrol.cpp
index 8463c60d..22b7f922 100644
--- a/src/quicktemplates2/qquickcontrol.cpp
+++ b/src/quicktemplates2/qquickcontrol.cpp
@@ -176,15 +176,15 @@ bool QQuickControlPrivate::acceptTouch(const QTouchEvent::TouchPoint &point)
if (point.id() == touchId)
return true;
- if (touchId == -1 && point.state() == Qt::TouchPointPressed) {
+ if (touchId == -1 && point.state() == QEventPoint::Pressed) {
touchId = point.id();
return true;
}
// If the control is on a Flickable that has a pressDelay, then the press is never
// sent as a touch event, therefore we need to check for this case.
- if (touchId == -1 && pressWasTouch && point.state() == Qt::TouchPointReleased &&
- point.pos() == previousPressPos) {
+ if (touchId == -1 && pressWasTouch && point.state() == QEventPoint::Released &&
+ point.position() == previousPressPos) {
return true;
}
return false;
@@ -1953,7 +1953,7 @@ void QQuickControl::hoverEnterEvent(QHoverEvent *event)
void QQuickControl::hoverMoveEvent(QHoverEvent *event)
{
Q_D(QQuickControl);
- setHovered(d->hoverEnabled && contains(event->pos()));
+ setHovered(d->hoverEnabled && contains(event->position()));
event->setAccepted(d->hoverEnabled);
}
@@ -1968,10 +1968,10 @@ void QQuickControl::hoverLeaveEvent(QHoverEvent *event)
void QQuickControl::mousePressEvent(QMouseEvent *event)
{
Q_D(QQuickControl);
- d->handlePress(event->localPos());
+ d->handlePress(event->position());
if (event->source() == Qt::MouseEventSynthesizedByQt) {
d->pressWasTouch = true;
- d->previousPressPos = event->localPos();
+ d->previousPressPos = event->position();
}
event->accept();
}
@@ -1979,14 +1979,14 @@ void QQuickControl::mousePressEvent(QMouseEvent *event)
void QQuickControl::mouseMoveEvent(QMouseEvent *event)
{
Q_D(QQuickControl);
- d->handleMove(event->localPos());
+ d->handleMove(event->position());
event->accept();
}
void QQuickControl::mouseReleaseEvent(QMouseEvent *event)
{
Q_D(QQuickControl);
- d->handleRelease(event->localPos());
+ d->handleRelease(event->position());
event->accept();
}
@@ -2009,14 +2009,14 @@ void QQuickControl::touchEvent(QTouchEvent *event)
continue;
switch (point.state()) {
- case Qt::TouchPointPressed:
- d->handlePress(point.pos());
+ case QEventPoint::Pressed:
+ d->handlePress(point.position());
break;
- case Qt::TouchPointMoved:
- d->handleMove(point.pos());
+ case QEventPoint::Updated:
+ d->handleMove(point.position());
break;
- case Qt::TouchPointReleased:
- d->handleRelease(point.pos());
+ case QEventPoint::Released:
+ d->handleRelease(point.position());
break;
default:
break;
diff --git a/src/quicktemplates2/qquickdial.cpp b/src/quicktemplates2/qquickdial.cpp
index 99bd0e98..e011891f 100644
--- a/src/quicktemplates2/qquickdial.cpp
+++ b/src/quicktemplates2/qquickdial.cpp
@@ -735,7 +735,7 @@ void QQuickDial::mousePressEvent(QMouseEvent *event)
{
Q_D(QQuickDial);
QQuickControl::mousePressEvent(event);
- d->handleMove(event->localPos());
+ d->handleMove(event->position());
setKeepMouseGrab(true);
}
@@ -750,18 +750,18 @@ void QQuickDial::touchEvent(QTouchEvent *event)
continue;
switch (point.state()) {
- case Qt::TouchPointMoved:
+ case QEventPoint::Updated:
if (!keepTouchGrab()) {
- bool overXDragThreshold = QQuickWindowPrivate::dragOverThreshold(point.pos().x() - d->pressPoint.x(), Qt::XAxis, &point);
+ bool overXDragThreshold = QQuickWindowPrivate::dragOverThreshold(point.position().x() - d->pressPoint.x(), Qt::XAxis, &point);
setKeepTouchGrab(overXDragThreshold);
if (!overXDragThreshold) {
- bool overYDragThreshold = QQuickWindowPrivate::dragOverThreshold(point.pos().y() - d->pressPoint.y(), Qt::YAxis, &point);
+ bool overYDragThreshold = QQuickWindowPrivate::dragOverThreshold(point.position().y() - d->pressPoint.y(), Qt::YAxis, &point);
setKeepTouchGrab(overYDragThreshold);
}
}
if (keepTouchGrab())
- d->handleMove(point.pos());
+ d->handleMove(point.position());
break;
default:
diff --git a/src/quicktemplates2/qquickdrawer.cpp b/src/quicktemplates2/qquickdrawer.cpp
index 433346ba..47b69161 100644
--- a/src/quicktemplates2/qquickdrawer.cpp
+++ b/src/quicktemplates2/qquickdrawer.cpp
@@ -305,7 +305,7 @@ bool QQuickDrawerPrivate::startDrag(QEvent *event)
switch (event->type()) {
case QEvent::MouseButtonPress:
- if (isWithinDragMargin(q, static_cast<QMouseEvent *>(event)->windowPos())) {
+ if (isWithinDragMargin(q, static_cast<QMouseEvent *>(event)->scenePosition())) {
prepareEnterTransition();
reposition();
return handleMouseEvent(window->contentItem(), static_cast<QMouseEvent *>(event));
@@ -316,7 +316,7 @@ bool QQuickDrawerPrivate::startDrag(QEvent *event)
case QEvent::TouchBegin:
case QEvent::TouchUpdate:
for (const QTouchEvent::TouchPoint &point : static_cast<QTouchEvent *>(event)->touchPoints()) {
- if (point.state() == Qt::TouchPointPressed && isWithinDragMargin(q, point.scenePos())) {
+ if (point.state() == QEventPoint::Pressed && isWithinDragMargin(q, point.scenePosition())) {
prepareEnterTransition();
reposition();
return handleTouchEvent(window->contentItem(), static_cast<QTouchEvent *>(event));
@@ -345,7 +345,7 @@ bool QQuickDrawerPrivate::grabMouse(QQuickItem *item, QMouseEvent *event)
if (!window || !interactive || keepGrab(popupItem) || keepGrab(item))
return false;
- const QPointF movePoint = event->windowPos();
+ const QPointF movePoint = event->scenePosition();
// Flickable uses a hard-coded threshold of 15 for flicking, and
// QStyleHints::startDragDistance for dragging. Drawer uses a bit
@@ -384,15 +384,15 @@ bool QQuickDrawerPrivate::grabTouch(QQuickItem *item, QTouchEvent *event)
Q_Q(QQuickDrawer);
bool handled = handleTouchEvent(item, event);
- if (!window || !interactive || keepGrab(popupItem) || keepGrab(item) || !event->touchPointStates().testFlag(Qt::TouchPointMoved))
+ if (!window || !interactive || keepGrab(popupItem) || keepGrab(item) || !event->touchPointStates().testFlag(QEventPoint::Updated))
return handled;
bool overThreshold = false;
for (const QTouchEvent::TouchPoint &point : event->touchPoints()) {
- if (!acceptTouch(point) || point.state() != Qt::TouchPointMoved)
+ if (!acceptTouch(point) || point.state() != QEventPoint::Updated)
continue;
- const QPointF movePoint = point.scenePos();
+ const QPointF movePoint = point.scenePosition();
// Flickable uses a hard-coded threshold of 15 for flicking, and
// QStyleHints::startDragDistance for dragging. Drawer uses a bit
diff --git a/src/quicktemplates2/qquickoverlay.cpp b/src/quicktemplates2/qquickoverlay.cpp
index 5cb1ab0b..4d272bff 100644
--- a/src/quicktemplates2/qquickoverlay.cpp
+++ b/src/quicktemplates2/qquickoverlay.cpp
@@ -217,16 +217,16 @@ bool QQuickOverlayPrivate::handleTouchEvent(QQuickItem *source, QTouchEvent *eve
case QEvent::TouchEnd:
for (const QTouchEvent::TouchPoint &point : event->touchPoints()) {
switch (point.state()) {
- case Qt::TouchPointPressed:
+ case QEventPoint::Pressed:
if (!target && startDrag(event, point.scenePosition()))
handled = true;
else
handled |= handlePress(source, event, target);
break;
- case Qt::TouchPointMoved:
+ case QEventPoint::Updated:
handled |= handleMove(source, event, target ? target : mouseGrabberPopup.data());
break;
- case Qt::TouchPointReleased:
+ case QEventPoint::Released:
handled |= handleRelease(source, event, target ? target : mouseGrabberPopup.data());
break;
default:
@@ -496,15 +496,15 @@ bool QQuickOverlay::eventFilter(QObject *object, QEvent *event)
case QEvent::TouchBegin:
case QEvent::TouchUpdate:
case QEvent::TouchEnd:
- if (static_cast<QTouchEvent *>(event)->touchPointStates() & Qt::TouchPointPressed)
+ if (static_cast<QTouchEvent *>(event)->touchPointStates() & QEventPoint::Pressed)
emit pressed();
- if (static_cast<QTouchEvent *>(event)->touchPointStates() & Qt::TouchPointReleased)
+ if (static_cast<QTouchEvent *>(event)->touchPointStates() & QEventPoint::Released)
emit released();
// allow non-modal popups to close on touch release outside
if (!d->mouseGrabberPopup) {
for (const QTouchEvent::TouchPoint &point : static_cast<QTouchEvent *>(event)->touchPoints()) {
- if (point.state() == Qt::TouchPointReleased) {
+ if (point.state() == QEventPoint::Released) {
if (d->handleRelease(d->window->contentItem(), event, nullptr))
break;
}
diff --git a/src/quicktemplates2/qquickpopup.cpp b/src/quicktemplates2/qquickpopup.cpp
index 1d6f125e..57b93036 100644
--- a/src/quicktemplates2/qquickpopup.cpp
+++ b/src/quicktemplates2/qquickpopup.cpp
@@ -313,7 +313,7 @@ bool QQuickPopupPrivate::acceptTouch(const QTouchEvent::TouchPoint &point)
if (point.id() == touchId)
return true;
- if (touchId == -1 && point.state() != Qt::TouchPointReleased) {
+ if (touchId == -1 && point.state() != QEventPoint::Released) {
touchId = point.id();
return true;
}
@@ -395,11 +395,11 @@ bool QQuickPopupPrivate::handleTouchEvent(QQuickItem *item, QTouchEvent *event)
return blockInput(item, point.position());
switch (point.state()) {
- case Qt::TouchPointPressed:
+ case QEventPoint::Pressed:
return handlePress(item, item->mapToScene(point.position()), event->timestamp());
- case Qt::TouchPointMoved:
+ case QEventPoint::Updated:
return handleMove(item, item->mapToScene(point.position()), event->timestamp());
- case Qt::TouchPointReleased:
+ case QEventPoint::Released:
return handleRelease(item, item->mapToScene(point.position()), event->timestamp());
default:
break;
diff --git a/src/quicktemplates2/qquickrangeslider.cpp b/src/quicktemplates2/qquickrangeslider.cpp
index 2b0f2961..af95d463 100644
--- a/src/quicktemplates2/qquickrangeslider.cpp
+++ b/src/quicktemplates2/qquickrangeslider.cpp
@@ -458,7 +458,7 @@ bool QQuickRangeSliderPrivate::acceptTouch(const QTouchEvent::TouchPoint &point)
int firstId = QQuickRangeSliderNodePrivate::get(first)->touchId;
int secondId = QQuickRangeSliderNodePrivate::get(second)->touchId;
- if (((firstId == -1 || secondId == -1) && point.state() == Qt::TouchPointPressed) || point.id() == firstId || point.id() == secondId) {
+ if (((firstId == -1 || secondId == -1) && point.state() == QEventPoint::Pressed) || point.id() == firstId || point.id() == secondId) {
touchId = point.id();
return true;
}
@@ -1196,10 +1196,10 @@ void QQuickRangeSlider::touchEvent(QTouchEvent *event)
continue;
switch (point.state()) {
- case Qt::TouchPointPressed:
+ case QEventPoint::Pressed:
d->handlePress(point.position());
break;
- case Qt::TouchPointMoved:
+ case QEventPoint::Updated:
if (!keepTouchGrab()) {
if (d->orientation == Qt::Horizontal)
setKeepTouchGrab(QQuickWindowPrivate::dragOverThreshold(point.position().x() - point.pressPosition().x(), Qt::XAxis, &point, qRound(d->touchDragThreshold)));
@@ -1209,7 +1209,7 @@ void QQuickRangeSlider::touchEvent(QTouchEvent *event)
if (keepTouchGrab())
d->handleMove(point.position());
break;
- case Qt::TouchPointReleased:
+ case QEventPoint::Released:
d->handleRelease(point.position());
break;
default:
diff --git a/src/quicktemplates2/qquickslider.cpp b/src/quicktemplates2/qquickslider.cpp
index 9d223f25..dcff5420 100644
--- a/src/quicktemplates2/qquickslider.cpp
+++ b/src/quicktemplates2/qquickslider.cpp
@@ -805,10 +805,10 @@ void QQuickSlider::touchEvent(QTouchEvent *event)
continue;
switch (point.state()) {
- case Qt::TouchPointPressed:
+ case QEventPoint::Pressed:
d->handlePress(point.position());
break;
- case Qt::TouchPointMoved:
+ case QEventPoint::Updated:
if (!keepTouchGrab()) {
if (d->orientation == Qt::Horizontal)
setKeepTouchGrab(QQuickWindowPrivate::dragOverThreshold(point.position().x() - d->pressPoint.x(), Qt::XAxis, &point, qRound(d->touchDragThreshold)));
@@ -818,7 +818,7 @@ void QQuickSlider::touchEvent(QTouchEvent *event)
if (keepTouchGrab())
d->handleMove(point.position());
break;
- case Qt::TouchPointReleased:
+ case QEventPoint::Released:
d->handleRelease(point.position());
break;
default:
diff --git a/src/quicktemplates2/qquickswitch.cpp b/src/quicktemplates2/qquickswitch.cpp
index 2bba350d..143210ae 100644
--- a/src/quicktemplates2/qquickswitch.cpp
+++ b/src/quicktemplates2/qquickswitch.cpp
@@ -193,7 +193,7 @@ void QQuickSwitch::touchEvent(QTouchEvent *event)
Q_D(QQuickSwitch);
if (!keepTouchGrab() && event->type() == QEvent::TouchUpdate) {
for (const QTouchEvent::TouchPoint &point : event->touchPoints()) {
- if (point.id() != d->touchId || point.state() != Qt::TouchPointMoved)
+ if (point.id() != d->touchId || point.state() != QEventPoint::Updated)
continue;
if (d->canDrag(point.position()))
setKeepTouchGrab(QQuickWindowPrivate::dragOverThreshold(point.position().x() - d->pressPoint.x(), Qt::XAxis, &point));
diff --git a/src/quicktemplates2/qquickswitchdelegate.cpp b/src/quicktemplates2/qquickswitchdelegate.cpp
index 3300e252..2e196412 100644
--- a/src/quicktemplates2/qquickswitchdelegate.cpp
+++ b/src/quicktemplates2/qquickswitchdelegate.cpp
@@ -190,7 +190,7 @@ void QQuickSwitchDelegate::touchEvent(QTouchEvent *event)
Q_D(QQuickSwitchDelegate);
if (!keepTouchGrab() && event->type() == QEvent::TouchUpdate) {
for (const QTouchEvent::TouchPoint &point : event->touchPoints()) {
- if (point.id() != d->touchId || point.state() != Qt::TouchPointMoved)
+ if (point.id() != d->touchId || point.state() != QEventPoint::Updated)
continue;
if (d->canDrag(point.position()))
setKeepTouchGrab(QQuickWindowPrivate::dragOverThreshold(point.position().x() - d->pressPoint.x(), Qt::XAxis, &point));