diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/imports/labsmodels/qqmltablemodel.cpp | 21 | ||||
-rw-r--r-- | src/quick/items/qquicktextinput.cpp | 3 |
2 files changed, 18 insertions, 6 deletions
diff --git a/src/imports/labsmodels/qqmltablemodel.cpp b/src/imports/labsmodels/qqmltablemodel.cpp index 6ba2cecf19..5a2d68780c 100644 --- a/src/imports/labsmodels/qqmltablemodel.cpp +++ b/src/imports/labsmodels/qqmltablemodel.cpp @@ -1043,11 +1043,24 @@ bool QQmlTableModel::validateNewRow(const char *functionName, const QVariant &ro } const QVariant rolePropertyValue = rowAsMap.value(roleData.name); + if (rolePropertyValue.userType() != roleData.type) { - qmlWarning(this).quote() << functionName << ": expected the property named " - << roleData.name << " to be of type " << roleData.typeName - << ", but got " << QString::fromLatin1(rolePropertyValue.typeName()) << " instead"; - return false; + if (!rolePropertyValue.canConvert(int(roleData.type))) { + qmlWarning(this).quote() << functionName << ": expected the property named " + << roleData.name << " to be of type " << roleData.typeName + << ", but got " << QString::fromLatin1(rolePropertyValue.typeName()) + << " instead"; + return false; + } + + QVariant effectiveValue = rolePropertyValue; + if (!effectiveValue.convert(int(roleData.type))) { + qmlWarning(this).nospace() << functionName << ": failed converting value " + << rolePropertyValue << " set at column " << columnIndex << " with role " + << QString::fromLatin1(rolePropertyValue.typeName()) << " to " + << roleData.typeName; + return false; + } } } } diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp index 8f306daed2..06a9f134ac 100644 --- a/src/quick/items/qquicktextinput.cpp +++ b/src/quick/items/qquicktextinput.cpp @@ -2895,8 +2895,7 @@ void QQuickTextInputPrivate::updateDisplayText(bool forceUpdate) // characters) QChar* uc = str.data(); for (int i = 0; i < str.length(); ++i) { - if ((uc[i].unicode() < 0x20 && uc[i] != QChar::Tabulation) - || uc[i] == QChar::LineSeparator + if (uc[i] == QChar::LineSeparator || uc[i] == QChar::ParagraphSeparator || uc[i] == QChar::ObjectReplacementCharacter) uc[i] = QChar(0x0020); |