|
|
84d59a0 |
diff -up qtdeclarative-opensource-src-5.7.1/src/quick/items/qquicktextcontrol.cpp.bz#1120451 qtdeclarative-opensource-src-5.7.1/src/quick/items/qquicktextcontrol.cpp
|
|
|
84d59a0 |
--- qtdeclarative-opensource-src-5.7.1/src/quick/items/qquicktextcontrol.cpp.bz#1120451 2016-11-11 07:18:01.000000000 +0100
|
|
|
84d59a0 |
+++ qtdeclarative-opensource-src-5.7.1/src/quick/items/qquicktextcontrol.cpp 2017-07-19 17:19:18.253590767 +0200
|
|
|
84d59a0 |
@@ -608,7 +608,7 @@ void QQuickTextControl::clear()
|
|
|
84d59a0 |
}
|
|
|
84d59a0 |
|
|
|
84d59a0 |
QQuickTextControl::QQuickTextControl(QTextDocument *doc, QObject *parent)
|
|
|
84d59a0 |
- : QObject(*new QQuickTextControlPrivate, parent)
|
|
|
84d59a0 |
+ : QInputControl(TextEdit, *new QQuickTextControlPrivate, parent)
|
|
|
84d59a0 |
{
|
|
|
84d59a0 |
Q_D(QQuickTextControl);
|
|
|
84d59a0 |
Q_ASSERT(doc);
|
|
|
84d59a0 |
@@ -980,9 +980,8 @@ void QQuickTextControlPrivate::keyPressE
|
|
|
84d59a0 |
|
|
|
84d59a0 |
process:
|
|
|
84d59a0 |
{
|
|
|
84d59a0 |
- QString text = e->text();
|
|
|
84d59a0 |
- if (!text.isEmpty() && (text.at(0).isPrint() || text.at(0) == QLatin1Char('\t'))) {
|
|
|
84d59a0 |
- cursor.insertText(text);
|
|
|
84d59a0 |
+ if (q->isAcceptableInput(e)) {
|
|
|
84d59a0 |
+ cursor.insertText(e->text());
|
|
|
84d59a0 |
selectionChanged();
|
|
|
84d59a0 |
} else {
|
|
|
84d59a0 |
e->ignore();
|
|
|
84d59a0 |
diff -up qtdeclarative-opensource-src-5.7.1/src/quick/items/qquicktextcontrol_p.h.bz#1120451 qtdeclarative-opensource-src-5.7.1/src/quick/items/qquicktextcontrol_p.h
|
|
|
84d59a0 |
--- qtdeclarative-opensource-src-5.7.1/src/quick/items/qquicktextcontrol_p.h.bz#1120451 2016-11-11 07:18:01.000000000 +0100
|
|
|
84d59a0 |
+++ qtdeclarative-opensource-src-5.7.1/src/quick/items/qquicktextcontrol_p.h 2017-07-19 17:19:18.253590767 +0200
|
|
|
84d59a0 |
@@ -59,6 +59,7 @@
|
|
|
84d59a0 |
#include <QtGui/qabstracttextdocumentlayout.h>
|
|
|
84d59a0 |
#include <QtGui/qtextdocumentfragment.h>
|
|
|
84d59a0 |
#include <QtGui/qclipboard.h>
|
|
|
84d59a0 |
+#include <QtGui/private/qinputcontrol_p.h>
|
|
|
84d59a0 |
#include <QtCore/qmimedata.h>
|
|
|
84d59a0 |
|
|
|
84d59a0 |
QT_BEGIN_NAMESPACE
|
|
|
84d59a0 |
@@ -71,7 +72,7 @@ class QAbstractScrollArea;
|
|
|
84d59a0 |
class QEvent;
|
|
|
84d59a0 |
class QTimerEvent;
|
|
|
84d59a0 |
|
|
|
84d59a0 |
-class Q_AUTOTEST_EXPORT QQuickTextControl : public QObject
|
|
|
84d59a0 |
+class Q_AUTOTEST_EXPORT QQuickTextControl : public QInputControl
|
|
|
84d59a0 |
{
|
|
|
84d59a0 |
Q_OBJECT
|
|
|
84d59a0 |
Q_DECLARE_PRIVATE(QQuickTextControl)
|
|
|
84d59a0 |
diff -up qtdeclarative-opensource-src-5.7.1/src/quick/items/qquicktextinput.cpp.bz#1120451 qtdeclarative-opensource-src-5.7.1/src/quick/items/qquicktextinput.cpp
|
|
|
84d59a0 |
--- qtdeclarative-opensource-src-5.7.1/src/quick/items/qquicktextinput.cpp.bz#1120451 2016-11-11 07:18:01.000000000 +0100
|
|
|
84d59a0 |
+++ qtdeclarative-opensource-src-5.7.1/src/quick/items/qquicktextinput.cpp 2017-07-19 17:20:55.479933008 +0200
|
|
|
84d59a0 |
@@ -63,6 +63,7 @@
|
|
|
84d59a0 |
#endif
|
|
|
84d59a0 |
|
|
|
84d59a0 |
#include <QtGui/private/qtextengine_p.h>
|
|
|
84d59a0 |
+#include <QtGui/private/qinputcontrol_p.h>
|
|
|
84d59a0 |
|
|
|
84d59a0 |
QT_BEGIN_NAMESPACE
|
|
|
84d59a0 |
|
|
|
84d59a0 |
@@ -2619,6 +2620,7 @@ void QQuickTextInputPrivate::init()
|
|
|
84d59a0 |
option.setUseDesignMetrics(renderType != QQuickTextInput::NativeRendering);
|
|
|
84d59a0 |
m_textLayout.setTextOption(option);
|
|
|
84d59a0 |
}
|
|
|
84d59a0 |
+ m_inputControl = new QInputControl(QInputControl::LineEdit, q);
|
|
|
84d59a0 |
}
|
|
|
84d59a0 |
|
|
|
84d59a0 |
void QQuickTextInputPrivate::resetInputMethod()
|
|
|
84d59a0 |
@@ -4452,9 +4454,8 @@ void QQuickTextInputPrivate::processKeyE
|
|
|
84d59a0 |
}
|
|
|
84d59a0 |
|
|
|
84d59a0 |
if (unknown && !m_readOnly) {
|
|
|
84d59a0 |
- QString t = event->text();
|
|
|
84d59a0 |
- if (!t.isEmpty() && t.at(0).isPrint()) {
|
|
|
84d59a0 |
- insert(t);
|
|
|
84d59a0 |
+ if (m_inputControl->isAcceptableInput(event)) {
|
|
|
84d59a0 |
+ insert(event->text());
|
|
|
84d59a0 |
event->accept();
|
|
|
84d59a0 |
return;
|
|
|
84d59a0 |
}
|
|
|
84d59a0 |
diff -up qtdeclarative-opensource-src-5.7.1/src/quick/items/qquicktextinput_p_p.h.bz#1120451 qtdeclarative-opensource-src-5.7.1/src/quick/items/qquicktextinput_p_p.h
|
|
|
84d59a0 |
--- qtdeclarative-opensource-src-5.7.1/src/quick/items/qquicktextinput_p_p.h.bz#1120451 2016-11-11 07:18:01.000000000 +0100
|
|
|
84d59a0 |
+++ qtdeclarative-opensource-src-5.7.1/src/quick/items/qquicktextinput_p_p.h 2017-07-19 17:19:18.254590729 +0200
|
|
|
84d59a0 |
@@ -70,6 +70,7 @@
|
|
|
84d59a0 |
QT_BEGIN_NAMESPACE
|
|
|
84d59a0 |
|
|
|
84d59a0 |
class QQuickTextNode;
|
|
|
84d59a0 |
+class QInputControl;
|
|
|
84d59a0 |
|
|
|
84d59a0 |
class Q_QUICK_PRIVATE_EXPORT QQuickTextInputPrivate : public QQuickImplicitSizeItemPrivate
|
|
|
84d59a0 |
{
|
|
|
84d59a0 |
@@ -227,6 +228,7 @@ public:
|
|
|
84d59a0 |
QQuickItem *cursorItem;
|
|
|
84d59a0 |
QQuickTextNode *textNode;
|
|
|
84d59a0 |
MaskInputData *m_maskData;
|
|
|
84d59a0 |
+ QInputControl *m_inputControl;
|
|
|
84d59a0 |
|
|
|
84d59a0 |
QList<int> m_transactions;
|
|
|
84d59a0 |
QVector<Command> m_history;
|