summaryrefslogtreecommitdiffstats
path: root/src/gui/text
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/text')
-rw-r--r--src/gui/text/qcssparser.cpp6
-rw-r--r--src/gui/text/qinputcontrol.cpp51
-rw-r--r--src/gui/text/qinputcontrol_p.h1
-rw-r--r--src/gui/text/qtextdocument.cpp2
-rw-r--r--src/gui/text/qtextdocumentlayout.cpp2
-rw-r--r--src/gui/text/qtexthtmlparser.cpp10
6 files changed, 63 insertions, 9 deletions
diff --git a/src/gui/text/qcssparser.cpp b/src/gui/text/qcssparser.cpp
index a0438bd458..64adeaa260 100644
--- a/src/gui/text/qcssparser.cpp
+++ b/src/gui/text/qcssparser.cpp
@@ -1822,7 +1822,7 @@ void StyleSheet::buildIndexes(Qt::CaseSensitivity nameCaseSensitivity)
nr.order = i;
QString name = sel.elementName;
if (nameCaseSensitivity == Qt::CaseInsensitive)
- name=name.toLower();
+ name = std::move(name).toLower();
nameIndex.insert(name, nr);
} else {
universalsSelectors += selector;
@@ -2027,7 +2027,7 @@ QVector<StyleRule> StyleSelector::styleRulesForNode(NodePtr node)
for (int i = 0; i < names.count(); i++) {
QString name = names.at(i);
if (nameCaseSensitivity == Qt::CaseInsensitive)
- name = name.toLower();
+ name = std::move(name).toLower();
QMultiHash<QString, StyleRule>::const_iterator it = styleSheet.nameIndex.constFind(name);
while (it != styleSheet.nameIndex.constEnd() && it.key() == name) {
matchRule(node, it.value(), styleSheet.origin, styleSheet.depth, &weightedRules);
@@ -2748,7 +2748,7 @@ bool Parser::testAndParseUri(QString *uri)
index = rewind;
return false;
}
- if (name.toLower() != QLatin1String("url")) {
+ if (name.compare(QLatin1String("url"), Qt::CaseInsensitive) != 0) {
index = rewind;
return false;
}
diff --git a/src/gui/text/qinputcontrol.cpp b/src/gui/text/qinputcontrol.cpp
index 2f7dcfcd2b..3381fdb673 100644
--- a/src/gui/text/qinputcontrol.cpp
+++ b/src/gui/text/qinputcontrol.cpp
@@ -85,4 +85,55 @@ bool QInputControl::isAcceptableInput(const QKeyEvent *event) const
return false;
}
+bool QInputControl::isCommonTextEditShortcut(const QKeyEvent *ke)
+{
+ if (ke->modifiers() == Qt::NoModifier
+ || ke->modifiers() == Qt::ShiftModifier
+ || ke->modifiers() == Qt::KeypadModifier) {
+ if (ke->key() < Qt::Key_Escape) {
+ return true;
+ } else {
+ switch (ke->key()) {
+ case Qt::Key_Return:
+ case Qt::Key_Enter:
+ case Qt::Key_Delete:
+ case Qt::Key_Home:
+ case Qt::Key_End:
+ case Qt::Key_Backspace:
+ case Qt::Key_Left:
+ case Qt::Key_Right:
+ case Qt::Key_Up:
+ case Qt::Key_Down:
+ case Qt::Key_Tab:
+ return true;
+ default:
+ break;
+ }
+ }
+#if QT_CONFIG(shortcut)
+ } else if (ke->matches(QKeySequence::Copy)
+ || ke->matches(QKeySequence::Paste)
+ || ke->matches(QKeySequence::Cut)
+ || ke->matches(QKeySequence::Redo)
+ || ke->matches(QKeySequence::Undo)
+ || ke->matches(QKeySequence::MoveToNextWord)
+ || ke->matches(QKeySequence::MoveToPreviousWord)
+ || ke->matches(QKeySequence::MoveToStartOfDocument)
+ || ke->matches(QKeySequence::MoveToEndOfDocument)
+ || ke->matches(QKeySequence::SelectNextWord)
+ || ke->matches(QKeySequence::SelectPreviousWord)
+ || ke->matches(QKeySequence::SelectStartOfLine)
+ || ke->matches(QKeySequence::SelectEndOfLine)
+ || ke->matches(QKeySequence::SelectStartOfBlock)
+ || ke->matches(QKeySequence::SelectEndOfBlock)
+ || ke->matches(QKeySequence::SelectStartOfDocument)
+ || ke->matches(QKeySequence::SelectEndOfDocument)
+ || ke->matches(QKeySequence::SelectAll)
+ ) {
+ return true;
+#endif
+ }
+ return false;
+}
+
QT_END_NAMESPACE
diff --git a/src/gui/text/qinputcontrol_p.h b/src/gui/text/qinputcontrol_p.h
index e5709b5e54..b4c1ca8f8f 100644
--- a/src/gui/text/qinputcontrol_p.h
+++ b/src/gui/text/qinputcontrol_p.h
@@ -69,6 +69,7 @@ public:
explicit QInputControl(Type type, QObject *parent = nullptr);
bool isAcceptableInput(const QKeyEvent *event) const;
+ static bool isCommonTextEditShortcut(const QKeyEvent *ke);
protected:
explicit QInputControl(Type type, QObjectPrivate &dd, QObject *parent = nullptr);
diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp
index 6074917087..f8215f92e9 100644
--- a/src/gui/text/qtextdocument.cpp
+++ b/src/gui/text/qtextdocument.cpp
@@ -133,7 +133,7 @@ bool Qt::mightBeRichText(const QString& text)
return false; // that's not a tag
}
#ifndef QT_NO_TEXTHTMLPARSER
- return QTextHtmlParser::lookupElement(tag.toLower()) != -1;
+ return QTextHtmlParser::lookupElement(std::move(tag).toLower()) != -1;
#else
return false;
#endif // QT_NO_TEXTHTMLPARSER
diff --git a/src/gui/text/qtextdocumentlayout.cpp b/src/gui/text/qtextdocumentlayout.cpp
index 8ad2d85e7c..e9194e73ff 100644
--- a/src/gui/text/qtextdocumentlayout.cpp
+++ b/src/gui/text/qtextdocumentlayout.cpp
@@ -834,6 +834,8 @@ void QTextDocumentLayoutPrivate::drawBorder(QPainter *painter, const QRectF &rec
#ifndef QT_NO_CSSPARSER
QCss::BorderStyle cssStyle = static_cast<QCss::BorderStyle>(style + 1);
+#else
+ Q_UNUSED(style);
#endif //QT_NO_CSSPARSER
bool turn_off_antialiasing = !(painter->renderHints() & QPainter::Antialiasing);
diff --git a/src/gui/text/qtexthtmlparser.cpp b/src/gui/text/qtexthtmlparser.cpp
index 269e505a56..da4e21728f 100644
--- a/src/gui/text/qtexthtmlparser.cpp
+++ b/src/gui/text/qtexthtmlparser.cpp
@@ -706,8 +706,8 @@ void QTextHtmlParser::parseTag()
node = resolveParent();
resolveNode();
- const int nodeIndex = nodes.count() - 1; // this new node is always the last
#ifndef QT_NO_CSSPARSER
+ const int nodeIndex = nodes.count() - 1; // this new node is always the last
node->applyCssDeclarations(declarationsForNode(nodeIndex), resourceProvider);
#endif
applyAttributes(node->attributes);
@@ -1525,7 +1525,7 @@ void QTextHtmlParser::applyAttributes(const QStringList &attributes)
} else if (value == QLatin1String("I")) {
node->listStyle = QTextListFormat::ListUpperRoman;
} else {
- value = value.toLower();
+ value = std::move(value).toLower();
if (value == QLatin1String("square"))
node->listStyle = QTextListFormat::ListSquare;
else if (value == QLatin1String("disc"))
@@ -1636,7 +1636,7 @@ void QTextHtmlParser::applyAttributes(const QStringList &attributes)
node->parseStyleAttribute(value, resourceProvider);
#endif
} else if (key == QLatin1String("align")) {
- value = value.toLower();
+ value = std::move(value).toLower();
bool alignmentSet = true;
if (value == QLatin1String("left"))
@@ -1664,7 +1664,7 @@ void QTextHtmlParser::applyAttributes(const QStringList &attributes)
}
}
} else if (key == QLatin1String("valign")) {
- value = value.toLower();
+ value = std::move(value).toLower();
if (value == QLatin1String("top"))
node->charFormat.setVerticalAlignment(QTextCharFormat::AlignTop);
else if (value == QLatin1String("middle"))
@@ -1672,7 +1672,7 @@ void QTextHtmlParser::applyAttributes(const QStringList &attributes)
else if (value == QLatin1String("bottom"))
node->charFormat.setVerticalAlignment(QTextCharFormat::AlignBottom);
} else if (key == QLatin1String("dir")) {
- value = value.toLower();
+ value = std::move(value).toLower();
if (value == QLatin1String("ltr"))
node->blockFormat.setLayoutDirection(Qt::LeftToRight);
else if (value == QLatin1String("rtl"))