diff options
author | Liang Qi <liang.qi@qt.io> | 2017-04-04 18:08:01 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2017-04-04 18:09:33 +0200 |
commit | 9419dfe8ee45d08f09c09d3cbece511d721546f0 (patch) | |
tree | 1c4584099fc1efb8de30cc4526ce7ebafe8a8ce9 /src/gui | |
parent | 8b5aa7b6c40d70a7ec15b3ea485f28a142fb247c (diff) | |
parent | 8675e1c5ee7d1209784a2320f1ae3f486b1eaae4 (diff) |
Merge remote-tracking branch 'origin/5.9' into dev
Conflicts:
src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h
src/plugins/platforms/xcb/qxcbwindow.cpp
Change-Id: Ic747c3c50e68c005b425e7a1ec2a90965527c8bd
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/kernel/qkeysequence.cpp | 2 | ||||
-rw-r--r-- | src/gui/opengl/qopenglframebufferobject.cpp | 43 | ||||
-rw-r--r-- | src/gui/painting/qdrawhelper.cpp | 16 | ||||
-rw-r--r-- | src/gui/painting/qdrawhelper_sse2.cpp | 24 | ||||
-rw-r--r-- | src/gui/painting/qpdf.cpp | 3 | ||||
-rw-r--r-- | src/gui/text/qcssparser.cpp | 6 | ||||
-rw-r--r-- | src/gui/text/qinputcontrol.cpp | 51 | ||||
-rw-r--r-- | src/gui/text/qinputcontrol_p.h | 1 | ||||
-rw-r--r-- | src/gui/text/qtextdocument.cpp | 2 | ||||
-rw-r--r-- | src/gui/text/qtextdocumentlayout.cpp | 2 | ||||
-rw-r--r-- | src/gui/text/qtexthtmlparser.cpp | 10 |
11 files changed, 95 insertions, 65 deletions
diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp index 1a106be98b..9905caa92a 100644 --- a/src/gui/kernel/qkeysequence.cpp +++ b/src/gui/kernel/qkeysequence.cpp @@ -1189,7 +1189,7 @@ int QKeySequencePrivate::decodeString(const QString &str, QKeySequence::Sequence QString keyName(tran == 0 ? QCoreApplication::translate("QShortcut", keyname[i].name) : QString::fromLatin1(keyname[i].name)); - if (accelRef == keyName.toLower()) { + if (accelRef == std::move(keyName).toLower()) { ret |= keyname[i].key; found = true; break; diff --git a/src/gui/opengl/qopenglframebufferobject.cpp b/src/gui/opengl/qopenglframebufferobject.cpp index 98ff49ea31..b56bcd0866 100644 --- a/src/gui/opengl/qopenglframebufferobject.cpp +++ b/src/gui/opengl/qopenglframebufferobject.cpp @@ -1282,35 +1282,11 @@ static inline QImage qt_gl_read_framebuffer_rgba8(const QSize &size, bool includ return img; } -#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN - // Without GL_UNSIGNED_INT_8_8_8_8_REV, GL_BGRA only makes sense on little endian. - const bool has_bgra_ext = context->isOpenGLES() - ? context->hasExtension(QByteArrayLiteral("GL_EXT_read_format_bgra")) - : context->hasExtension(QByteArrayLiteral("GL_EXT_bgra")); - -#ifndef Q_OS_IOS - const char *renderer = reinterpret_cast<const char *>(funcs->glGetString(GL_RENDERER)); - const char *ver = reinterpret_cast<const char *>(funcs->glGetString(GL_VERSION)); - - // Blacklist GPU chipsets that have problems with their BGRA support. - const bool blackListed = (qstrcmp(renderer, "PowerVR Rogue G6200") == 0 - && ::strstr(ver, "1.3") != 0) || - (qstrcmp(renderer, "Mali-T760") == 0 - && ::strstr(ver, "3.1") != 0) || - (qstrcmp(renderer, "Mali-T720") == 0 - && ::strstr(ver, "3.1") != 0) || - qstrcmp(renderer, "PowerVR SGX 554") == 0; -#else - const bool blackListed = true; -#endif - const bool supports_bgra = has_bgra_ext && !blackListed; + // For OpenGL ES stick with the byte ordered format / RGBA readback format + // since that is the only spec mandated way. (also, skip the + // GL_IMPLEMENTATION_COLOR_READ_FORMAT mess since there is nothing saying a + // BGRA capable impl would return BGRA from there) - if (supports_bgra) { - QImage img(size, include_alpha ? QImage::Format_ARGB32_Premultiplied : QImage::Format_RGB32); - funcs->glReadPixels(0, 0, w, h, GL_BGRA, GL_UNSIGNED_BYTE, img.bits()); - return img; - } -#endif QImage rgbaImage(size, include_alpha ? QImage::Format_RGBA8888_Premultiplied : QImage::Format_RGBX8888); funcs->glReadPixels(0, 0, w, h, GL_RGBA, GL_UNSIGNED_BYTE, rgbaImage.bits()); return rgbaImage; @@ -1362,8 +1338,11 @@ Q_GUI_EXPORT QImage qt_gl_read_framebuffer(const QSize &size, bool alpha_format, If used together with QOpenGLPaintDevice, \a flipped should be the opposite of the value of QOpenGLPaintDevice::paintFlipped(). - The returned image has a format of premultiplied ARGB32 or RGB32. The latter is used - only when internalTextureFormat() is set to \c GL_RGB. + The returned image has a format of premultiplied ARGB32 or RGB32. The latter + is used only when internalTextureFormat() is set to \c GL_RGB. Since Qt 5.2 + the function will fall back to premultiplied RGBA8888 or RGBx8888 when + reading to (A)RGB32 is not supported, and this includes OpenGL ES. Since Qt + 5.4 an A2BGR30 image is returned if the internal format is RGB10_A2. If the rendering in the framebuffer was not done with premultiplied alpha in mind, create a wrapper QImage with a non-premultiplied format. This is necessary before @@ -1376,10 +1355,6 @@ Q_GUI_EXPORT QImage qt_gl_read_framebuffer(const QSize &size, bool alpha_format, QImage image(fboImage.constBits(), fboImage.width(), fboImage.height(), QImage::Format_ARGB32); \endcode - Since Qt 5.2 the function will fall back to premultiplied RGBA8888 or RGBx8888 when - reading to (A)RGB32 is not supported. Since 5.4 an A2BGR30 image is returned if the - internal format is RGB10_A2. - For multisampled framebuffer objects the samples are resolved using the \c{GL_EXT_framebuffer_blit} extension. If the extension is not available, the contents of the returned image is undefined. diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 8c9d1e1c49..d2a5911767 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -6248,13 +6248,13 @@ inline void qt_memfill_template(T *dest, T color, int count) int n = (count + 7) / 8; switch (count & 0x07) { - case 0: do { *dest++ = color; - case 7: *dest++ = color; - case 6: *dest++ = color; - case 5: *dest++ = color; - case 4: *dest++ = color; - case 3: *dest++ = color; - case 2: *dest++ = color; + case 0: do { *dest++ = color; Q_FALLTHROUGH(); + case 7: *dest++ = color; Q_FALLTHROUGH(); + case 6: *dest++ = color; Q_FALLTHROUGH(); + case 5: *dest++ = color; Q_FALLTHROUGH(); + case 4: *dest++ = color; Q_FALLTHROUGH(); + case 3: *dest++ = color; Q_FALLTHROUGH(); + case 2: *dest++ = color; Q_FALLTHROUGH(); case 1: *dest++ = color; } while (--n > 0); } @@ -6265,7 +6265,7 @@ inline void qt_memfill_template(quint16 *dest, quint16 value, int count) { if (count < 3) { switch (count) { - case 2: *dest++ = value; + case 2: *dest++ = value; Q_FALLTHROUGH(); case 1: *dest = value; } return; diff --git a/src/gui/painting/qdrawhelper_sse2.cpp b/src/gui/painting/qdrawhelper_sse2.cpp index edce70d2d0..3013d2cf3e 100644 --- a/src/gui/painting/qdrawhelper_sse2.cpp +++ b/src/gui/painting/qdrawhelper_sse2.cpp @@ -237,11 +237,11 @@ void qt_memfill32(quint32 *dest, quint32 value, int count) { if (count < 7) { switch (count) { - case 6: *dest++ = value; - case 5: *dest++ = value; - case 4: *dest++ = value; - case 3: *dest++ = value; - case 2: *dest++ = value; + case 6: *dest++ = value; Q_FALLTHROUGH(); + case 5: *dest++ = value; Q_FALLTHROUGH(); + case 4: *dest++ = value; Q_FALLTHROUGH(); + case 3: *dest++ = value; Q_FALLTHROUGH(); + case 2: *dest++ = value; Q_FALLTHROUGH(); case 1: *dest = value; } return; @@ -249,16 +249,16 @@ void qt_memfill32(quint32 *dest, quint32 value, int count) const int align = (quintptr)(dest) & 0xf; switch (align) { - case 4: *dest++ = value; --count; - case 8: *dest++ = value; --count; + case 4: *dest++ = value; --count; Q_FALLTHROUGH(); + case 8: *dest++ = value; --count; Q_FALLTHROUGH(); case 12: *dest++ = value; --count; } const int rest = count & 0x3; if (rest) { switch (rest) { - case 3: dest[count - 3] = value; - case 2: dest[count - 2] = value; + case 3: dest[count - 3] = value; Q_FALLTHROUGH(); + case 2: dest[count - 2] = value; Q_FALLTHROUGH(); case 1: dest[count - 1] = value; } } @@ -277,8 +277,8 @@ void qt_memfill32(quint32 *dest, quint32 value, int count) } switch (count128 & 0x3) { - case 3: _mm_stream_si128(dst128++, value128); - case 2: _mm_stream_si128(dst128++, value128); + case 3: _mm_stream_si128(dst128++, value128); Q_FALLTHROUGH(); + case 2: _mm_stream_si128(dst128++, value128); Q_FALLTHROUGH(); case 1: _mm_stream_si128(dst128++, value128); } } @@ -318,7 +318,7 @@ void qt_memfill16(quint16 *dest, quint16 value, int count) { if (count < 3) { switch (count) { - case 2: *dest++ = value; + case 2: *dest++ = value; Q_FALLTHROUGH(); case 1: *dest = value; } return; diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp index fdbc803174..25e051d739 100644 --- a/src/gui/painting/qpdf.cpp +++ b/src/gui/painting/qpdf.cpp @@ -2308,7 +2308,8 @@ int QPdfEnginePrivate::createShadingFunction(const QGradient *gradient, int from for (int i = 0; i < gradientBounds.size(); ++i) s << gradientBounds.at(i).function << "0 R "; s << "]\n" - ">>\n"; + ">>\n" + "endobj\n"; write(data); } else { function = functions.at(0); 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")) |