From d82d5b1c43b270ef6f4f0d90ce5d7d96ea0b7a97 Mon Sep 17 00:00:00 2001 From: Mikhail Lappo Date: Wed, 3 Jun 2015 10:09:42 +0300 Subject: Check for integer overflows in places where qAllocMore is used Task-number: QTBUG-41230 Change-Id: Ic2167364e326092482657f2d2b4ab6ad3e5af631 (partially cherry-picked from 880986be2357a1f80827d038d770dc2f80300201) Reviewed-by: Thiago Macieira --- src/gui/text/qfragmentmap_p.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/gui') diff --git a/src/gui/text/qfragmentmap_p.h b/src/gui/text/qfragmentmap_p.h index 012d3c25ce..a19e3d9ea3 100644 --- a/src/gui/text/qfragmentmap_p.h +++ b/src/gui/text/qfragmentmap_p.h @@ -249,6 +249,8 @@ uint QFragmentMapData::createFragment() uint freePos = head->freelist; if (freePos == head->allocated) { // need to create some free space + if (freePos >= uint(MaxAllocSize) / fragmentSize) + qBadAlloc(); uint needed = qAllocMore((freePos+1)*fragmentSize, 0); Q_ASSERT(needed/fragmentSize > head->allocated); Fragment *newFragments = (Fragment *)realloc(fragments, needed); -- cgit v1.2.3 From 4a1e5dbade4bab55f39bd368480dcca9a11e4b38 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 9 Jul 2015 09:30:42 +0200 Subject: Better handling of invalid font tables Specifically when reading files with broken cmap tables, we could get some undeterministic results. We handle this more gracefully by verifying that the offsets are sane and bailing out early if not. This replaces the current pattern throughout the font engine for consistency. Change-Id: I507bba49c0be634afca77d1eb3d199a427451bee Reviewed-by: Simon Hausmann Reviewed-by: Thiago Macieira --- src/gui/text/qfontengine.cpp | 212 +++++++++++++++++++++++++++++--------- src/gui/text/qfontengine_p.h | 2 +- src/gui/text/qfontengine_qpf2.cpp | 10 +- 3 files changed, 167 insertions(+), 57 deletions(-) (limited to 'src/gui') diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index b360ed5c85..f973abc8e4 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -74,6 +74,16 @@ static inline bool qtransform_equals_no_translate(const QTransform &a, const QTr } } +template +static inline bool qSafeFromBigEndian(const uchar *source, const uchar *end, T *output) +{ + if (source + sizeof(T) > end) + return false; + + *output = qFromBigEndian(source); + return true; +} + // Harfbuzz helper functions #ifdef QT_ENABLE_HARFBUZZ_NG @@ -1044,26 +1054,38 @@ void QFontEngine::loadKerningPairs(QFixed scalingFactor) return; const uchar *table = reinterpret_cast(tab.constData()); + const uchar *end = table + tab.size(); + + quint16 version; + if (!qSafeFromBigEndian(table, end, &version)) + return; - unsigned short version = qFromBigEndian(table); if (version != 0) { // qDebug("wrong version"); return; } - unsigned short numTables = qFromBigEndian(table + 2); + quint16 numTables; + if (!qSafeFromBigEndian(table + 2, end, &numTables)) + return; + { int offset = 4; for(int i = 0; i < numTables; ++i) { - if (offset + 6 > tab.size()) { -// qDebug("offset out of bounds"); - goto end; - } const uchar *header = table + offset; - ushort version = qFromBigEndian(header); - ushort length = qFromBigEndian(header+2); - ushort coverage = qFromBigEndian(header+4); + quint16 version; + if (!qSafeFromBigEndian(header, end, &version)) + goto end; + + quint16 length; + if (!qSafeFromBigEndian(header + 2, end, &length)) + goto end; + + quint16 coverage; + if (!qSafeFromBigEndian(header + 4, end, &coverage)) + goto end; + // qDebug("subtable: version=%d, coverage=%x",version, coverage); if(version == 0 && coverage == 0x0001) { if (offset + length > tab.size()) { @@ -1072,7 +1094,10 @@ void QFontEngine::loadKerningPairs(QFixed scalingFactor) } const uchar *data = table + offset + 6; - ushort nPairs = qFromBigEndian(data); + quint16 nPairs; + if (!qSafeFromBigEndian(data, end, &nPairs)) + goto end; + if(nPairs * 6 + 8 > length - 6) { // qDebug("corrupt table!"); // corrupt table @@ -1082,8 +1107,21 @@ void QFontEngine::loadKerningPairs(QFixed scalingFactor) int off = 8; for(int i = 0; i < nPairs; ++i) { QFontEngine::KernPair p; - p.left_right = (((uint)qFromBigEndian(data+off)) << 16) + qFromBigEndian(data+off+2); - p.adjust = QFixed(((int)(short)qFromBigEndian(data+off+4))) / scalingFactor; + + quint16 tmp; + if (!qSafeFromBigEndian(data + off, end, &tmp)) + goto end; + + p.left_right = uint(tmp) << 16; + if (!qSafeFromBigEndian(data + off + 2, end, &tmp)) + goto end; + + p.left_right |= tmp; + + if (!qSafeFromBigEndian(data + off + 4, end, &tmp)) + goto end; + + p.adjust = QFixed(int(short(tmp))) / scalingFactor; kerning_pairs.append(p); off += 6; } @@ -1103,26 +1141,31 @@ int QFontEngine::glyphCount() const QByteArray maxpTable = getSfntTable(MAKE_TAG('m', 'a', 'x', 'p')); if (maxpTable.size() < 6) return 0; - return qFromBigEndian(reinterpret_cast(maxpTable.constData() + 4)); + + const uchar *source = reinterpret_cast(maxpTable.constData() + 4); + const uchar *end = source + maxpTable.size(); + + quint16 count = 0; + qSafeFromBigEndian(source, end, &count); + return count; } const uchar *QFontEngine::getCMap(const uchar *table, uint tableSize, bool *isSymbolFont, int *cmapSize) { const uchar *header = table; - if (tableSize < 4) - return 0; - const uchar *endPtr = table + tableSize; // version check - if (qFromBigEndian(header) != 0) + quint16 version; + if (!qSafeFromBigEndian(header, endPtr, &version) || version != 0) return 0; - unsigned short numTables = qFromBigEndian(header + 2); - const uchar *maps = table + 4; - if (maps + 8 * numTables > endPtr) + quint16 numTables; + if (!qSafeFromBigEndian(header + 2, endPtr, &numTables)) return 0; + const uchar *maps = table + 4; + enum { Invalid, AppleRoman, @@ -1137,8 +1180,14 @@ const uchar *QFontEngine::getCMap(const uchar *table, uint tableSize, bool *isSy int tableToUse = -1; int score = Invalid; for (int n = 0; n < numTables; ++n) { - const quint16 platformId = qFromBigEndian(maps + 8 * n); - const quint16 platformSpecificId = qFromBigEndian(maps + 8 * n + 2); + quint16 platformId; + if (!qSafeFromBigEndian(maps + 8 * n, endPtr, &platformId)) + return 0; + + quint16 platformSpecificId; + if (!qSafeFromBigEndian(maps + 8 * n + 2, endPtr, &platformSpecificId)) + return 0; + switch (platformId) { case 0: // Unicode if (score < Unicode && @@ -1192,20 +1241,30 @@ const uchar *QFontEngine::getCMap(const uchar *table, uint tableSize, bool *isSy resolveTable: *isSymbolFont = (symbolTable > -1); - unsigned int unicode_table = qFromBigEndian(maps + 8*tableToUse + 4); + quint32 unicode_table; + if (!qSafeFromBigEndian(maps + 8 * tableToUse + 4, endPtr, &unicode_table)) + return 0; - if (!unicode_table || unicode_table + 8 > tableSize) + if (!unicode_table) return 0; // get the header of the unicode table header = table + unicode_table; - unsigned short format = qFromBigEndian(header); - unsigned int length; - if(format < 8) - length = qFromBigEndian(header + 2); - else - length = qFromBigEndian(header + 4); + quint16 format; + if (!qSafeFromBigEndian(header, endPtr, &format)) + return 0; + + quint32 length; + if (format < 8) { + quint16 tmp; + if (!qSafeFromBigEndian(header + 2, endPtr, &tmp)) + return 0; + length = tmp; + } else { + if (!qSafeFromBigEndian(header + 4, endPtr, &length)) + return 0; + } if (table + unicode_table + length > endPtr) return 0; @@ -1220,7 +1279,7 @@ resolveTable: // Check that none of the latin1 range are in the unicode table bool unicodeTableHasLatin1 = false; for (int uc=0x00; uc<0x100; ++uc) { - if (getTrueTypeGlyphIndex(selectedTable, uc) != 0) { + if (getTrueTypeGlyphIndex(selectedTable, length, uc) != 0) { unicodeTableHasLatin1 = true; break; } @@ -1230,7 +1289,7 @@ resolveTable: bool unicodeTableHasSymbols = false; if (!unicodeTableHasLatin1) { for (int uc=0xf000; uc<0xf100; ++uc) { - if (getTrueTypeGlyphIndex(selectedTable, uc) != 0) { + if (getTrueTypeGlyphIndex(selectedTable, length, uc) != 0) { unicodeTableHasSymbols = true; break; } @@ -1248,12 +1307,17 @@ resolveTable: return table + unicode_table; } -quint32 QFontEngine::getTrueTypeGlyphIndex(const uchar *cmap, uint unicode) +quint32 QFontEngine::getTrueTypeGlyphIndex(const uchar *cmap, int cmapSize, uint unicode) { - unsigned short format = qFromBigEndian(cmap); + const uchar *end = cmap + cmapSize; + quint16 format; + if (!qSafeFromBigEndian(cmap, end, &format)) + return 0; + if (format == 0) { - if (unicode < 256) - return (int) *(cmap+6+unicode); + const uchar *ptr = cmap + 6 + unicode; + if (unicode < 256 && ptr < end) + return quint32(*ptr); } else if (format == 4) { /* some fonts come with invalid cmap tables, where the last segment specified end = start = rangeoffset = 0xffff, delta = 0x0001 @@ -1262,25 +1326,49 @@ quint32 QFontEngine::getTrueTypeGlyphIndex(const uchar *cmap, uint unicode) */ if(unicode >= 0xffff) return 0; - quint16 segCountX2 = qFromBigEndian(cmap + 6); + + quint16 segCountX2; + if (!qSafeFromBigEndian(cmap + 6, end, &segCountX2)) + return 0; + const unsigned char *ends = cmap + 14; + int i = 0; - for (; i < segCountX2/2 && qFromBigEndian(ends + 2*i) < unicode; i++) {} + for (; i < segCountX2/2; ++i) { + quint16 codePoint; + if (!qSafeFromBigEndian(ends + 2 * i, end, &codePoint)) + return 0; + if (codePoint >= unicode) + break; + } const unsigned char *idx = ends + segCountX2 + 2 + 2*i; - quint16 startIndex = qFromBigEndian(idx); + quint16 startIndex; + if (!qSafeFromBigEndian(idx, end, &startIndex)) + return 0; if (startIndex > unicode) return 0; idx += segCountX2; - qint16 idDelta = (qint16)qFromBigEndian(idx); + + quint16 tmp; + if (!qSafeFromBigEndian(idx, end, &tmp)) + return 0; + qint16 idDelta = qint16(tmp); + idx += segCountX2; - quint16 idRangeoffset_t = (quint16)qFromBigEndian(idx); + + quint16 idRangeoffset_t; + if (!qSafeFromBigEndian(idx, end, &idRangeoffset_t)) + return 0; quint16 glyphIndex; if (idRangeoffset_t) { - quint16 id = qFromBigEndian(idRangeoffset_t + 2*(unicode - startIndex) + idx); + quint16 id; + if (!qSafeFromBigEndian(idRangeoffset_t + 2 * (unicode - startIndex) + idx, end, &id)) + return 0; + if (id) glyphIndex = (idDelta + id) % 0x10000; else @@ -1290,13 +1378,19 @@ quint32 QFontEngine::getTrueTypeGlyphIndex(const uchar *cmap, uint unicode) } return glyphIndex; } else if (format == 6) { - quint16 tableSize = qFromBigEndian(cmap + 2); + quint16 tableSize; + if (!qSafeFromBigEndian(cmap + 2, end, &tableSize)) + return 0; - quint16 firstCode6 = qFromBigEndian(cmap + 6); + quint16 firstCode6; + if (!qSafeFromBigEndian(cmap + 6, end, &firstCode6)) + return 0; if (unicode < firstCode6) return 0; - quint16 entryCount6 = qFromBigEndian(cmap + 8); + quint16 entryCount6; + if (!qSafeFromBigEndian(cmap + 8, end, &entryCount6)) + return 0; if (entryCount6 * 2 + 10 > tableSize) return 0; @@ -1305,9 +1399,14 @@ quint32 QFontEngine::getTrueTypeGlyphIndex(const uchar *cmap, uint unicode) return 0; quint16 entryIndex6 = unicode - firstCode6; - return qFromBigEndian(cmap + 10 + (entryIndex6 * 2)); + + quint16 index = 0; + qSafeFromBigEndian(cmap + 10 + (entryIndex6 * 2), end, &index); + return index; } else if (format == 12) { - quint32 nGroups = qFromBigEndian(cmap + 12); + quint32 nGroups; + if (!qSafeFromBigEndian(cmap + 12, end, &nGroups)) + return 0; cmap += 16; // move to start of groups @@ -1315,13 +1414,24 @@ quint32 QFontEngine::getTrueTypeGlyphIndex(const uchar *cmap, uint unicode) while (left <= right) { int middle = left + ( ( right - left ) >> 1 ); - quint32 startCharCode = qFromBigEndian(cmap + 12*middle); + quint32 startCharCode; + if (!qSafeFromBigEndian(cmap + 12 * middle, end, &startCharCode)) + return 0; + if(unicode < startCharCode) right = middle - 1; else { - quint32 endCharCode = qFromBigEndian(cmap + 12*middle + 4); - if(unicode <= endCharCode) - return qFromBigEndian(cmap + 12*middle + 8) + unicode - startCharCode; + quint32 endCharCode; + if (!qSafeFromBigEndian(cmap + 12 * middle + 4, end, &endCharCode)) + return 0; + + if (unicode <= endCharCode) { + quint32 index; + if (!qSafeFromBigEndian(cmap + 12 * middle + 8, end, &index)) + return 0; + + return index + unicode - startCharCode; + } left = middle + 1; } } diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h index 9364b82bed..423b9413ed 100644 --- a/src/gui/text/qfontengine_p.h +++ b/src/gui/text/qfontengine_p.h @@ -243,7 +243,7 @@ public: QFontEngineGlyphCache *glyphCache(const void *key, GlyphFormat format, const QTransform &transform) const; static const uchar *getCMap(const uchar *table, uint tableSize, bool *isSymbolFont, int *cmapSize); - static quint32 getTrueTypeGlyphIndex(const uchar *cmap, uint unicode); + static quint32 getTrueTypeGlyphIndex(const uchar *cmap, int cmapSize, uint unicode); static QByteArray convertToPostscriptFontFamilyName(const QByteArray &fontFamily); diff --git a/src/gui/text/qfontengine_qpf2.cpp b/src/gui/text/qfontengine_qpf2.cpp index 4785902c99..4bb27c4d51 100644 --- a/src/gui/text/qfontengine_qpf2.cpp +++ b/src/gui/text/qfontengine_qpf2.cpp @@ -322,9 +322,9 @@ bool QFontEngineQPF2::getSfntTableData(uint tag, uchar *buffer, uint *length) co glyph_t QFontEngineQPF2::glyphIndex(uint ucs4) const { - glyph_t glyph = getTrueTypeGlyphIndex(cmap, ucs4); + glyph_t glyph = getTrueTypeGlyphIndex(cmap, cmapSize, ucs4); if (glyph == 0 && symbol && ucs4 < 0x100) - glyph = getTrueTypeGlyphIndex(cmap, ucs4 + 0xf000); + glyph = getTrueTypeGlyphIndex(cmap, cmapSize, ucs4 + 0xf000); if (!findGlyph(glyph)) glyph = 0; @@ -348,16 +348,16 @@ bool QFontEngineQPF2::stringToCMap(const QChar *str, int len, QGlyphLayout *glyp QStringIterator it(str, str + len); while (it.hasNext()) { const uint uc = it.next(); - glyphs->glyphs[glyph_pos] = getTrueTypeGlyphIndex(cmap, uc); + glyphs->glyphs[glyph_pos] = getTrueTypeGlyphIndex(cmap, cmapSize, uc); if(!glyphs->glyphs[glyph_pos] && uc < 0x100) - glyphs->glyphs[glyph_pos] = getTrueTypeGlyphIndex(cmap, uc + 0xf000); + glyphs->glyphs[glyph_pos] = getTrueTypeGlyphIndex(cmap, cmapSize, uc + 0xf000); ++glyph_pos; } } else { QStringIterator it(str, str + len); while (it.hasNext()) { const uint uc = it.next(); - glyphs->glyphs[glyph_pos] = getTrueTypeGlyphIndex(cmap, uc); + glyphs->glyphs[glyph_pos] = getTrueTypeGlyphIndex(cmap, cmapSize, uc); #if 0 && defined(DEBUG_FONTENGINE) QChar c(uc); if (!findGlyph(glyphs[glyph_pos].glyph) && !seenGlyphs.contains(c)) -- cgit v1.2.3 From e92c2e119beb06e3ef47ae6fd871b34ec0ef0939 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Fri, 7 Aug 2015 15:37:07 +0200 Subject: Improve readability of QTextLine's handling of (negative) right bearing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Helper functions in LineBreakHelper have been renamed from adjustFoo to calculateFoo, to signal that they do work, and are not adjusting something relative to something else. - The use of QFixed(1) and >= 0 has been replaced with an explicit constant for the case of the bearing not being calculated yet. - A helper function negativeRightBearing() has been added that returns the absolute value of any negative right bearing, making the width computations simpler. - Comments have been added and rewritten to make the logic clearer. Change-Id: I1d3a0214cfa8b4fed4551f3444b43a37d55bd69b Reviewed-by: Eskil Abrahamsen Blomfeldt Reviewed-by: Tor Arne Vestbø --- src/gui/text/qtextlayout.cpp | 81 ++++++++++++++++++++++++++++++-------------- 1 file changed, 55 insertions(+), 26 deletions(-) (limited to 'src/gui') diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index 7da3e84041..013cd8ae0f 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -1605,8 +1605,8 @@ namespace { bool checkFullOtherwiseExtend(QScriptLine &line); QFixed calculateNewWidth(const QScriptLine &line) const { - return line.textWidth + tmpData.textWidth + spaceData.textWidth + softHyphenWidth - - qMin(rightBearing, QFixed()); + return line.textWidth + tmpData.textWidth + spaceData.textWidth + + softHyphenWidth + negativeRightBearing(); } inline glyph_t currentGlyph() const @@ -1626,33 +1626,51 @@ namespace { } } - inline void adjustRightBearing(glyph_t glyph) + inline void calculateRightBearing(glyph_t glyph) { qreal rb; fontEngine->getGlyphBearings(glyph, 0, &rb); - rightBearing = qMin(QFixed(), QFixed::fromReal(rb)); + + // We only care about negative right bearings, so we limit the range + // of the bearing here so that we can assume it's negative in the rest + // of the code, as well ase use QFixed(1) as a sentinel to represent + // the state where we have yet to compute the right bearing. + rightBearing = qMin(QFixed::fromReal(rb), QFixed(0)); } - inline void adjustRightBearing() + inline void calculateRightBearing() { if (currentPosition <= 0) return; - adjustRightBearing(currentGlyph()); + calculateRightBearing(currentGlyph()); } - inline void adjustPreviousRightBearing() + inline void calculateRightBearingForPreviousGlyph() { if (previousGlyph > 0) - adjustRightBearing(previousGlyph); + calculateRightBearing(previousGlyph); } + static const QFixed RightBearingNotCalculated; + inline void resetRightBearing() { - rightBearing = QFixed(1); // Any positive number is defined as invalid since only - // negative right bearings are interesting to us. + rightBearing = RightBearingNotCalculated; + } + + // We express the negative right bearing as an absolute number + // so that it can be applied to the width using addition. + inline QFixed negativeRightBearing() const + { + if (rightBearing == RightBearingNotCalculated) + return QFixed(0); + + return qAbs(rightBearing); } }; +const QFixed LineBreakHelper::RightBearingNotCalculated = QFixed(1); + inline bool LineBreakHelper::checkFullOtherwiseExtend(QScriptLine &line) { LB_DEBUG("possible break width %f, spacew=%f", tmpData.textWidth.toReal(), spaceData.textWidth.toReal()); @@ -1805,7 +1823,7 @@ void QTextLine::layout_helper(int maxGlyphs) current, lbh.logClusters, lbh.glyphs); } else { lbh.tmpData.length++; - lbh.adjustPreviousRightBearing(); + lbh.calculateRightBearingForPreviousGlyph(); } line += lbh.tmpData; goto found; @@ -1887,22 +1905,29 @@ void QTextLine::layout_helper(int maxGlyphs) lbh.tmpData.textWidth += lbh.glyphs.advances[lbh.logClusters[lbh.currentPosition - 1]]; } - // The actual width of the text needs to take the right bearing into account. The - // right bearing is left-ward, which means that if the rightmost pixel is to the right - // of the advance of the glyph, the bearing will be negative. We flip the sign - // for the code to be more readable. Logic borrowed from qfontmetrics.cpp. - // We ignore the right bearing if the minimum negative bearing is too little to - // expand the text beyond the edge. if (sb_or_ws|breakany) { - QFixed rightBearing = lbh.rightBearing; // store previous right bearing + // To compute the final width of the text we need to take negative right bearing + // into account (negative right bearing means the glyph has pixel data past the + // advance length). Note that the negative right bearing is an absolute number, + // so that we can apply it to the width using straight forward addition. + + // Store previous right bearing (for the already accepted glyph) in case we + // end up breaking due to the current glyph being too wide. + QFixed previousRightBearing = lbh.rightBearing; + + // We ignore the right bearing if the minimum negative bearing is too little to + // expand the text beyond the edge. if (lbh.calculateNewWidth(line) - lbh.minimumRightBearing > line.width) - lbh.adjustRightBearing(); + lbh.calculateRightBearing(); + if (lbh.checkFullOtherwiseExtend(line)) { - // we are too wide, fix right bearing - if (rightBearing <= 0) - lbh.rightBearing = rightBearing; // take from cache + // We are too wide to accept the next glyph with its bearing, so we restore the + // right bearing to that of the previous glyph (the one that was already accepted), + // so that the bearing can be be applied to the final width of the text below. + if (previousRightBearing != LineBreakHelper::RightBearingNotCalculated) + lbh.rightBearing = previousRightBearing; else - lbh.adjustPreviousRightBearing(); + lbh.calculateRightBearingForPreviousGlyph(); if (!breakany) { line.textWidth += lbh.softHyphenWidth; @@ -1919,10 +1944,14 @@ void QTextLine::layout_helper(int maxGlyphs) LB_DEBUG("reached end of line"); lbh.checkFullOtherwiseExtend(line); found: - if (lbh.rightBearing > 0 && !lbh.whiteSpaceOrObject) // If right bearing has not yet been adjusted - lbh.adjustRightBearing(); line.textAdvance = line.textWidth; - line.textWidth -= qMin(QFixed(), lbh.rightBearing); + + // If right bearing has not been calculated yet, do that now + if (lbh.rightBearing == LineBreakHelper::RightBearingNotCalculated && !lbh.whiteSpaceOrObject) + lbh.calculateRightBearing(); + + // Then apply any negative right bearing + line.textWidth += lbh.negativeRightBearing(); if (line.length == 0) { LB_DEBUG("no break available in line, adding temp: length %d, width %f, space: length %d, width %f", -- cgit v1.2.3 From 01c15a94387f8791e2bd600519de98bd0e03f266 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Tue, 14 Jul 2015 15:32:40 +0200 Subject: Always return grayscale indexed8 from QImage::alphaChannel() We shouldn't short-cut alpha8 formats in alphaChannel, the method is used under the assumption that the returned alpha map has encoded the alphas as an indexed grayscale image. The method is also documented as not returning alpha8. Task-number: QTBUG-47138 Change-Id: I1cf16957d12e65d44f2b586d9f127fcb33c549b6 Reviewed-by: Friedemann Kleint Reviewed-by: Gunnar Sletta --- src/gui/image/qimage.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/gui') diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 08eb759ec2..176cdfe09f 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -4134,9 +4134,6 @@ QImage QImage::alphaChannel() const if (!d) return QImage(); - if (d->format == QImage::Format_Alpha8) - return *this; - int w = d->width; int h = d->height; @@ -4166,6 +4163,10 @@ QImage QImage::alphaChannel() const src_data += d->bytes_per_line; dest_data += image.d->bytes_per_line; } + } else if (d->format == Format_Alpha8) { + const uchar *src_data = d->data; + uchar *dest_data = image.d->data; + memcpy(dest_data, src_data, d->bytes_per_line * h); } else { QImage alpha32 = *this; bool canSkipConversion = (d->format == Format_ARGB32 || d->format == Format_ARGB32_Premultiplied); -- cgit v1.2.3 From bec8c726bf76cda94f73efc76fef6bcea5bc133a Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Sat, 25 Jul 2015 14:43:14 +0200 Subject: Fix out-of-buffer read on image upscale Avoid reading from the next pixel when the sample is fully based on the current pixel. This is particular important for the last pixel in an image when the next pixel might be outside the image buffer. Change-Id: I3607f9c6c332d11ff944ca35d216d417368f9fd5 Task-number: QTBUG-47228 Reviewed-by: Konstantin Ritt Reviewed-by: Gunnar Sletta --- src/gui/painting/qimagescale.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/gui') diff --git a/src/gui/painting/qimagescale.cpp b/src/gui/painting/qimagescale.cpp index 867c64c5e0..2f85e90c49 100644 --- a/src/gui/painting/qimagescale.cpp +++ b/src/gui/painting/qimagescale.cpp @@ -312,7 +312,10 @@ static void qt_qimageScaleAARGBA_up_xy(QImageScaleInfo *isi, unsigned int *dest, for (int x = dxx; x < end; x++) { const unsigned int *pix = sptr + xpoints[x]; const int xap = xapoints[x]; - *dptr = INTERPOLATE_PIXEL_256(pix[0], 256 - xap, pix[1], xap); + if (xap > 0) + *dptr = INTERPOLATE_PIXEL_256(pix[0], 256 - xap, pix[1], xap); + else + *dptr = pix[0]; dptr++; } } -- cgit v1.2.3 From 2366ca059e6c4b8ae93a125eb8df8f660275d527 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 11 Aug 2015 00:48:14 -0700 Subject: Fix warning about unused local variables qopenglengineshadermanager.cpp(430): warning #177: variable "none" was declared but never referenced qopenglengineshadermanager.cpp(431): warning #177: variable "br" was declared but never referenced Change-Id: I7de033f80b0e4431b7f1ffff13f958e4a4cca16e Reviewed-by: David Faure Reviewed-by: Laszlo Agocs --- src/gui/opengl/qopenglengineshadermanager.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/gui') diff --git a/src/gui/opengl/qopenglengineshadermanager.cpp b/src/gui/opengl/qopenglengineshadermanager.cpp index 7e53c01cba..40f4ce94c2 100644 --- a/src/gui/opengl/qopenglengineshadermanager.cpp +++ b/src/gui/opengl/qopenglengineshadermanager.cpp @@ -427,11 +427,10 @@ QOpenGLEngineShaderProg *QOpenGLEngineSharedShaders::findProgramInCache(const QO if (!inCache) shaderCache.store(newProg->program, QOpenGLContext::currentContext()); } else { - QLatin1String none("none"); - QLatin1String br("\n"); QString error; error = QLatin1String("Shader program failed to link,"); #if defined(QT_DEBUG) + QLatin1String br("\n"); error += QLatin1String("\n Shaders Used:\n"); for (int i = 0; i < newProg->program->shaders().count(); ++i) { QOpenGLShader *shader = newProg->program->shaders().at(i); -- cgit v1.2.3 From 6d8c7a61f52f4169eb3587d3da896efed0083dea Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 11 Aug 2015 00:09:46 -0700 Subject: Fix -Wcast-qual warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit qwidget.cpp:12864:70: error: cast from type ‘const QWidget*’ to type ‘void*’ casts away qualifiers [-Werror=cast-qual] Change-Id: I7de033f80b0e4431b7f1ffff13f956cb26108af7 Reviewed-by: Martin Smith --- src/gui/kernel/qscreen.cpp | 2 +- src/gui/kernel/qwindow.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/gui') diff --git a/src/gui/kernel/qscreen.cpp b/src/gui/kernel/qscreen.cpp index 407b4ee9b6..b6b50372ae 100644 --- a/src/gui/kernel/qscreen.cpp +++ b/src/gui/kernel/qscreen.cpp @@ -698,7 +698,7 @@ Q_GUI_EXPORT QDebug operator<<(QDebug debug, const QScreen *screen) { const QDebugStateSaver saver(debug); debug.nospace(); - debug << "QScreen(" << (void *)screen; + debug << "QScreen(" << (const void *)screen; if (screen) { debug << ", name=" << screen->name(); if (debug.verbosity() > 2) { diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index e93e964c6b..89bd119564 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -2508,7 +2508,7 @@ QDebug operator<<(QDebug debug, const QWindow *window) QDebugStateSaver saver(debug); debug.nospace(); if (window) { - debug << window->metaObject()->className() << '(' << (void *)window; + debug << window->metaObject()->className() << '(' << (const void *)window; if (!window->objectName().isEmpty()) debug << ", name=" << window->objectName(); if (debug.verbosity() > 2) { -- cgit v1.2.3 From 08150122aaf0e1da706346497cf9767534a455b0 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Tue, 11 Aug 2015 15:09:47 +0200 Subject: Do not add GLSL line statements for old drivers Older VMware virtual machines do not like the #line statements. These were introduced in 5.5.0, meaning that when upgrading from 5.4 in such a VM, shader compilation via QOpenGLShaderProgram stops working. This should be avoided. Task-number: QTBUG-47598 Change-Id: I8cccd76119350e7ce40da96d24a7a6e9eb399052 Reviewed-by: Sean Harmer --- src/gui/opengl/qopenglshaderprogram.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'src/gui') diff --git a/src/gui/opengl/qopenglshaderprogram.cpp b/src/gui/opengl/qopenglshaderprogram.cpp index 5de79c9e1e..04b796ddb0 100644 --- a/src/gui/opengl/qopenglshaderprogram.cpp +++ b/src/gui/opengl/qopenglshaderprogram.cpp @@ -525,7 +525,8 @@ bool QOpenGLShader::compileSourceCode(const char *source) // The precision qualifiers are useful on OpenGL/ES systems, // but usually not present on desktop systems. - const QSurfaceFormat currentSurfaceFormat = QOpenGLContext::currentContext()->format(); + QOpenGLContext *ctx = QOpenGLContext::currentContext(); + const QSurfaceFormat currentSurfaceFormat = ctx->format(); QOpenGLContextPrivate *ctx_d = QOpenGLContextPrivate::get(QOpenGLContext::currentContext()); if (currentSurfaceFormat.renderableType() == QSurfaceFormat::OpenGL || ctx_d->workaround_missingPrecisionQualifiers @@ -545,10 +546,16 @@ bool QOpenGLShader::compileSourceCode(const char *source) } #endif - // Append #line directive in order to compensate for text insertion - QByteArray lineDirective = QStringLiteral("#line %1\n").arg(versionDirectivePosition.line).toUtf8(); - sourceChunks.append(lineDirective.constData()); - sourceChunkLengths.append(GLint(lineDirective.length())); + QByteArray lineDirective; + // #line is rejected by some drivers: + // "2.1 Mesa 8.1-devel (git-48a3d4e)" or "MESA 2.1 Mesa 8.1-devel" + const char *version = reinterpret_cast(ctx->functions()->glGetString(GL_VERSION)); + if (!version || !strstr(version, "2.1 Mesa 8")) { + // Append #line directive in order to compensate for text insertion + lineDirective = QStringLiteral("#line %1\n").arg(versionDirectivePosition.line).toUtf8(); + sourceChunks.append(lineDirective.constData()); + sourceChunkLengths.append(GLint(lineDirective.length())); + } // Append rest of shader code sourceChunks.append(source + versionDirectivePosition.position); -- cgit v1.2.3 From be18d6fb01749184d40cdcd079e685d220ff8b80 Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Thu, 18 Sep 2014 16:16:26 +0400 Subject: Fix shortcuts with keypad keys The way of searching a shortcut match for a key without the keypad modifier introduced in 547a1bea492954d828aa0798be93384669812489 is not correct. QKeyEvent::setModifiers() doesn't change native scan code so we get the incorrect QKeyEvent object which is eventually passed to the implementation of QPlatformIntegration::possibleKeys(). And then QPlatformIntegration::possibleKeys() returns the same result as for the original QKeyEvent object. So to fix it we have to remove Qt::KeypadModifier from keys after calling the implementation of QPlatformIntegration::possibleKeys(), as it was before 547a1bea492954d828aa0798be93384669812489. Task-number: QTBUG-33093 Task-number: QTBUG-44577 Change-Id: I5b33c9b6cf2c06b133166a31eba9aff9181c9483 Reviewed-by: Gunnar Sletta --- src/gui/kernel/qshortcutmap.cpp | 12 +++++------- src/gui/kernel/qshortcutmap_p.h | 4 ++-- 2 files changed, 7 insertions(+), 9 deletions(-) (limited to 'src/gui') diff --git a/src/gui/kernel/qshortcutmap.cpp b/src/gui/kernel/qshortcutmap.cpp index 0ff5c36119..3e267f2e0b 100644 --- a/src/gui/kernel/qshortcutmap.cpp +++ b/src/gui/kernel/qshortcutmap.cpp @@ -386,9 +386,7 @@ QKeySequence::SequenceMatch QShortcutMap::nextState(QKeyEvent *e) result = find(e); if (result == QKeySequence::NoMatch && (e->modifiers() & Qt::KeypadModifier)) { // Try to find a match without keypad modifier - QKeyEvent event = *e; - event.setModifiers(e->modifiers() & ~Qt::KeypadModifier); - result = find(&event); + result = find(e, Qt::KeypadModifier); } if (result == QKeySequence::NoMatch && e->modifiers() & Qt::ShiftModifier) { // If Shift + Key_Backtab, also try Shift + Qt::Key_Tab @@ -441,13 +439,13 @@ bool QShortcutMap::hasShortcutForKeySequence(const QKeySequence &seq) const which can be access through matches(). \sa matches */ -QKeySequence::SequenceMatch QShortcutMap::find(QKeyEvent *e) +QKeySequence::SequenceMatch QShortcutMap::find(QKeyEvent *e, int ignoredModifiers) { Q_D(QShortcutMap); if (!d->sequences.count()) return QKeySequence::NoMatch; - createNewSequences(e, d->newEntries); + createNewSequences(e, d->newEntries, ignoredModifiers); #if defined(DEBUG_QSHORTCUTMAP) qDebug() << "Possible shortcut key sequences:" << d->newEntries; #endif @@ -549,7 +547,7 @@ void QShortcutMap::clearSequence(QVector &ksl) Alters \a seq to the new sequence state, based on the current sequence state, and the new key event \a e. */ -void QShortcutMap::createNewSequences(QKeyEvent *e, QVector &ksl) +void QShortcutMap::createNewSequences(QKeyEvent *e, QVector &ksl, int ignoredModifiers) { Q_D(QShortcutMap); QList possibleKeys = QKeyMapper::possibleKeys(e); @@ -579,7 +577,7 @@ void QShortcutMap::createNewSequences(QKeyEvent *e, QVector &ksl) curKsl.setKey(0, 2); curKsl.setKey(0, 3); } - curKsl.setKey(possibleKeys.at(pkNum), index); + curKsl.setKey(possibleKeys.at(pkNum) & ~ignoredModifiers, index); } } } diff --git a/src/gui/kernel/qshortcutmap_p.h b/src/gui/kernel/qshortcutmap_p.h index 242c021ca4..2376d27c78 100644 --- a/src/gui/kernel/qshortcutmap_p.h +++ b/src/gui/kernel/qshortcutmap_p.h @@ -88,10 +88,10 @@ private: QKeySequence::SequenceMatch state(); void dispatchEvent(QKeyEvent *e); - QKeySequence::SequenceMatch find(QKeyEvent *e); + QKeySequence::SequenceMatch find(QKeyEvent *e, int ignoredModifiers = 0); QKeySequence::SequenceMatch matches(const QKeySequence &seq1, const QKeySequence &seq2) const; QVector matches() const; - void createNewSequences(QKeyEvent *e, QVector &ksl); + void createNewSequences(QKeyEvent *e, QVector &ksl, int ignoredModifiers); void clearSequence(QVector &ksl); int translateModifiers(Qt::KeyboardModifiers modifiers); -- cgit v1.2.3 From fae725d45183f44fce93826df66e2f1ab2b6fa74 Mon Sep 17 00:00:00 2001 From: Joni Poikelin Date: Thu, 2 Jul 2015 13:28:29 +0300 Subject: Fix potential SIGFPEs in QRasterizer::rasterizeLine() Task-number: QTBUG-46985 Change-Id: If9897a6d4014dbcbc1f6cac1c6dd5dc648694b96 Reviewed-by: Gunnar Sletta --- src/gui/painting/qrasterizer.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'src/gui') diff --git a/src/gui/painting/qrasterizer.cpp b/src/gui/painting/qrasterizer.cpp index 75bf31cde1..34d72bf493 100644 --- a/src/gui/painting/qrasterizer.cpp +++ b/src/gui/painting/qrasterizer.cpp @@ -863,8 +863,8 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width, const Q16Dot16 iLeft = int(left); const Q16Dot16 iRight = int(right); const Q16Dot16 leftWidth = IntToQ16Dot16(iLeft + 1) - - FloatToQ16Dot16(left); - const Q16Dot16 rightWidth = FloatToQ16Dot16(right) + - qSafeFloatToQ16Dot16(left); + const Q16Dot16 rightWidth = qSafeFloatToQ16Dot16(right) - IntToQ16Dot16(iRight); Q16Dot16 coverage[3]; @@ -898,8 +898,8 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width, const Q16Dot16 iTopFP = IntToQ16Dot16(int(pa.y())); const Q16Dot16 iBottomFP = IntToQ16Dot16(int(pb.y())); - const Q16Dot16 yPa = FloatToQ16Dot16(pa.y()); - const Q16Dot16 yPb = FloatToQ16Dot16(pb.y()); + const Q16Dot16 yPa = qSafeFloatToQ16Dot16(pa.y()); + const Q16Dot16 yPb = qSafeFloatToQ16Dot16(pb.y()); for (Q16Dot16 yFP = iTopFP; yFP <= iBottomFP; yFP += Q16Dot16Factor) { const Q16Dot16 rowHeight = qMin(yFP + Q16Dot16Factor, yPb) - qMax(yFP, yPa); @@ -983,16 +983,16 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width, const Q16Dot16 iRightFP = IntToQ16Dot16(int(right.y())); const Q16Dot16 iBottomFP = IntToQ16Dot16(int(bottomBound)); - Q16Dot16 leftIntersectAf = FloatToQ16Dot16(top.x() + (int(topBound) - top.y()) * topLeftSlope); - Q16Dot16 rightIntersectAf = FloatToQ16Dot16(top.x() + (int(topBound) - top.y()) * topRightSlope); + Q16Dot16 leftIntersectAf = qSafeFloatToQ16Dot16(top.x() + (int(topBound) - top.y()) * topLeftSlope); + Q16Dot16 rightIntersectAf = qSafeFloatToQ16Dot16(top.x() + (int(topBound) - top.y()) * topRightSlope); Q16Dot16 leftIntersectBf = 0; Q16Dot16 rightIntersectBf = 0; if (iLeftFP < iTopFP) - leftIntersectBf = FloatToQ16Dot16(left.x() + (int(topBound) - left.y()) * bottomLeftSlope); + leftIntersectBf = qSafeFloatToQ16Dot16(left.x() + (int(topBound) - left.y()) * bottomLeftSlope); if (iRightFP < iTopFP) - rightIntersectBf = FloatToQ16Dot16(right.x() + (int(topBound) - right.y()) * bottomRightSlope); + rightIntersectBf = qSafeFloatToQ16Dot16(right.x() + (int(topBound) - right.y()) * bottomRightSlope); Q16Dot16 rowTop, rowBottomLeft, rowBottomRight, rowTopLeft, rowTopRight, rowBottom; Q16Dot16 topLeftIntersectAf, topLeftIntersectBf, topRightIntersectAf, topRightIntersectBf; @@ -1000,10 +1000,10 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width, int leftMin, leftMax, rightMin, rightMax; - const Q16Dot16 yTopFP = FloatToQ16Dot16(top.y()); - const Q16Dot16 yLeftFP = FloatToQ16Dot16(left.y()); - const Q16Dot16 yRightFP = FloatToQ16Dot16(right.y()); - const Q16Dot16 yBottomFP = FloatToQ16Dot16(bottom.y()); + const Q16Dot16 yTopFP = qSafeFloatToQ16Dot16(top.y()); + const Q16Dot16 yLeftFP = qSafeFloatToQ16Dot16(left.y()); + const Q16Dot16 yRightFP = qSafeFloatToQ16Dot16(right.y()); + const Q16Dot16 yBottomFP = qSafeFloatToQ16Dot16(bottom.y()); rowTop = qMax(iTopFP, yTopFP); topLeftIntersectAf = leftIntersectAf + @@ -1021,7 +1021,7 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width, if (yFP == iLeftFP) { const int y = Q16Dot16ToInt(yFP); - leftIntersectBf = FloatToQ16Dot16(left.x() + (y - left.y()) * bottomLeftSlope); + leftIntersectBf = qSafeFloatToQ16Dot16(left.x() + (y - left.y()) * bottomLeftSlope); topLeftIntersectBf = leftIntersectBf + Q16Dot16Multiply(bottomLeftSlopeFP, rowTopLeft - yFP); bottomLeftIntersectAf = leftIntersectAf + Q16Dot16Multiply(topLeftSlopeFP, rowBottomLeft - yFP); } else { @@ -1031,7 +1031,7 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width, if (yFP == iRightFP) { const int y = Q16Dot16ToInt(yFP); - rightIntersectBf = FloatToQ16Dot16(right.x() + (y - right.y()) * bottomRightSlope); + rightIntersectBf = qSafeFloatToQ16Dot16(right.x() + (y - right.y()) * bottomRightSlope); topRightIntersectBf = rightIntersectBf + Q16Dot16Multiply(bottomRightSlopeFP, rowTopRight - yFP); bottomRightIntersectAf = rightIntersectAf + Q16Dot16Multiply(topRightSlopeFP, rowBottomRight - yFP); } else { -- cgit v1.2.3 From 6a57a260fc1ce8250fef4ed6e0242ac933c7ee56 Mon Sep 17 00:00:00 2001 From: Julien Brianceau Date: Tue, 18 Aug 2015 10:48:26 +0200 Subject: Doc: remove type() reference from QApplication and QGuiApplication QApplication::type() is gone since Qt 5.0. Task-number: QTBUG-28093 Change-Id: I8700c69a42271e8b99f3e86a5014c8abf7711f53 Reviewed-by: Friedemann Kleint --- src/gui/kernel/qguiapplication.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/gui') diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 654567e7df..7dc8444163 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -449,8 +449,7 @@ static QWindowGeometrySpecification windowGeometrySpecification; \row \li Miscellaneous \li startingUp(), - closingDown(), - type(). + closingDown(). \endtable \sa QCoreApplication, QAbstractEventDispatcher, QEventLoop -- cgit v1.2.3 From e525d1f44d2678f0360a0ee6c9ce2c9cb44f52a2 Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Wed, 19 Aug 2015 13:24:59 +0200 Subject: Doc: Remove invalid uses of \relates command A function cannot be both a member and a non-member of the same class. Change-Id: I07d1e04c09fea2ba1171b3692e716660044cd37a Reviewed-by: Martin Smith --- src/gui/accessible/qaccessible.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src/gui') diff --git a/src/gui/accessible/qaccessible.cpp b/src/gui/accessible/qaccessible.cpp index 50a4a09102..e9995045b1 100644 --- a/src/gui/accessible/qaccessible.cpp +++ b/src/gui/accessible/qaccessible.cpp @@ -451,7 +451,6 @@ QAccessibleInterface::~QAccessibleInterface() /*! \typedef QAccessible::Id - \relates QAccessible Synonym for unsigned, used by the QAccessibleInterface cache. */ -- cgit v1.2.3 From d99c9bcf2c4e14d3db02ad375aa624a0695e838d Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Tue, 7 Apr 2015 15:06:20 +0200 Subject: Fix regression in reading certain compressed bmp images For BITFIELDS compressed images, the image data may be preceded by bitmask fields. The file positioning code that should make sure those were read correctly was erroneously included in the block of code that was moved in 6f1b82fccdaf202856dcc6510c16b0531680fe23. Task-number: QTBUG-45559 Task-number: QTBUG-40890 Done-with: Eirik Aavitsland Change-Id: Id2b3ce078f67ac6ebf75ab0cc463dc719af83393 Reviewed-by: aavit --- src/gui/image/qbmphandler.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/gui') diff --git a/src/gui/image/qbmphandler.cpp b/src/gui/image/qbmphandler.cpp index f124cede36..ef12b23caa 100644 --- a/src/gui/image/qbmphandler.cpp +++ b/src/gui/image/qbmphandler.cpp @@ -212,6 +212,9 @@ static bool read_dib_body(QDataStream &s, const BMP_INFOHDR &bi, int offset, int int blue_scale = 0; int alpha_scale = 0; + if (!d->isSequential()) + d->seek(startpos + BMP_FILEHDR_SIZE + (bi.biSize >= BMP_WIN4 ? BMP_WIN : bi.biSize)); // goto start of colormap or masks + if (bi.biSize >= BMP_WIN4 || (comp == BMP_BITFIELDS && (nbits == 16 || nbits == 32))) { if (d->read((char *)&red_mask, sizeof(red_mask)) != sizeof(red_mask)) return false; @@ -299,9 +302,6 @@ static bool read_dib_body(QDataStream &s, const BMP_INFOHDR &bi, int offset, int image.setDotsPerMeterX(bi.biXPelsPerMeter); image.setDotsPerMeterY(bi.biYPelsPerMeter); - if (!d->isSequential()) - d->seek(startpos + BMP_FILEHDR_SIZE + (bi.biSize >= BMP_WIN4? BMP_WIN : bi.biSize)); // goto start of colormap - if (ncols > 0) { // read color table uchar rgb[4]; int rgb_len = t == BMP_OLD ? 3 : 4; -- cgit v1.2.3 From bd2ebbdb9a759b6f078cf7fb2fe6a0ac9d48b4fe Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Wed, 19 Aug 2015 13:57:20 +0200 Subject: QInputEvent: document that timestamp() is in milliseconds Task-number: QTBUG-39459 Change-Id: Ie76f3c2f6fe81746d3ea646f0c2f0d47ec3ef252 Reviewed-by: Laszlo Agocs --- src/gui/kernel/qevent.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/gui') diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index 3873976144..780a102644 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -171,6 +171,8 @@ QInputEvent::~QInputEvent() \fn ulong QInputEvent::timestamp() const Returns the window system's timestamp for this event. + It will normally be in milliseconds since some arbitrary point + in time, such as the time when the system was started. */ /*! \fn void QInputEvent::setTimestamp(ulong atimestamp) -- cgit v1.2.3 From 2f43ac9dcdf4681267538f046a3d1b2c82ae0746 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Fri, 21 Aug 2015 10:28:50 +0200 Subject: Fix double initialization of QRgba64 with C++14 Use constructors with C++11/C++14 where it is allowed to avoid hack that caused double initialization and thereby performance regression with C++14. Change-Id: I7ae86df8aa34000b2c186e22bd9917303354b794 Reviewed-by: Thiago Macieira --- src/gui/painting/qrgba64.h | 47 +++++++++++++++++++++++----------------------- 1 file changed, 24 insertions(+), 23 deletions(-) (limited to 'src/gui') diff --git a/src/gui/painting/qrgba64.h b/src/gui/painting/qrgba64.h index b701b224be..cca9019959 100644 --- a/src/gui/painting/qrgba64.h +++ b/src/gui/painting/qrgba64.h @@ -58,33 +58,34 @@ class QRgba64 { #endif }; + // No constructors are allowed in C++98, since this needs to be usable in a union. + // We however require one for constexprs in C++11/C++14 +#ifdef Q_COMPILER_CONSTEXPR + explicit Q_ALWAYS_INLINE Q_DECL_CONSTEXPR QRgba64(quint64 c) : rgba(c) { } +#endif public: - // No constructors are allowed, since this needs to be usable in a union in no-c++11 mode. - // When c++11 is mandatory, we can add all but a copy constructor. - Q_DECL_RELAXED_CONSTEXPR static - QRgba64 fromRgba64(quint16 red, quint16 green, quint16 blue, quint16 alpha) - { - QRgba64 rgba64 -#ifdef Q_COMPILER_UNIFORM_INIT - = {} +#ifdef Q_COMPILER_CONSTEXPR + Q_ALWAYS_INLINE Q_DECL_CONSTEXPR QRgba64() : rgba(0) { } #endif - ; - rgba64.rgba = quint64(red) << RedShift - | quint64(green) << GreenShift - | quint64(blue) << BlueShift - | quint64(alpha) << AlphaShift; - return rgba64; - } - Q_DECL_RELAXED_CONSTEXPR static + + Q_DECL_CONSTEXPR static QRgba64 fromRgba64(quint64 c) { - QRgba64 rgba64 -#ifdef Q_COMPILER_UNIFORM_INIT - = {} -#endif - ; +#ifdef Q_COMPILER_CONSTEXPR + return QRgba64(c); +#else + QRgba64 rgba64; rgba64.rgba = c; return rgba64; +#endif + } + Q_DECL_CONSTEXPR static + QRgba64 fromRgba64(quint16 red, quint16 green, quint16 blue, quint16 alpha) + { + return fromRgba64(quint64(red) << RedShift + | quint64(green) << GreenShift + | quint64(blue) << BlueShift + | quint64(alpha) << AlphaShift); } Q_DECL_RELAXED_CONSTEXPR static QRgba64 fromRgba(quint8 red, quint8 green, quint8 blue, quint8 alpha) { @@ -190,12 +191,12 @@ private: Q_DECLARE_TYPEINFO(QRgba64, Q_PRIMITIVE_TYPE); -Q_DECL_RELAXED_CONSTEXPR inline QRgba64 qRgba64(quint16 r, quint16 g, quint16 b, quint16 a) +Q_DECL_CONSTEXPR inline QRgba64 qRgba64(quint16 r, quint16 g, quint16 b, quint16 a) { return QRgba64::fromRgba64(r, g, b, a); } -Q_DECL_RELAXED_CONSTEXPR inline QRgba64 qRgba64(quint64 c) +Q_DECL_CONSTEXPR inline QRgba64 qRgba64(quint64 c) { return QRgba64::fromRgba64(c); } -- cgit v1.2.3 From 31fb4379c81c58fe471fc7d8e799a6a00c4b4ba0 Mon Sep 17 00:00:00 2001 From: Louai Al-Khanji Date: Mon, 24 Aug 2015 12:04:57 +0300 Subject: Fix module reference in license header Change-Id: I8efa30869e716d827e8463ef4285f8ff9357cc0e Reviewed-by: Laszlo Agocs --- src/gui/kernel/qplatformcursor.cpp | 2 +- src/gui/kernel/qplatformcursor.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/gui') diff --git a/src/gui/kernel/qplatformcursor.cpp b/src/gui/kernel/qplatformcursor.cpp index 7239ac7ba4..cd43fc42fe 100644 --- a/src/gui/kernel/qplatformcursor.cpp +++ b/src/gui/kernel/qplatformcursor.cpp @@ -3,7 +3,7 @@ ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** -** This file is part of the QtOpenVG module of the Qt Toolkit. +** This file is part of the QtGui module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage diff --git a/src/gui/kernel/qplatformcursor.h b/src/gui/kernel/qplatformcursor.h index 4f4f9cc6ae..8c788fd27b 100644 --- a/src/gui/kernel/qplatformcursor.h +++ b/src/gui/kernel/qplatformcursor.h @@ -3,7 +3,7 @@ ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** -** This file is part of the QtOpenVG module of the Qt Toolkit. +** This file is part of the QtGui module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage -- cgit v1.2.3 From b46fe39d940712c5d401e731e171a7ccfadfe648 Mon Sep 17 00:00:00 2001 From: Bernd Weimer Date: Mon, 23 Mar 2015 11:53:16 +0100 Subject: Harmonize input context selection Input context selection works differently across platforms. On some platforms it is not possible to request a specific context at all (e.g. Wayland). This will be unified, depending on the environment variable "QT_IM_MODULE", you will get: - null: default (platform) context, if defined (otherwise no context) - empty: no context - set: set one, if it exists and is valid (otherwise no context) [ChangeLog][Platform Specific Changes] Haromnized input context selection. QT_IM_MODULE environment variable will be taken into account. Change-Id: Ic8f826fbc6ace25941cd19b9b086943e848fbe01 Reviewed-by: Lars Knoll Reviewed-by: Nedim Hadzic --- src/gui/kernel/qplatforminputcontextfactory.cpp | 44 ++++++++----------------- src/gui/kernel/qplatforminputcontextfactory_p.h | 1 + 2 files changed, 15 insertions(+), 30 deletions(-) (limited to 'src/gui') diff --git a/src/gui/kernel/qplatforminputcontextfactory.cpp b/src/gui/kernel/qplatforminputcontextfactory.cpp index a7660e76ae..9d55b778ce 100644 --- a/src/gui/kernel/qplatforminputcontextfactory.cpp +++ b/src/gui/kernel/qplatforminputcontextfactory.cpp @@ -56,48 +56,32 @@ QStringList QPlatformInputContextFactory::keys() #endif } -QPlatformInputContext *QPlatformInputContextFactory::create(const QString& key) +QString QPlatformInputContextFactory::requested() { - QStringList paramList = key.split(QLatin1Char(':')); - const QString platform = paramList.takeFirst().toLower(); - -#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS) - if (QPlatformInputContext *ret = qLoadPlugin1(loader(), platform, paramList)) - return ret; -#endif - return 0; + QByteArray env = qgetenv("QT_IM_MODULE"); + return env.isNull() ? QString() : QString::fromLocal8Bit(env); } -QPlatformInputContext *QPlatformInputContextFactory::create() +QPlatformInputContext *QPlatformInputContextFactory::create(const QString& key) { - QPlatformInputContext *ic = 0; - - QString icString = QString::fromLatin1(qgetenv("QT_IM_MODULE")); - - if (icString == QLatin1String("none")) - return 0; +#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS) + QStringList paramList = key.split(QLatin1Char(':')); + const QString platform = paramList.takeFirst().toLower(); - ic = create(icString); + QPlatformInputContext *ic = qLoadPlugin1 + (loader(), platform, paramList); if (ic && ic->isValid()) return ic; delete ic; - ic = 0; - - QStringList k = keys(); - for (int i = 0; i < k.size(); ++i) { - if (k.at(i) == icString) - continue; - ic = create(k.at(i)); - if (ic && ic->isValid()) - return ic; - delete ic; - ic = 0; - } - +#endif return 0; } +QPlatformInputContext *QPlatformInputContextFactory::create() +{ + return create(requested()); +} QT_END_NAMESPACE diff --git a/src/gui/kernel/qplatforminputcontextfactory_p.h b/src/gui/kernel/qplatforminputcontextfactory_p.h index a74c4f5f80..38f4358287 100644 --- a/src/gui/kernel/qplatforminputcontextfactory_p.h +++ b/src/gui/kernel/qplatforminputcontextfactory_p.h @@ -56,6 +56,7 @@ class Q_GUI_EXPORT QPlatformInputContextFactory { public: static QStringList keys(); + static QString requested(); static QPlatformInputContext *create(const QString &key); static QPlatformInputContext *create(); }; -- cgit v1.2.3 From df276787d5bb191da62db632efaeb4256fa5da27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Martins?= Date: Fri, 26 Jun 2015 20:40:50 +0100 Subject: QRasterPaintEngine: Don't detach QImage Caught being detached a few thousand times per second. Change-Id: I6dd5fd69d7d4f32048cdb7e4ac707f24df6c15f8 (cherry picked from commit 2a81516835c680c29f3de9241a8c28027624ce4f) Reviewed-by: Konstantin Ritt Reviewed-by: Allan Sandfeld Jensen --- src/gui/painting/qpaintengine_raster.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/gui') diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index aabf4a9427..a5957ca86e 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -2756,12 +2756,12 @@ bool QRasterPaintEngine::drawCachedGlyphs(int numGlyphs, const glyph_t *glyphs, QFixed spp = fontEngine->subPixelPositionForX(positions[i].x); QPoint offset; - QImage *alphaMap = fontEngine->lockedAlphaMapForGlyph(glyphs[i], spp, neededFormat, s->matrix, - &offset); + const QImage *alphaMap = fontEngine->lockedAlphaMapForGlyph(glyphs[i], spp, neededFormat, s->matrix, + &offset); if (alphaMap == 0 || alphaMap->isNull()) continue; - alphaPenBlt(alphaMap->bits(), alphaMap->bytesPerLine(), alphaMap->depth(), + alphaPenBlt(alphaMap->constBits(), alphaMap->bytesPerLine(), alphaMap->depth(), qFloor(positions[i].x) + offset.x(), qRound(positions[i].y) + offset.y(), alphaMap->width(), alphaMap->height()); -- cgit v1.2.3 From a5f46bc64798a4f5a63c7507c9e74a21247a6f49 Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Mon, 24 Aug 2015 13:43:13 +0200 Subject: Doc: Fix QDoc warnings for QOpenGLFunctions and QOpenGLExtraFunctions - Use \a commands when listing the arguments for OpenGL methods - Document functions taking a single argument of type 'void' verbatim. Otherwise, QDoc refuses to generate their docs - Add constructor docs for QOpenGLExtraFunctions (copied from QOpenGLFunctions). Change-Id: I64a436365572a80319ba0a8eaba2f5d9b751e84d Reviewed-by: Venugopal Shivashankar Reviewed-by: Laszlo Agocs --- src/gui/opengl/qopenglfunctions.cpp | 165 ++++++++++++++++++++---------------- 1 file changed, 90 insertions(+), 75 deletions(-) (limited to 'src/gui') diff --git a/src/gui/opengl/qopenglfunctions.cpp b/src/gui/opengl/qopenglfunctions.cpp index 668eaa9a89..d614ad8401 100644 --- a/src/gui/opengl/qopenglfunctions.cpp +++ b/src/gui/opengl/qopenglfunctions.cpp @@ -3701,7 +3701,7 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) /*! \fn void QOpenGLExtraFunctions::glCopyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size) - Convenience function that calls glCopyBufferSubData(\a readTarget, writeTarget, \a readOffset, \a writeOffset, \a size). + Convenience function that calls glCopyBufferSubData(\a readTarget, \a writeTarget, \a readOffset, \a writeOffset, \a size). This function is only available in OpenGL ES 3.x, or OpenGL 3.x or 4.x contexts. When running with plain OpenGL, the function is only usable when the given profile and version contains the @@ -3855,7 +3855,7 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) */ /*! - \fn void QOpenGLExtraFunctions::glEndTransformFeedback() + \fn void QOpenGLExtraFunctions::glEndTransformFeedback(void) Convenience function that calls glEndTransformFeedback(). @@ -4362,7 +4362,7 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) */ /*! - \fn void QOpenGLExtraFunctions::glPauseTransformFeedback() + \fn void QOpenGLExtraFunctions::glPauseTransformFeedback(void) Convenience function that calls glPauseTransformFeedback(). @@ -4427,7 +4427,7 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) */ /*! - \fn void QOpenGLExtraFunctions::glResumeTransformFeedback() + \fn void QOpenGLExtraFunctions::glResumeTransformFeedback(void) Convenience function that calls glResumeTransformFeedback(). @@ -4455,7 +4455,7 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) /*! \fn void QOpenGLExtraFunctions::glSamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat * param) - Convenience function that calls glSamplerParameterfv(\a sampler, pname, \a param). + Convenience function that calls glSamplerParameterfv(\a sampler, \a pname, \a param). This function is only available in OpenGL ES 3.x, or OpenGL 3.x or 4.x contexts. When running with plain OpenGL, the function is only usable when the given profile and version contains the @@ -4624,7 +4624,7 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) /*! \fn void QOpenGLExtraFunctions::glUniform3uiv(GLint location, GLsizei count, const GLuint * value) - Convenience function that calls glUniform3uiv(\a location, count, \a value). + Convenience function that calls glUniform3uiv(\a location, \a count, \a value). This function is only available in OpenGL ES 3.x, or OpenGL 3.x or 4.x contexts. When running with plain OpenGL, the function is only usable when the given profile and version contains the @@ -4858,7 +4858,7 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) /*! \fn void QOpenGLExtraFunctions::glActiveShaderProgram(GLuint pipeline, GLuint program) - Convenience function that calls glActiveShaderProgram(pipeline, program). + Convenience function that calls glActiveShaderProgram(\a pipeline, \a program). This function is only available in OpenGL ES 3.x, or OpenGL 3.x or 4.x contexts. When running with plain OpenGL, the function is only usable when the given profile and version contains the @@ -4869,9 +4869,9 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) */ /*! - \fn void QOpenGLFunctions::glBindImageTexture(GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format) + \fn void QOpenGLExtraFunctions::glBindImageTexture(GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format) - Convenience function that calls glBindImageTexture(unit, texture, level, layered, layer, access, format). + Convenience function that calls glBindImageTexture(\a unit, \a texture, \a level, \a layered, \a layer, \a access, \a format). This function is only available in OpenGL ES 3.x, or OpenGL 3.x or 4.x contexts. When running with plain OpenGL, the function is only usable when the given profile and version contains the @@ -4884,7 +4884,7 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) /*! \fn void QOpenGLExtraFunctions::glBindProgramPipeline(GLuint pipeline) - Convenience function that calls glBindProgramPipeline(pipeline). + Convenience function that calls glBindProgramPipeline(\a pipeline). This function is only available in OpenGL ES 3.x, or OpenGL 3.x or 4.x contexts. When running with plain OpenGL, the function is only usable when the given profile and version contains the @@ -4897,7 +4897,7 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) /*! \fn void QOpenGLExtraFunctions::glBindVertexBuffer(GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride) - Convenience function that calls glBindVertexBuffer(bindingindex, buffer, offset, stride). + Convenience function that calls glBindVertexBuffer(\a bindingindex, \a buffer, \a offset, \a stride). This function is only available in OpenGL ES 3.x, or OpenGL 3.x or 4.x contexts. When running with plain OpenGL, the function is only usable when the given profile and version contains the @@ -4910,7 +4910,7 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) /*! \fn GLuint QOpenGLExtraFunctions::glCreateShaderProgramv(GLenum type, GLsizei count, const GLchar *const* strings) - Convenience function that calls glCreateShaderProgramv(type, count, strings). + Convenience function that calls glCreateShaderProgramv(\a type, \a count, \a strings). This function is only available in OpenGL ES 3.x, or OpenGL 3.x or 4.x contexts. When running with plain OpenGL, the function is only usable when the given profile and version contains the @@ -4923,7 +4923,7 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) /*! \fn void QOpenGLExtraFunctions::glDeleteProgramPipelines(GLsizei n, const GLuint * pipelines) - Convenience function that calls glDeleteProgramPipelines(n, pipelines). + Convenience function that calls glDeleteProgramPipelines(\a n, \a pipelines). This function is only available in OpenGL ES 3.x, or OpenGL 3.x or 4.x contexts. When running with plain OpenGL, the function is only usable when the given profile and version contains the @@ -4936,7 +4936,7 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) /*! \fn void QOpenGLExtraFunctions::glDispatchCompute(GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z) - Convenience function that calls glDispatchCompute(num_groups_x, num_groups_y, num_groups_z). + Convenience function that calls glDispatchCompute(\a num_groups_x, \a num_groups_y, \a num_groups_z). This function is only available in OpenGL ES 3.x, or OpenGL 3.x or 4.x contexts. When running with plain OpenGL, the function is only usable when the given profile and version contains the @@ -4949,7 +4949,7 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) /*! \fn void QOpenGLExtraFunctions::glDispatchComputeIndirect(GLintptr indirect) - Convenience function that calls glDispatchComputeIndirect(indirect). + Convenience function that calls glDispatchComputeIndirect(\a indirect). This function is only available in OpenGL ES 3.x, or OpenGL 3.x or 4.x contexts. When running with plain OpenGL, the function is only usable when the given profile and version contains the @@ -4962,7 +4962,7 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) /*! \fn void QOpenGLExtraFunctions::glDrawArraysIndirect(GLenum mode, const void * indirect) - Convenience function that calls glDrawArraysIndirect(mode, indirect). + Convenience function that calls glDrawArraysIndirect(\a mode, \a indirect). This function is only available in OpenGL ES 3.x, or OpenGL 3.x or 4.x contexts. When running with plain OpenGL, the function is only usable when the given profile and version contains the @@ -4975,7 +4975,7 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) /*! \fn void QOpenGLExtraFunctions::glDrawElementsIndirect(GLenum mode, GLenum type, const void * indirect) - Convenience function that calls glDrawElementsIndirect(mode, type, indirect). + Convenience function that calls glDrawElementsIndirect(\a mode, \a type, \a indirect). This function is only available in OpenGL ES 3.x, or OpenGL 3.x or 4.x contexts. When running with plain OpenGL, the function is only usable when the given profile and version contains the @@ -4988,7 +4988,7 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) /*! \fn void QOpenGLExtraFunctions::glFramebufferParameteri(GLenum target, GLenum pname, GLint param) - Convenience function that calls glFramebufferParameteri(target, pname, param). + Convenience function that calls glFramebufferParameteri(\a target, \a pname, \a param). This function is only available in OpenGL ES 3.x, or OpenGL 3.x or 4.x contexts. When running with plain OpenGL, the function is only usable when the given profile and version contains the @@ -5001,7 +5001,7 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) /*! \fn void QOpenGLExtraFunctions::glGenProgramPipelines(GLsizei n, GLuint* pipelines) - Convenience function that calls glGenProgramPipelines(n, pipelines). + Convenience function that calls glGenProgramPipelines(\a n, \a pipelines). This function is only available in OpenGL ES 3.x, or OpenGL 3.x or 4.x contexts. When running with plain OpenGL, the function is only usable when the given profile and version contains the @@ -5014,7 +5014,7 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) /*! \fn void QOpenGLExtraFunctions::glGetBooleani_v(GLenum target, GLuint index, GLboolean* data) - Convenience function that calls glGetBooleani_v(target, index, data). + Convenience function that calls glGetBooleani_v(\a target, \a index, \a data). This function is only available in OpenGL ES 3.x, or OpenGL 3.x or 4.x contexts. When running with plain OpenGL, the function is only usable when the given profile and version contains the @@ -5027,7 +5027,7 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) /*! \fn void QOpenGLExtraFunctions::glGetFramebufferParameteriv(GLenum target, GLenum pname, GLint* params) - Convenience function that calls glGetFramebufferParameteriv(target, pname, params). + Convenience function that calls glGetFramebufferParameteriv(\a target, \a pname, \a params). This function is only available in OpenGL ES 3.x, or OpenGL 3.x or 4.x contexts. When running with plain OpenGL, the function is only usable when the given profile and version contains the @@ -5040,7 +5040,7 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) /*! \fn void QOpenGLExtraFunctions::glGetMultisamplefv(GLenum pname, GLuint index, GLfloat* val) - Convenience function that calls glGetMultisamplefv(pname, index, val). + Convenience function that calls glGetMultisamplefv(\a pname, \a index, \a val). This function is only available in OpenGL ES 3.x, or OpenGL 3.x or 4.x contexts. When running with plain OpenGL, the function is only usable when the given profile and version contains the @@ -5053,7 +5053,7 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) /*! \fn void QOpenGLExtraFunctions::glGetProgramInterfaceiv(GLuint program, GLenum programInterface, GLenum pname, GLint* params) - Convenience function that calls glGetProgramInterfaceiv(program, programInterface, pname, params). + Convenience function that calls glGetProgramInterfaceiv(\a program, \a programInterface, \a pname, \a params). This function is only available in OpenGL ES 3.x, or OpenGL 3.x or 4.x contexts. When running with plain OpenGL, the function is only usable when the given profile and version contains the @@ -5066,7 +5066,7 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) /*! \fn void QOpenGLExtraFunctions::glGetProgramPipelineInfoLog(GLuint pipeline, GLsizei bufSize, GLsizei* length, GLchar* infoLog) - Convenience function that calls glGetProgramPipelineInfoLog(pipeline, bufSize, length, infoLog). + Convenience function that calls glGetProgramPipelineInfoLog(\a pipeline, \a bufSize, \a length, \a infoLog). This function is only available in OpenGL ES 3.x, or OpenGL 3.x or 4.x contexts. When running with plain OpenGL, the function is only usable when the given profile and version contains the @@ -5079,7 +5079,7 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) /*! \fn void QOpenGLExtraFunctions::glGetProgramPipelineiv(GLuint pipeline, GLenum pname, GLint* params) - Convenience function that calls glGetProgramPipelineiv(pipeline, pname, params). + Convenience function that calls glGetProgramPipelineiv(\a pipeline, \a pname, \a params). This function is only available in OpenGL ES 3.x, or OpenGL 3.x or 4.x contexts. When running with plain OpenGL, the function is only usable when the given profile and version contains the @@ -5092,7 +5092,7 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) /*! \fn GLuint QOpenGLExtraFunctions::glGetProgramResourceIndex(GLuint program, GLenum programInterface, const GLchar * name) - Convenience function that calls glGetProgramResourceIndex(program, programInterface, name). + Convenience function that calls glGetProgramResourceIndex(\a program, \a programInterface, \a name). This function is only available in OpenGL ES 3.x, or OpenGL 3.x or 4.x contexts. When running with plain OpenGL, the function is only usable when the given profile and version contains the @@ -5105,7 +5105,7 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) /*! \fn GLint QOpenGLExtraFunctions::glGetProgramResourceLocation(GLuint program, GLenum programInterface, const GLchar * name) - Convenience function that calls glGetProgramResourceLocation(program, programInterface, name). + Convenience function that calls glGetProgramResourceLocation(\a program, \a programInterface, \a name). This function is only available in OpenGL ES 3.x, or OpenGL 3.x or 4.x contexts. When running with plain OpenGL, the function is only usable when the given profile and version contains the @@ -5118,7 +5118,7 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) /*! \fn void QOpenGLExtraFunctions::glGetProgramResourceName(GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei* length, GLchar* name) - Convenience function that calls glGetProgramResourceName(program, programInterface, index, bufSize, length, name). + Convenience function that calls glGetProgramResourceName(\a program, \a programInterface, \a index, \a bufSize, \a length, \a name). This function is only available in OpenGL ES 3.x, or OpenGL 3.x or 4.x contexts. When running with plain OpenGL, the function is only usable when the given profile and version contains the @@ -5131,7 +5131,7 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) /*! \fn void QOpenGLExtraFunctions::glGetProgramResourceiv(GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum * props, GLsizei bufSize, GLsizei* length, GLint* params) - Convenience function that calls glGetProgramResourceiv(program, programInterface, index, propCount, props, bufSize, length, params). + Convenience function that calls glGetProgramResourceiv(\a program, \a programInterface, \a index, \a propCount, \a props, \a bufSize, \a length, \a params). This function is only available in OpenGL ES 3.x, or OpenGL 3.x or 4.x contexts. When running with plain OpenGL, the function is only usable when the given profile and version contains the @@ -5144,7 +5144,7 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) /*! \fn void QOpenGLExtraFunctions::glGetTexLevelParameterfv(GLenum target, GLint level, GLenum pname, GLfloat* params) - Convenience function that calls glGetTexLevelParameterfv(target, level, pname, params). + Convenience function that calls glGetTexLevelParameterfv(\a target, \a level, \a pname, \a params). This function is only available in OpenGL ES 3.x, or OpenGL 3.x or 4.x contexts. When running with plain OpenGL, the function is only usable when the given profile and version contains the @@ -5157,7 +5157,7 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) /*! \fn void QOpenGLExtraFunctions::glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint* params) - Convenience function that calls glGetTexLevelParameteriv(target, level, pname, params). + Convenience function that calls glGetTexLevelParameteriv(\a target, \a level, \a pname, \a params). This function is only available in OpenGL ES 3.x, or OpenGL 3.x or 4.x contexts. When running with plain OpenGL, the function is only usable when the given profile and version contains the @@ -5170,7 +5170,7 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) /*! \fn GLboolean QOpenGLExtraFunctions::glIsProgramPipeline(GLuint pipeline) - Convenience function that calls glIsProgramPipeline(pipeline). + Convenience function that calls glIsProgramPipeline(\a pipeline). This function is only available in OpenGL ES 3.x, or OpenGL 3.x or 4.x contexts. When running with plain OpenGL, the function is only usable when the given profile and version contains the @@ -5183,7 +5183,7 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) /*! \fn void QOpenGLExtraFunctions::glMemoryBarrier(GLbitfield barriers) - Convenience function that calls glMemoryBarrier(barriers). + Convenience function that calls glMemoryBarrier(\a barriers). This function is only available in OpenGL ES 3.x, or OpenGL 3.x or 4.x contexts. When running with plain OpenGL, the function is only usable when the given profile and version contains the @@ -5196,7 +5196,7 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) /*! \fn void QOpenGLExtraFunctions::glMemoryBarrierByRegion(GLbitfield barriers) - Convenience function that calls glMemoryBarrierByRegion(barriers). + Convenience function that calls glMemoryBarrierByRegion(\a barriers). This function is only available in OpenGL ES 3.x, or OpenGL 3.x or 4.x contexts. When running with plain OpenGL, the function is only usable when the given profile and version contains the @@ -5209,7 +5209,7 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) /*! \fn void QOpenGLExtraFunctions::glProgramUniform1f(GLuint program, GLint location, GLfloat v0) - Convenience function that calls glProgramUniform1f(program, location, v0). + Convenience function that calls glProgramUniform1f(\a program, \a location, \a v0). This function is only available in OpenGL ES 3.x, or OpenGL 3.x or 4.x contexts. When running with plain OpenGL, the function is only usable when the given profile and version contains the @@ -5222,7 +5222,7 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) /*! \fn void QOpenGLExtraFunctions::glProgramUniform1fv(GLuint program, GLint location, GLsizei count, const GLfloat * value) - Convenience function that calls glProgramUniform1fv(program, location, count, value). + Convenience function that calls glProgramUniform1fv(\a program, \a location, \a count, \a value). This function is only available in OpenGL ES 3.x, or OpenGL 3.x or 4.x contexts. When running with plain OpenGL, the function is only usable when the given profile and version contains the @@ -5235,7 +5235,7 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) /*! \fn void QOpenGLExtraFunctions::glProgramUniform1i(GLuint program, GLint location, GLint v0) - Convenience function that calls glProgramUniform1i(program, location, v0). + Convenience function that calls glProgramUniform1i(\a program, \a location, \a v0). This function is only available in OpenGL ES 3.x, or OpenGL 3.x or 4.x contexts. When running with plain OpenGL, the function is only usable when the given profile and version contains the @@ -5248,7 +5248,7 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) /*! \fn void QOpenGLExtraFunctions::glProgramUniform1iv(GLuint program, GLint location, GLsizei count, const GLint * value) - Convenience function that calls glProgramUniform1iv(program, location, count, value). + Convenience function that calls glProgramUniform1iv(\a program, \a location, \a count, \a value). This function is only available in OpenGL ES 3.x, or OpenGL 3.x or 4.x contexts. When running with plain OpenGL, the function is only usable when the given profile and version contains the @@ -5261,7 +5261,7 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) /*! \fn void QOpenGLExtraFunctions::glProgramUniform1ui(GLuint program, GLint location, GLuint v0) - Convenience function that calls glProgramUniform1ui(program, location, v0). + Convenience function that calls glProgramUniform1ui(\a program, \a location, \a v0). This function is only available in OpenGL ES 3.x, or OpenGL 3.x or 4.x contexts. When running with plain OpenGL, the function is only usable when the given profile and version contains the @@ -5274,7 +5274,7 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) /*! \fn void QOpenGLExtraFunctions::glProgramUniform1uiv(GLuint program, GLint location, GLsizei count, const GLuint * value) - Convenience function that calls glProgramUniform1uiv(program, location, count, value). + Convenience function that calls glProgramUniform1uiv(\a program, \a location, \a count, \a value). This function is only available in OpenGL ES 3.x, or OpenGL 3.x or 4.x contexts. When running with plain OpenGL, the function is only usable when the given profile and version contains the @@ -5287,7 +5287,7 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) /*! \fn void QOpenGLExtraFunctions::glProgramUniform2f(GLuint program, GLint location, GLfloat v0, GLfloat v1) - Convenience function that calls glProgramUniform2f(program, location, v0, v1). + Convenience function that calls glProgramUniform2f(\a program, \a location, \a v0, \a v1). This function is only available in OpenGL ES 3.x, or OpenGL 3.x or 4.x contexts. When running with plain OpenGL, the function is only usable when the given profile and version contains the @@ -5300,7 +5300,7 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) /*! \fn void QOpenGLExtraFunctions::glProgramUniform2fv(GLuint program, GLint location, GLsizei count, const GLfloat * value) - Convenience function that calls glProgramUniform2fv(program, location, count, value). + Convenience function that calls glProgramUniform2fv(\a program, \a location, \a count, \a value). This function is only available in OpenGL ES 3.x, or OpenGL 3.x or 4.x contexts. When running with plain OpenGL, the function is only usable when the given profile and version contains the @@ -5313,7 +5313,7 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) /*! \fn void QOpenGLExtraFunctions::glProgramUniform2i(GLuint program, GLint location, GLint v0, GLint v1) - Convenience function that calls glProgramUniform2i(program, location, v0, v1). + Convenience function that calls glProgramUniform2i(\a program, \a location, \a v0, \a v1). This function is only available in OpenGL ES 3.x, or OpenGL 3.x or 4.x contexts. When running with plain OpenGL, the function is only usable when the given profile and version contains the @@ -5326,7 +5326,7 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) /*! \fn void QOpenGLExtraFunctions::glProgramUniform2iv(GLuint program, GLint location, GLsizei count, const GLint * value) - Convenience function that calls glProgramUniform2iv(program, location, count, value). + Convenience function that calls glProgramUniform2iv(\a program, \a location, \a count, \a value). This function is only available in OpenGL ES 3.x, or OpenGL 3.x or 4.x contexts. When running with plain OpenGL, the function is only usable when the given profile and version contains the @@ -5339,7 +5339,7 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) /*! \fn void QOpenGLExtraFunctions::glProgramUniform2ui(GLuint program, GLint location, GLuint v0, GLuint v1) - Convenience function that calls glProgramUniform2ui(program, location, v0, v1). + Convenience function that calls glProgramUniform2ui(\a program, \a location, \a v0, \a v1). This function is only available in OpenGL ES 3.x, or OpenGL 3.x or 4.x contexts. When running with plain OpenGL, the function is only usable when the given profile and version contains the @@ -5352,7 +5352,7 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) /*! \fn void QOpenGLExtraFunctions::glProgramUniform2uiv(GLuint program, GLint location, GLsizei count, const GLuint * value) - Convenience function that calls glProgramUniform2uiv(program, location, count, value). + Convenience function that calls glProgramUniform2uiv(\a program, \a location, \a count, \a value). This function is only available in OpenGL ES 3.x, or OpenGL 3.x or 4.x contexts. When running with plain OpenGL, the function is only usable when the given profile and version contains the @@ -5365,7 +5365,7 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) /*! \fn void QOpenGLExtraFunctions::glProgramUniform3f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2) - Convenience function that calls glProgramUniform3f(program, location, v0, v1, v2). + Convenience function that calls glProgramUniform3f(\a program, \a location, \a v0, \a v1, \a v2). This function is only available in OpenGL ES 3.x, or OpenGL 3.x or 4.x contexts. When running with plain OpenGL, the function is only usable when the given profile and version contains the @@ -5378,7 +5378,7 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) /*! \fn void QOpenGLExtraFunctions::glProgramUniform3fv(GLuint program, GLint location, GLsizei count, const GLfloat * value) - Convenience function that calls glProgramUniform3fv(program, location, count, value). + Convenience function that calls glProgramUniform3fv(\a program, \a location, \a count, \a value). This function is only available in OpenGL ES 3.x, or OpenGL 3.x or 4.x contexts. When running with plain OpenGL, the function is only usable when the given profile and version contains the @@ -5391,7 +5391,7 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) /*! \fn void QOpenGLExtraFunctions::glProgramUniform3i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2) - Convenience function that calls glProgramUniform3i(program, location, v0, v1, v2). + Convenience function that calls glProgramUniform3i(\a program, \a location, \a v0, \a v1, \a v2). This function is only available in OpenGL ES 3.x, or OpenGL 3.x or 4.x contexts. When running with plain OpenGL, the function is only usable when the given profile and version contains the @@ -5404,7 +5404,7 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) /*! \fn void QOpenGLExtraFunctions::glProgramUniform3iv(GLuint program, GLint location, GLsizei count, const GLint * value) - Convenience function that calls glProgramUniform3iv(program, location, count, value). + Convenience function that calls glProgramUniform3iv(\a program, \a location, \a count, \a value). This function is only available in OpenGL ES 3.x, or OpenGL 3.x or 4.x contexts. When running with plain OpenGL, the function is only usable when the given profile and version contains the @@ -5417,7 +5417,7 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) /*! \fn void QOpenGLExtraFunctions::glProgramUniform3ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2) - Convenience function that calls glProgramUniform3ui(program, location, v0, v1, v2). + Convenience function that calls glProgramUniform3ui(\a program, \a location, \a v0, \a v1, \a v2). This function is only available in OpenGL ES 3.x, or OpenGL 3.x or 4.x contexts. When running with plain OpenGL, the function is only usable when the given profile and version contains the @@ -5430,7 +5430,7 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) /*! \fn void QOpenGLExtraFunctions::glProgramUniform3uiv(GLuint program, GLint location, GLsizei count, const GLuint * value) - Convenience function that calls glProgramUniform3uiv(program, location, count, value). + Convenience function that calls glProgramUniform3uiv(\a program, \a location, \a count, \a value). This function is only available in OpenGL ES 3.x, or OpenGL 3.x or 4.x contexts. When running with plain OpenGL, the function is only usable when the given profile and version contains the @@ -5443,7 +5443,7 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) /*! \fn void QOpenGLExtraFunctions::glProgramUniform4f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3) - Convenience function that calls glProgramUniform4f(program, location, v0, v1, v2, v3). + Convenience function that calls glProgramUniform4f(\a program, \a location, \a v0, \a v1, \a v2, \a v3). This function is only available in OpenGL ES 3.x, or OpenGL 3.x or 4.x contexts. When running with plain OpenGL, the function is only usable when the given profile and version contains the @@ -5456,7 +5456,7 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) /*! \fn void QOpenGLExtraFunctions::glProgramUniform4fv(GLuint program, GLint location, GLsizei count, const GLfloat * value) - Convenience function that calls glProgramUniform4fv(program, location, count, value). + Convenience function that calls glProgramUniform4fv(\a program, \a location, \a count, \a value). This function is only available in OpenGL ES 3.x, or OpenGL 3.x or 4.x contexts. When running with plain OpenGL, the function is only usable when the given profile and version contains the @@ -5469,7 +5469,7 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) /*! \fn void QOpenGLExtraFunctions::glProgramUniform4i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3) - Convenience function that calls glProgramUniform4i(program, location, v0, v1, v2, v3). + Convenience function that calls glProgramUniform4i(\a program, \a location, \a v0, \a v1, \a v2, \a v3). This function is only available in OpenGL ES 3.x, or OpenGL 3.x or 4.x contexts. When running with plain OpenGL, the function is only usable when the given profile and version contains the @@ -5482,7 +5482,7 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) /*! \fn void QOpenGLExtraFunctions::glProgramUniform4iv(GLuint program, GLint location, GLsizei count, const GLint * value) - Convenience function that calls glProgramUniform4iv(program, location, count, value). + Convenience function that calls glProgramUniform4iv(\a program, \a location, \a count, \a value). This function is only available in OpenGL ES 3.x, or OpenGL 3.x or 4.x contexts. When running with plain OpenGL, the function is only usable when the given profile and version contains the @@ -5495,7 +5495,7 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) /*! \fn void QOpenGLExtraFunctions::glProgramUniform4ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3) - Convenience function that calls glProgramUniform4ui(program, location, v0, v1, v2, v3). + Convenience function that calls glProgramUniform4ui(\a program, \a location, \a v0, \a v1, \a v2, \a v3). This function is only available in OpenGL ES 3.x, or OpenGL 3.x or 4.x contexts. When running with plain OpenGL, the function is only usable when the given profile and version contains the @@ -5508,7 +5508,7 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) /*! \fn void QOpenGLExtraFunctions::glProgramUniform4uiv(GLuint program, GLint location, GLsizei count, const GLuint * value) - Convenience function that calls glProgramUniform4uiv(program, location, count, value). + Convenience function that calls glProgramUniform4uiv(\a program, \a location, \a count, \a value). This function is only available in OpenGL ES 3.x, or OpenGL 3.x or 4.x contexts. When running with plain OpenGL, the function is only usable when the given profile and version contains the @@ -5521,7 +5521,7 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) /*! \fn void QOpenGLExtraFunctions::glProgramUniformMatrix2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) - Convenience function that calls glProgramUniformMatrix2fv(program, location, count, transpose, value). + Convenience function that calls glProgramUniformMatrix2fv(\a program, \a location, \a count, \a transpose, \a value). This function is only available in OpenGL ES 3.x, or OpenGL 3.x or 4.x contexts. When running with plain OpenGL, the function is only usable when the given profile and version contains the @@ -5534,7 +5534,7 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) /*! \fn void QOpenGLExtraFunctions::glProgramUniformMatrix2x3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) - Convenience function that calls glProgramUniformMatrix2x3fv(program, location, count, transpose, value). + Convenience function that calls glProgramUniformMatrix2x3fv(\a program, \a location, \a count, \a transpose, \a value). This function is only available in OpenGL ES 3.x, or OpenGL 3.x or 4.x contexts. When running with plain OpenGL, the function is only usable when the given profile and version contains the @@ -5547,7 +5547,7 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) /*! \fn void QOpenGLExtraFunctions::glProgramUniformMatrix2x4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) - Convenience function that calls glProgramUniformMatrix2x4fv(program, location, count, transpose, value). + Convenience function that calls glProgramUniformMatrix2x4fv(\a program, \a location, \a count, \a transpose, \a value). This function is only available in OpenGL ES 3.x, or OpenGL 3.x or 4.x contexts. When running with plain OpenGL, the function is only usable when the given profile and version contains the @@ -5560,7 +5560,7 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) /*! \fn void QOpenGLExtraFunctions::glProgramUniformMatrix3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) - Convenience function that calls glProgramUniformMatrix3fv(program, location, count, transpose, value). + Convenience function that calls glProgramUniformMatrix3fv(\a program, \a location, \a count, \a transpose, \a value). This function is only available in OpenGL ES 3.x, or OpenGL 3.x or 4.x contexts. When running with plain OpenGL, the function is only usable when the given profile and version contains the @@ -5573,7 +5573,7 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) /*! \fn void QOpenGLExtraFunctions::glProgramUniformMatrix3x2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) - Convenience function that calls glProgramUniformMatrix3x2fv(program, location, count, transpose, value). + Convenience function that calls glProgramUniformMatrix3x2fv(\a program, \a location, \a count, \a transpose, \a value). This function is only available in OpenGL ES 3.x, or OpenGL 3.x or 4.x contexts. When running with plain OpenGL, the function is only usable when the given profile and version contains the @@ -5586,7 +5586,7 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) /*! \fn void QOpenGLExtraFunctions::glProgramUniformMatrix3x4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) - Convenience function that calls glProgramUniformMatrix3x4fv(program, location, count, transpose, value). + Convenience function that calls glProgramUniformMatrix3x4fv(\a program, \a location, \a count, \a transpose, \a value). This function is only available in OpenGL ES 3.x, or OpenGL 3.x or 4.x contexts. When running with plain OpenGL, the function is only usable when the given profile and version contains the @@ -5599,7 +5599,7 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) /*! \fn void QOpenGLExtraFunctions::glProgramUniformMatrix4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) - Convenience function that calls glProgramUniformMatrix4fv(program, location, count, transpose, value). + Convenience function that calls glProgramUniformMatrix4fv(\a program, \a location, \a count, \a transpose, \a value). This function is only available in OpenGL ES 3.x, or OpenGL 3.x or 4.x contexts. When running with plain OpenGL, the function is only usable when the given profile and version contains the @@ -5612,7 +5612,7 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) /*! \fn void QOpenGLExtraFunctions::glProgramUniformMatrix4x2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) - Convenience function that calls glProgramUniformMatrix4x2fv(program, location, count, transpose, value). + Convenience function that calls glProgramUniformMatrix4x2fv(\a program, \a location, \a count, \a transpose, \a value). This function is only available in OpenGL ES 3.x, or OpenGL 3.x or 4.x contexts. When running with plain OpenGL, the function is only usable when the given profile and version contains the @@ -5625,7 +5625,7 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) /*! \fn void QOpenGLExtraFunctions::glProgramUniformMatrix4x3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) - Convenience function that calls glProgramUniformMatrix4x3fv(program, location, count, transpose, value). + Convenience function that calls glProgramUniformMatrix4x3fv(\a program, \a location, \a count, \a transpose, \a value). This function is only available in OpenGL ES 3.x, or OpenGL 3.x or 4.x contexts. When running with plain OpenGL, the function is only usable when the given profile and version contains the @@ -5638,7 +5638,7 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) /*! \fn void QOpenGLExtraFunctions::glSampleMaski(GLuint maskNumber, GLbitfield mask) - Convenience function that calls glSampleMaski(maskNumber, mask). + Convenience function that calls glSampleMaski(\a maskNumber, \a mask). This function is only available in OpenGL ES 3.x, or OpenGL 3.x or 4.x contexts. When running with plain OpenGL, the function is only usable when the given profile and version contains the @@ -5651,7 +5651,7 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) /*! \fn void QOpenGLExtraFunctions::glTexStorage2DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations) - Convenience function that calls glTexStorage2DMultisample(target, samples, internalformat, width, height, fixedsamplelocations). + Convenience function that calls glTexStorage2DMultisample(\a target, \a samples, \a internalformat, \a width, \a height, \a fixedsamplelocations). This function is only available in OpenGL ES 3.x, or OpenGL 3.x or 4.x contexts. When running with plain OpenGL, the function is only usable when the given profile and version contains the @@ -5664,7 +5664,7 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) /*! \fn void QOpenGLExtraFunctions::glUseProgramStages(GLuint pipeline, GLbitfield stages, GLuint program) - Convenience function that calls glUseProgramStages(pipeline, stages, program). + Convenience function that calls glUseProgramStages(\a pipeline, \a stages, \a program). This function is only available in OpenGL ES 3.x, or OpenGL 3.x or 4.x contexts. When running with plain OpenGL, the function is only usable when the given profile and version contains the @@ -5677,7 +5677,7 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) /*! \fn void QOpenGLExtraFunctions::glValidateProgramPipeline(GLuint pipeline) - Convenience function that calls glValidateProgramPipeline(pipeline). + Convenience function that calls glValidateProgramPipeline(\a pipeline). This function is only available in OpenGL ES 3.x, or OpenGL 3.x or 4.x contexts. When running with plain OpenGL, the function is only usable when the given profile and version contains the @@ -5690,7 +5690,7 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) /*! \fn void QOpenGLExtraFunctions::glVertexAttribBinding(GLuint attribindex, GLuint bindingindex) - Convenience function that calls glVertexAttribBinding(attribindex, bindingindex). + Convenience function that calls glVertexAttribBinding(\a attribindex, \a bindingindex). This function is only available in OpenGL ES 3.x, or OpenGL 3.x or 4.x contexts. When running with plain OpenGL, the function is only usable when the given profile and version contains the @@ -5703,7 +5703,7 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) /*! \fn void QOpenGLExtraFunctions::glVertexAttribFormat(GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset) - Convenience function that calls glVertexAttribFormat(attribindex, size, type, normalized, relativeoffset). + Convenience function that calls glVertexAttribFormat(\a attribindex, \a size, \a type, \a normalized, \a relativeoffset). This function is only available in OpenGL ES 3.x, or OpenGL 3.x or 4.x contexts. When running with plain OpenGL, the function is only usable when the given profile and version contains the @@ -5716,7 +5716,7 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) /*! \fn void QOpenGLExtraFunctions::glVertexAttribIFormat(GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset) - Convenience function that calls glVertexAttribIFormat(attribindex, size, type, relativeoffset). + Convenience function that calls glVertexAttribIFormat(\a attribindex, \a size, \a type, \a relativeoffset). This function is only available in OpenGL ES 3.x, or OpenGL 3.x or 4.x contexts. When running with plain OpenGL, the function is only usable when the given profile and version contains the @@ -5729,7 +5729,7 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) /*! \fn void QOpenGLExtraFunctions::glVertexBindingDivisor(GLuint bindingindex, GLuint divisor) - Convenience function that calls glVertexBindingDivisor(bindingindex, divisor). + Convenience function that calls glVertexBindingDivisor(\a bindingindex, \a divisor). This function is only available in OpenGL ES 3.x, or OpenGL 3.x or 4.x contexts. When running with plain OpenGL, the function is only usable when the given profile and version contains the @@ -7398,10 +7398,25 @@ static void QOPENGLF_APIENTRY qopenglfResolveVertexBindingDivisor(GLuint binding RESOLVE_FUNC_VOID(0, VertexBindingDivisor)(bindingindex, divisor); } +/*! + Constructs a default function resolver. The resolver cannot be used until + \l {QOpenGLFunctions::}{initializeOpenGLFunctions()} is called to specify + the context. +*/ QOpenGLExtraFunctions::QOpenGLExtraFunctions() { } +/*! + Constructs a function resolver for context. If \a context is null, then + the resolver will be created for the current QOpenGLContext. + + The context or another context in the group must be current. + + An object constructed in this way can only be used with context and other + contexts that share with it. Use \l {QOpenGLFunctions::} + {initializeOpenGLFunctions()} to change the object's context association. +*/ QOpenGLExtraFunctions::QOpenGLExtraFunctions(QOpenGLContext *context) : QOpenGLFunctions(context) { -- cgit v1.2.3 From 2117a76136e6e3e48f70d7a444b06c0ee0ff9ec4 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 26 Aug 2015 15:09:50 +0200 Subject: QPlatformFileDialogHelper::cleanFilterList(): Allow for ',' in glob. RCS files (text/plain) have the glob pattern "*,v", which caused the regular expression match to fail. Task-number: QTBUG-47923 Change-Id: I7d8682ef51306cb4da58a2b3880842bd99892ea3 Reviewed-by: David Faure --- src/gui/kernel/qplatformdialoghelper.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/gui') diff --git a/src/gui/kernel/qplatformdialoghelper.cpp b/src/gui/kernel/qplatformdialoghelper.cpp index 25894fd504..20dc716d89 100644 --- a/src/gui/kernel/qplatformdialoghelper.cpp +++ b/src/gui/kernel/qplatformdialoghelper.cpp @@ -651,12 +651,13 @@ void QPlatformFileDialogHelper::setOptions(const QSharedPointer\\$%&=^~:\\|]*)\\)$"; +"^(.*)\\(([a-zA-Z0-9_.,*? +;#\\-\\[\\]@\\{\\}/!<>\\$%&=^~:\\|]*)\\)$"; // Makes a list of filters from a normal filter string "Image Files (*.png *.jpg)" QStringList QPlatformFileDialogHelper::cleanFilterList(const QString &filter) { QRegExp regexp(QString::fromLatin1(filterRegExp)); + Q_ASSERT(regexp.isValid()); QString f = filter; int i = regexp.indexIn(f); if (i >= 0) -- cgit v1.2.3 From 3fe645ecc9aaf4522183c39f5c9a78ebc1c90674 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 19 Aug 2015 15:01:19 +0200 Subject: Optimize set color component in RGBA64 After the removal of direct access through type punning, the direct color setters can be better optimized. Change-Id: Icaa5b1f8c8fe90863dd42fa4dfb5a2998c273465 Reviewed-by: Gunnar Sletta --- src/gui/painting/qrgba64.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/gui') diff --git a/src/gui/painting/qrgba64.h b/src/gui/painting/qrgba64.h index cca9019959..264ec394cd 100644 --- a/src/gui/painting/qrgba64.h +++ b/src/gui/painting/qrgba64.h @@ -113,10 +113,10 @@ public: Q_DECL_CONSTEXPR quint16 green() const { return rgba >> GreenShift; } Q_DECL_CONSTEXPR quint16 blue() const { return rgba >> BlueShift; } Q_DECL_CONSTEXPR quint16 alpha() const { return rgba >> AlphaShift; } - void setRed(quint16 _red) { *this = fromRgba64(_red, green(), blue(), alpha()); } - void setGreen(quint16 _green) { *this = fromRgba64(red(), _green, blue(), alpha()); } - void setBlue(quint16 _blue) { *this = fromRgba64(red(), green(), _blue, alpha()); } - void setAlpha(quint16 _alpha) { *this = fromRgba64(red(), green(), blue(), _alpha); } + void setRed(quint16 _red) { rgba = (rgba & ~(Q_UINT64_C(0xffff) << RedShift)) | (quint64(_red) << RedShift); } + void setGreen(quint16 _green) { rgba = (rgba & ~(Q_UINT64_C(0xffff) << GreenShift)) | (quint64(_green) << GreenShift); } + void setBlue(quint16 _blue) { rgba = (rgba & ~(Q_UINT64_C(0xffff) << BlueShift)) | (quint64(_blue) << BlueShift); } + void setAlpha(quint16 _alpha) { rgba = (rgba & ~(Q_UINT64_C(0xffff) << AlphaShift)) | (quint64(_alpha) << AlphaShift); } Q_DECL_CONSTEXPR quint8 red8() const { return div_257(red()); } Q_DECL_CONSTEXPR quint8 green8() const { return div_257(green()); } @@ -161,16 +161,16 @@ public: } private: - static Q_DECL_CONSTEXPR quint64 alphaMask() { return quint64(0xffff) << AlphaShift; } + static Q_DECL_CONSTEXPR quint64 alphaMask() { return Q_UINT64_C(0xffff) << AlphaShift; } static Q_DECL_CONSTEXPR uint div_257_floor(uint x) { return (x - (x >> 8)) >> 8; } static Q_DECL_CONSTEXPR uint div_257(uint x) { return div_257_floor(x + 128); } static Q_DECL_CONSTEXPR uint div_65535(uint x) { return (x + (x>>16) + 0x8000U) >> 16; } Q_DECL_RELAXED_CONSTEXPR QRgba64 unpremultiplied_32bit() const { - const quint16 a = alpha(); - if (a == 0xffff || a == 0) + if (isOpaque() || isTransparent()) return *this; + const quint32 a = alpha(); const quint16 r = (quint32(red()) * 0xffff + a/2) / a; const quint16 g = (quint32(green()) * 0xffff + a/2) / a; const quint16 b = (quint32(blue()) * 0xffff + a/2) / a; @@ -178,9 +178,9 @@ private: } Q_DECL_RELAXED_CONSTEXPR QRgba64 unpremultiplied_64bit() const { - const quint16 a = alpha(); - if (a == 0xffff || a == 0) + if (isOpaque() || isTransparent()) return *this; + const quint64 a = alpha(); const quint64 fa = (Q_UINT64_C(0xffff00008000) + a/2) / a; const quint16 r = (red() * fa + 0x80000000) >> 32; const quint16 g = (green() * fa + 0x80000000) >> 32; -- cgit v1.2.3 From ac9643c85ff829583c8be958b5eea4d543070882 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Wed, 29 Apr 2015 12:34:16 +0200 Subject: Make flushWindowSystemEvents return ev. accepted MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit flushWindowSystemEvents() now returns whether the most recent event added to the queue was accepted by Qt or not. Use QAtomicInt to store the accepted state in order to avoid a data race on it between the Gui thread and the event poster thread. Change-Id: I6c111fdaecda5c514307ca0749a54075fe8e872f Reviewed-by: Jørgen Lind --- src/gui/kernel/qwindowsysteminterface.cpp | 19 ++++++++++++++++--- src/gui/kernel/qwindowsysteminterface.h | 2 +- src/gui/kernel/qwindowsysteminterface_p.h | 2 ++ 3 files changed, 19 insertions(+), 4 deletions(-) (limited to 'src/gui') diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp index 88cf2dac93..01f4be6dd0 100644 --- a/src/gui/kernel/qwindowsysteminterface.cpp +++ b/src/gui/kernel/qwindowsysteminterface.cpp @@ -49,6 +49,7 @@ QElapsedTimer QWindowSystemInterfacePrivate::eventTime; bool QWindowSystemInterfacePrivate::synchronousWindowSystemEvents = false; QWaitCondition QWindowSystemInterfacePrivate::eventsFlushed; QMutex QWindowSystemInterfacePrivate::flushEventMutex; +QAtomicInt QWindowSystemInterfacePrivate::eventAccepted; QWindowSystemEventHandler *QWindowSystemInterfacePrivate::eventHandler; //------------------------------------------------------------ @@ -618,17 +619,21 @@ void QWindowSystemInterface::deferredFlushWindowSystemEvents(QEventLoop::Process QWindowSystemInterfacePrivate::eventsFlushed.wakeOne(); } -void QWindowSystemInterface::flushWindowSystemEvents(QEventLoop::ProcessEventsFlags flags) +/*! + Make Qt Gui process all events on the event queue immediately. Return the + accepted state for the last event on the queue. +*/ +bool QWindowSystemInterface::flushWindowSystemEvents(QEventLoop::ProcessEventsFlags flags) { const int count = QWindowSystemInterfacePrivate::windowSystemEventQueue.count(); if (!count) - return; + return false; if (!QGuiApplication::instance()) { qWarning().nospace() << "QWindowSystemInterface::flushWindowSystemEvents() invoked after " "QGuiApplication destruction, discarding " << count << " events."; QWindowSystemInterfacePrivate::windowSystemEventQueue.clear(); - return; + return false; } if (QThread::currentThread() != QGuiApplication::instance()->thread()) { QMutexLocker locker(&QWindowSystemInterfacePrivate::flushEventMutex); @@ -638,6 +643,7 @@ void QWindowSystemInterface::flushWindowSystemEvents(QEventLoop::ProcessEventsFl } else { sendWindowSystemEvents(flags); } + return QWindowSystemInterfacePrivate::eventAccepted.load() > 0; } bool QWindowSystemInterface::sendWindowSystemEvents(QEventLoop::ProcessEventsFlags flags) @@ -659,6 +665,13 @@ bool QWindowSystemInterface::sendWindowSystemEvents(QEventLoop::ProcessEventsFla nevents++; QGuiApplicationPrivate::processWindowSystemEvent(event); } + + // Record the accepted state for the processed event + // (excluding flush events). This state can then be + // returned by flushWindowSystemEvents(). + if (event->type != QWindowSystemInterfacePrivate::FlushEvents) + QWindowSystemInterfacePrivate::eventAccepted.store(event->eventAccepted); + delete event; } diff --git a/src/gui/kernel/qwindowsysteminterface.h b/src/gui/kernel/qwindowsysteminterface.h index ace1a4fe24..3e0b788c0f 100644 --- a/src/gui/kernel/qwindowsysteminterface.h +++ b/src/gui/kernel/qwindowsysteminterface.h @@ -213,7 +213,7 @@ public: // For event dispatcher implementations static bool sendWindowSystemEvents(QEventLoop::ProcessEventsFlags flags); static void setSynchronousWindowSystemEvents(bool enable); - static void flushWindowSystemEvents(QEventLoop::ProcessEventsFlags flags = QEventLoop::AllEvents); + static bool flushWindowSystemEvents(QEventLoop::ProcessEventsFlags flags = QEventLoop::AllEvents); static void deferredFlushWindowSystemEvents(QEventLoop::ProcessEventsFlags flags); static int windowSystemEventsQueued(); }; diff --git a/src/gui/kernel/qwindowsysteminterface_p.h b/src/gui/kernel/qwindowsysteminterface_p.h index cc0ca6bf81..430800f137 100644 --- a/src/gui/kernel/qwindowsysteminterface_p.h +++ b/src/gui/kernel/qwindowsysteminterface_p.h @@ -51,6 +51,7 @@ #include #include #include +#include QT_BEGIN_NAMESPACE @@ -488,6 +489,7 @@ public: static QWaitCondition eventsFlushed; static QMutex flushEventMutex; + static QAtomicInt eventAccepted; static QList fromNativeTouchPoints(const QList &points, -- cgit v1.2.3 From ee767c838a0e0a91394a24b21d44d862d3b60416 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Wed, 29 Apr 2015 13:17:31 +0200 Subject: Implement threaded synchronous WS events MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make handleWindowSystemEvent() support being called from secondary threads in synchronousWindowSystemEvent mode. This is implemented by posting the event to the Gui event queue (which will wake the Qt Gui thread), and then calling flushWindowSystemEvents which will block the calling thread until the event has been processed. Change-Id: I7e8e68c1e0290c17105563268e316b0f8205b3ce Reviewed-by: Jørgen Lind --- src/gui/kernel/qwindowsysteminterface.cpp | 33 +++++++++++++++++++++++-------- src/gui/kernel/qwindowsysteminterface_p.h | 1 + 2 files changed, 26 insertions(+), 8 deletions(-) (limited to 'src/gui') diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp index 01f4be6dd0..0a9da737dc 100644 --- a/src/gui/kernel/qwindowsysteminterface.cpp +++ b/src/gui/kernel/qwindowsysteminterface.cpp @@ -442,18 +442,33 @@ void QWindowSystemInterfacePrivate::removeWindowSystemEvent(WindowSystemEvent *e windowSystemEventQueue.remove(event); } +void QWindowSystemInterfacePrivate::postWindowSystemEvent(WindowSystemEvent *ev) +{ + windowSystemEventQueue.append(ev); + QAbstractEventDispatcher *dispatcher = QGuiApplicationPrivate::qt_qpa_core_dispatcher(); + if (dispatcher) + dispatcher->wakeUp(); +} + bool QWindowSystemInterfacePrivate::handleWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent *ev) { bool accepted = true; if (synchronousWindowSystemEvents) { - QGuiApplicationPrivate::processWindowSystemEvent(ev); - accepted = ev->eventAccepted; - delete ev; + if (QThread::currentThread() == QGuiApplication::instance()->thread()) { + // Process the event immediately on the current thread and return the accepted state. + QGuiApplicationPrivate::processWindowSystemEvent(ev); + accepted = ev->eventAccepted; + delete ev; + } else { + // Post the event on the Qt main thread queue and flush the queue. + // This will wake up the Gui thread which will process the event. + // Return the accepted state for the last event on the queue, + // which is the event posted by this function. + postWindowSystemEvent(ev); + accepted = QWindowSystemInterface::flushWindowSystemEvents(); + } } else { - windowSystemEventQueue.append(ev); - QAbstractEventDispatcher *dispatcher = QGuiApplicationPrivate::qt_qpa_core_dispatcher(); - if (dispatcher) - dispatcher->wakeUp(); + postWindowSystemEvent(ev); } return accepted; } @@ -636,9 +651,11 @@ bool QWindowSystemInterface::flushWindowSystemEvents(QEventLoop::ProcessEventsFl return false; } if (QThread::currentThread() != QGuiApplication::instance()->thread()) { + // Post a FlushEvents event which will trigger a call back to + // deferredFlushWindowSystemEvents from the Gui thread. QMutexLocker locker(&QWindowSystemInterfacePrivate::flushEventMutex); QWindowSystemInterfacePrivate::FlushEventsEvent *e = new QWindowSystemInterfacePrivate::FlushEventsEvent(flags); - QWindowSystemInterfacePrivate::handleWindowSystemEvent(e); + QWindowSystemInterfacePrivate::postWindowSystemEvent(e); QWindowSystemInterfacePrivate::eventsFlushed.wait(&QWindowSystemInterfacePrivate::flushEventMutex); } else { sendWindowSystemEvents(flags); diff --git a/src/gui/kernel/qwindowsysteminterface_p.h b/src/gui/kernel/qwindowsysteminterface_p.h index 430800f137..e48d1e965b 100644 --- a/src/gui/kernel/qwindowsysteminterface_p.h +++ b/src/gui/kernel/qwindowsysteminterface_p.h @@ -482,6 +482,7 @@ public: static WindowSystemEvent *getNonUserInputWindowSystemEvent(); static WindowSystemEvent *peekWindowSystemEvent(EventType t); static void removeWindowSystemEvent(WindowSystemEvent *event); + static void postWindowSystemEvent(WindowSystemEvent *ev); static bool handleWindowSystemEvent(WindowSystemEvent *ev); static QElapsedTimer eventTime; -- cgit v1.2.3 From c4015f13f383d8fa418fff5961fc190c7fcbab2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Mon, 27 Apr 2015 22:32:57 +0200 Subject: Document handleWindowSystemEvent() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Document asynchronous and synchronous mode behavior. Change-Id: I2dc1256af5b3a8014025c89c65d41480f18f0701 Reviewed-by: Jørgen Lind --- src/gui/kernel/qwindowsysteminterface.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/gui') diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp index 0a9da737dc..3500792f4e 100644 --- a/src/gui/kernel/qwindowsysteminterface.cpp +++ b/src/gui/kernel/qwindowsysteminterface.cpp @@ -450,6 +450,19 @@ void QWindowSystemInterfacePrivate::postWindowSystemEvent(WindowSystemEvent *ev) dispatcher->wakeUp(); } +/*! + Handles a window system event. + + By default this function posts the event on the window system event queue and + wakes the Gui event dispatcher. Qt Gui will then handle the event asynchonously + at a later point. The return value is not used in asynchronous mode and will + always be true. + + In synchronous mode Qt Gui will process the event immediately. The return value + indicates if Qt accepted the event. + + \sa flushWindowSystemEvents(), setSynchronousWindowSystemEvents() +*/ bool QWindowSystemInterfacePrivate::handleWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent *ev) { bool accepted = true; -- cgit v1.2.3 From 8c1fcbcd83214d7cc7efc63c12f907538664821e Mon Sep 17 00:00:00 2001 From: Samuel Nevala Date: Wed, 26 Aug 2015 15:30:36 +0300 Subject: Declare StandardButton & ButtonRole types for cross-thread use. On windows phone native dialog interaction is handled from XMAL thread. Declare and register dialog helpers StandardButton and ButtonRole for cross-thread usage. Change-Id: Ic1842a5af8a1122fdffb766b4f723d272bdbcac2 Task-Id: QTBUG-47941 Reviewed-by: Andrew Knight --- src/gui/kernel/qplatformdialoghelper.cpp | 2 ++ src/gui/kernel/qplatformdialoghelper.h | 5 +++++ 2 files changed, 7 insertions(+) (limited to 'src/gui') diff --git a/src/gui/kernel/qplatformdialoghelper.cpp b/src/gui/kernel/qplatformdialoghelper.cpp index 20dc716d89..f69efe0935 100644 --- a/src/gui/kernel/qplatformdialoghelper.cpp +++ b/src/gui/kernel/qplatformdialoghelper.cpp @@ -119,6 +119,8 @@ static const int buttonRoleLayouts[2][5][14] = QPlatformDialogHelper::QPlatformDialogHelper() { + qRegisterMetaType(); + qRegisterMetaType(); } QPlatformDialogHelper::~QPlatformDialogHelper() diff --git a/src/gui/kernel/qplatformdialoghelper.h b/src/gui/kernel/qplatformdialoghelper.h index ec88770862..936dbdfa89 100644 --- a/src/gui/kernel/qplatformdialoghelper.h +++ b/src/gui/kernel/qplatformdialoghelper.h @@ -160,6 +160,11 @@ Q_SIGNALS: void reject(); }; +QT_END_NAMESPACE +Q_DECLARE_METATYPE(QPlatformDialogHelper::StandardButton) +Q_DECLARE_METATYPE(QPlatformDialogHelper::ButtonRole) +QT_BEGIN_NAMESPACE + class Q_GUI_EXPORT QColorDialogOptions { public: -- cgit v1.2.3 From 54dbdc26bacd3ab776c99ebef734404ef2e08ce5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 17 Aug 2015 17:59:06 +0200 Subject: Move min left/right bearing calculations to QFontEngine baseclass The logic used in the FreeType font engine can be generalized and move to the QFontEngine baseclass. This allows the CoreText font engine to correctly report the minimum left/right bearings, which decreases the chance that an optimization in QTextLayout's line breaking algorithm will produce wrong results. The calculation of left and right bearing has been moved to the glyph_metrics_t type to reduce code duplication. This allows us to use the with and height of the bounding box to determine if the glyph has any contours. Change-Id: I864697d3f31ed56f22f04666199b6c5023c5e585 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/gui/text/qfontengine.cpp | 60 ++++++++++++++++++++++++++++++++++++----- src/gui/text/qfontengine_ft.cpp | 49 --------------------------------- src/gui/text/qfontengine_ft_p.h | 4 --- src/gui/text/qfontengine_p.h | 8 ++++-- src/gui/text/qtextengine_p.h | 16 +++++++++++ src/gui/text/qtextlayout.cpp | 13 ++++++--- 6 files changed, 86 insertions(+), 64 deletions(-) (limited to 'src/gui') diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index 2087bad9f6..102946b545 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -54,6 +54,7 @@ #include #include +#include QT_BEGIN_NAMESPACE @@ -235,10 +236,14 @@ Q_AUTOTEST_EXPORT QList QFontEngine_stopCollectingEngines() // QFontEngine +#define kBearingNotInitialized std::numeric_limits::max() + QFontEngine::QFontEngine(Type type) : m_type(type), ref(0), font_(0), font_destroy_func(0), - face_(0), face_destroy_func(0) + face_(0), face_destroy_func(0), + m_minLeftBearing(kBearingNotInitialized), + m_minRightBearing(kBearingNotInitialized) { faceData.user_data = this; faceData.get_font_table = qt_get_font_table_default; @@ -562,11 +567,55 @@ void QFontEngine::getGlyphPositions(const QGlyphLayout &glyphs, const QTransform void QFontEngine::getGlyphBearings(glyph_t glyph, qreal *leftBearing, qreal *rightBearing) { glyph_metrics_t gi = boundingBox(glyph); - bool isValid = gi.isValid(); if (leftBearing != 0) - *leftBearing = isValid ? gi.x.toReal() : 0.0; + *leftBearing = gi.leftBearing().toReal(); if (rightBearing != 0) - *rightBearing = isValid ? (gi.xoff - gi.x - gi.width).toReal() : 0.0; + *rightBearing = gi.rightBearing().toReal(); +} + +qreal QFontEngine::minLeftBearing() const +{ + if (m_minLeftBearing == kBearingNotInitialized) + minRightBearing(); // Initializes both (see below) + + return m_minLeftBearing; +} + +qreal QFontEngine::minRightBearing() const +{ + if (m_minRightBearing == kBearingNotInitialized) { + + // To balance performance and correctness we only look at a subset of the + // possible glyphs in the font, based on which characters are more likely + // to have a left or right bearing. + static const ushort characterSubset[] = { + '(', 'C', 'F', 'K', 'V', 'X', 'Y', ']', '_', 'f', 'r', '|', + 127, 205, 645, 884, 922, 1070, 12386 + }; + + // The font may have minimum bearings larger than 0, so we have to start at the max + m_minLeftBearing = m_minRightBearing = std::numeric_limits::max(); + + for (uint i = 0; i < (sizeof(characterSubset) / sizeof(ushort)); ++i) { + const glyph_t glyph = glyphIndex(characterSubset[i]); + if (!glyph) + continue; + + glyph_metrics_t glyphMetrics = const_cast(this)->boundingBox(glyph); + + // Glyphs with no contours shouldn't contribute to bearings + if (!glyphMetrics.width || !glyphMetrics.height) + continue; + + m_minLeftBearing = qMin(m_minLeftBearing, glyphMetrics.leftBearing().toReal()); + m_minRightBearing = qMin(m_minRightBearing, glyphMetrics.rightBearing().toReal()); + } + + if (m_minLeftBearing == kBearingNotInitialized || m_minRightBearing == kBearingNotInitialized) + qWarning() << "Failed to compute left/right minimum bearings for" << fontDef.family; + } + + return m_minRightBearing; } glyph_metrics_t QFontEngine::tightBoundingBox(const QGlyphLayout &glyphs) @@ -1469,8 +1518,7 @@ QFixed QFontEngine::lastRightBearing(const QGlyphLayout &glyphs, bool round) glyph_t glyph = glyphs.glyphs[glyphs.numGlyphs - 1]; glyph_metrics_t gi = boundingBox(glyph); if (gi.isValid()) - return round ? QFixed(qRound(gi.xoff - gi.x - gi.width)) - : QFixed(gi.xoff - gi.x - gi.width); + return round ? qRound(gi.rightBearing()) : gi.rightBearing(); } return 0; } diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp index 246df127ad..0d28785aa1 100644 --- a/src/gui/text/qfontengine_ft.cpp +++ b/src/gui/text/qfontengine_ft.cpp @@ -688,7 +688,6 @@ bool QFontEngineFT::init(FaceId faceId, bool antialias, GlyphFormat format, symbol = bool(fontDef.family.contains(QLatin1String("symbol"), Qt::CaseInsensitive)); } - lbearing = rbearing = SHRT_MIN; freetype->computeSize(fontDef, &xsize, &ysize, &defaultGlyphSet.outline_drawing); FT_Face face = lockFace(); @@ -1258,54 +1257,6 @@ qreal QFontEngineFT::maxCharWidth() const return metrics.max_advance >> 6; } -static const ushort char_table[] = { - 40, - 67, - 70, - 75, - 86, - 88, - 89, - 91, - 95, - 102, - 114, - 124, - 127, - 205, - 645, - 884, - 922, - 1070, - 12386 -}; - -static const int char_table_entries = sizeof(char_table)/sizeof(ushort); - - -qreal QFontEngineFT::minLeftBearing() const -{ - if (lbearing == SHRT_MIN) - (void) minRightBearing(); // calculates both - return lbearing.toReal(); -} - -qreal QFontEngineFT::minRightBearing() const -{ - if (rbearing == SHRT_MIN) { - lbearing = rbearing = 0; - for (int i = 0; i < char_table_entries; ++i) { - const glyph_t glyph = glyphIndex(char_table[i]); - if (glyph != 0) { - glyph_metrics_t gi = const_cast(this)->boundingBox(glyph); - lbearing = qMin(lbearing, gi.x); - rbearing = qMin(rbearing, (gi.xoff - gi.x - gi.width)); - } - } - } - return rbearing.toReal(); -} - QFixed QFontEngineFT::lineThickness() const { return line_thickness; diff --git a/src/gui/text/qfontengine_ft_p.h b/src/gui/text/qfontengine_ft_p.h index b81e51bf2e..83f9a4ef3d 100644 --- a/src/gui/text/qfontengine_ft_p.h +++ b/src/gui/text/qfontengine_ft_p.h @@ -208,8 +208,6 @@ private: virtual QFixed averageCharWidth() const Q_DECL_OVERRIDE; virtual qreal maxCharWidth() const Q_DECL_OVERRIDE; - virtual qreal minLeftBearing() const Q_DECL_OVERRIDE; - virtual qreal minRightBearing() const Q_DECL_OVERRIDE; virtual QFixed lineThickness() const Q_DECL_OVERRIDE; virtual QFixed underlinePosition() const Q_DECL_OVERRIDE; @@ -324,8 +322,6 @@ private: int xsize; int ysize; - mutable QFixed lbearing; - mutable QFixed rbearing; QFixed line_thickness; QFixed underline_position; diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h index 780104bc37..5282a4033e 100644 --- a/src/gui/text/qfontengine_p.h +++ b/src/gui/text/qfontengine_p.h @@ -214,8 +214,8 @@ public: virtual QFixed underlinePosition() const; virtual qreal maxCharWidth() const = 0; - virtual qreal minLeftBearing() const { return qreal(); } - virtual qreal minRightBearing() const { return qreal(); } + virtual qreal minLeftBearing() const; + virtual qreal minRightBearing() const; virtual void getGlyphBearings(glyph_t glyph, qreal *leftBearing = 0, qreal *rightBearing = 0); @@ -323,6 +323,10 @@ private: private: QVariant m_userData; + + mutable qreal m_minLeftBearing; + mutable qreal m_minRightBearing; + }; Q_DECLARE_OPERATORS_FOR_FLAGS(QFontEngine::ShaperFlags) diff --git a/src/gui/text/qtextengine_p.h b/src/gui/text/qtextengine_p.h index d2b39f274c..160daa0cfd 100644 --- a/src/gui/text/qtextengine_p.h +++ b/src/gui/text/qtextengine_p.h @@ -107,6 +107,22 @@ struct Q_GUI_EXPORT glyph_metrics_t glyph_metrics_t transformed(const QTransform &xform) const; inline bool isValid() const {return x != 100000 && y != 100000;} + + inline QFixed leftBearing() const + { + if (!isValid()) + return QFixed(); + + return x; + } + + inline QFixed rightBearing() const + { + if (!isValid()) + return QFixed(); + + return xoff - x - width; + } }; Q_DECLARE_TYPEINFO(glyph_metrics_t, Q_PRIMITIVE_TYPE); diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index 0c729c74d1..d68a59fae3 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -1966,9 +1966,16 @@ void QTextLine::layout_helper(int maxGlyphs) // end up breaking due to the current glyph being too wide. QFixed previousRightBearing = lbh.rightBearing; - // We ignore the right bearing if the minimum negative bearing is too little to - // expand the text beyond the edge. - if (lbh.calculateNewWidth(line) - lbh.minimumRightBearing > line.width) + // We skip calculating the right bearing if the minimum negative bearing is too + // small to possibly expand the text beyond the edge. Note that this optimization + // will in some cases fail, as the minimum right bearing reported by the font + // engine may not cover all the glyphs in the font. The result is that we think + // we don't need to break at the current glyph (because the right bearing is 0), + // and when we then end up breaking on the next glyph we compute the right bearing + // and end up with a line width that is slightly larger width than what was requested. + // Unfortunately we can't remove this optimization as it will slow down text + // layouting significantly, so we accept the slight correctnes issue. + if ((lbh.calculateNewWidth(line) + qAbs(lbh.minimumRightBearing)) > line.width) lbh.calculateRightBearing(); if (lbh.checkFullOtherwiseExtend(line)) { -- cgit v1.2.3 From 4bbdfaa8ff5b6087b3edf4676ea87a4c0af3f700 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 4 Sep 2015 16:20:54 +0200 Subject: Fix some qdoc warnings. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit qtbase/src/corelib/io/qdebug.cpp:698: warning: Class QDebugStateSaver has no \inmodule command; using project name by default: QtCore qtbase/src/gui/opengl/qopenglframebufferobject.cpp:1138: warning: Can't link to 'takeTextures()' qtbase/src/gui/opengl/qopenglframebufferobject.cpp:1159: warning: Can't link to 'takeTextures()' qtbase/src/gui/opengl/qopenglframebufferobject.cpp:953: warning: No such parameter 'height' in QOpenGLFramebufferObject::addColorAttachment() qtbase/src/gui/opengl/qopenglframebufferobject.cpp:953: warning: No such parameter 'width' in QOpenGLFramebufferObject::addColorAttachment() qtbase/src/gui/opengl/qopenglframebufferobject.cpp:953: warning: Undocumented parameter 'size' in QOpenGLFramebufferObject::addColorAttachment() qtbase/src/gui/painting/qpaintdevice.qdoc:80: warning: Undocumented enum item 'PdmDevicePixelRatioScaled' in QPaintDevice::PaintDeviceMetric qtbase/src/testlib/qbenchmarkmetric.cpp:154: warning: Invalid use of '\relates' (already a member of 'QTest') qtbase/src/testlib/qbenchmarkmetric.cpp:81: warning: Invalid use of '\relates' (already a member of 'QTest') qtbase/src/widgets/dialogs/qdialog.cpp:152: warning: Can't link to 'QCloseEvent::ignore()' qtbase/src/widgets/dialogs/qdialog.cpp:557: warning: Can't link to 'QApplication::quit()' qtbase/src/widgets/kernel/qwidget.cpp:8326: warning: Can't link to 'QCloseEvent::accept()' qtbase/src/widgets/kernel/qwidget.cpp:8326: warning: Can't link to 'QCloseEvent::ignore()' qtbase/src/widgets/kernel/qwidget.cpp:9300: warning: Can't link to 'QWheelEvent::accept()' qtbase/src/widgets/kernel/qwidget.cpp:9300: warning: Can't link to 'QWheelEvent::ignore()' qtbase/src/widgets/kernel/qwidget.cpp:9321: warning: Can't link to 'QTabletEvent::accept()' qtbase/src/widgets/kernel/qwidget.cpp:9321: warning: Can't link to 'QTabletEvent::ignore()' qtbase/src/widgets/kernel/qwidget.cpp:9373: warning: Can't link to 'QKeyEvent::ignore()' Change-Id: I97ae85398181645c1054c303e5c8a87deb619409 Reviewed-by: Martin Smith Reviewed-by: Topi Reiniö --- src/gui/opengl/qopenglframebufferobject.cpp | 8 ++++---- src/gui/painting/qpaintdevice.qdoc | 8 +++++++- 2 files changed, 11 insertions(+), 5 deletions(-) (limited to 'src/gui') diff --git a/src/gui/opengl/qopenglframebufferobject.cpp b/src/gui/opengl/qopenglframebufferobject.cpp index 3596591cf6..0e162713ce 100644 --- a/src/gui/opengl/qopenglframebufferobject.cpp +++ b/src/gui/opengl/qopenglframebufferobject.cpp @@ -951,8 +951,8 @@ QOpenGLFramebufferObject::~QOpenGLFramebufferObject() } /*! - Creates and attaches an additional texture or renderbuffer of size \a width - and \a height. + Creates and attaches an additional texture or renderbuffer of \a size width + and height. There is always an attachment at GL_COLOR_ATTACHMENT0. Call this function to set up additional attachments at GL_COLOR_ATTACHMENT1, @@ -1142,7 +1142,7 @@ GLuint QOpenGLFramebufferObject::texture() const \since 5.6 - \sa takeTextures(), texture() + \sa takeTexture(), texture() */ QVector QOpenGLFramebufferObject::textures() const { @@ -1172,7 +1172,7 @@ QVector QOpenGLFramebufferObject::textures() const \since 5.3 - \sa texture(), bind(), release(), takeTextures() + \sa texture(), bind(), release() */ GLuint QOpenGLFramebufferObject::takeTexture() { diff --git a/src/gui/painting/qpaintdevice.qdoc b/src/gui/painting/qpaintdevice.qdoc index a83acdd21a..ef5deb154d 100644 --- a/src/gui/painting/qpaintdevice.qdoc +++ b/src/gui/painting/qpaintdevice.qdoc @@ -118,7 +118,13 @@ values are 1 for normal-dpi displays and 2 for high-dpi "retina" displays. - \sa metric() + \value PdmDevicePixelRatioScaled The scaled device pixel ratio for the device. + This is identical to PdmDevicePixelRatio, except that the value is scaled by a + constant factor in order to support paint devices with fractional scale factors. + The constant scaling factor used is devicePixelRatioFScale(). This enum value + has been introduced in Qt 5.6. + + \sa metric(), devicePixelRatioF() */ /*! -- cgit v1.2.3 From 8cbaea441a8c9adea6ba804b76bf3bd1e79f77b7 Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Fri, 4 Sep 2015 16:52:04 +0200 Subject: Notify when the primary screen changes Makes it possible to notify that the QGuiApplication::primaryScreen has changed. XCB backend adopts the new API, as it was accessing QGuiApplication private API directly. Change-Id: Icde05c44138265f865fa42d2cd6974c552fdc5e2 Task-number: QTBUG-38404 Task-number: QTBUG-40659 Reviewed-by: Frederik Gladhorn Reviewed-by: Shawn Rutledge --- src/gui/kernel/qguiapplication.cpp | 12 ++++++++++ src/gui/kernel/qguiapplication.h | 2 ++ src/gui/kernel/qplatformintegration.cpp | 39 ++++++++++++++++++++++++++++++++- src/gui/kernel/qplatformintegration.h | 4 ++++ src/gui/kernel/qplatformscreen.cpp | 2 +- 5 files changed, 57 insertions(+), 2 deletions(-) (limited to 'src/gui') diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index d0aab734dd..87bd7ea5de 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -921,6 +921,18 @@ QList QGuiApplication::screens() \since 5.4 */ +/*! + \fn void QGuiApplication::primaryScreenChanged(QScreen *screen) + + This signal is emitted whenever the primary \a screen changes. This way + applications can keep track of the primaryScreen and react if there is a + new primary screen. + + \sa primaryScreen + + \since 5.6 +*/ + /*! Returns the highest screen device pixel ratio found on diff --git a/src/gui/kernel/qguiapplication.h b/src/gui/kernel/qguiapplication.h index c89268d8d4..d995387d66 100644 --- a/src/gui/kernel/qguiapplication.h +++ b/src/gui/kernel/qguiapplication.h @@ -70,6 +70,7 @@ class Q_GUI_EXPORT QGuiApplication : public QCoreApplication Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection NOTIFY layoutDirectionChanged) Q_PROPERTY(QString platformName READ platformName STORED false) Q_PROPERTY(bool quitOnLastWindowClosed READ quitOnLastWindowClosed WRITE setQuitOnLastWindowClosed) + Q_PROPERTY(QScreen *primaryScreen READ primaryScreen NOTIFY primaryScreenChanged STORED false) public: #ifdef Q_QDOC @@ -158,6 +159,7 @@ Q_SIGNALS: void fontDatabaseChanged(); void screenAdded(QScreen *screen); void screenRemoved(QScreen *screen); + void primaryScreenChanged(QScreen *screen); void lastWindowClosed(); void focusObjectChanged(QObject *focusObject); void focusWindowChanged(QWindow *focusWindow); diff --git a/src/gui/kernel/qplatformintegration.cpp b/src/gui/kernel/qplatformintegration.cpp index e935907a62..457a420148 100644 --- a/src/gui/kernel/qplatformintegration.cpp +++ b/src/gui/kernel/qplatformintegration.cpp @@ -456,6 +456,24 @@ void QPlatformIntegration::screenAdded(QPlatformScreen *ps, bool isPrimary) QGuiApplicationPrivate::screen_list.append(screen); } emit qGuiApp->screenAdded(screen); + + if (isPrimary) + emit qGuiApp->primaryScreenChanged(screen); +} + +/*! + Just removes the screen, call destroyScreen instead. + + \sa destroyScreen() +*/ + +void QPlatformIntegration::removeScreen(QScreen *screen) +{ + const bool wasPrimary = (!QGuiApplicationPrivate::screen_list.isEmpty() && QGuiApplicationPrivate::screen_list[0] == screen); + QGuiApplicationPrivate::screen_list.removeOne(screen); + + if (wasPrimary && qGuiApp && !QGuiApplicationPrivate::screen_list.isEmpty()) + emit qGuiApp->primaryScreenChanged(QGuiApplicationPrivate::screen_list[0]); } /*! @@ -469,11 +487,30 @@ void QPlatformIntegration::screenAdded(QPlatformScreen *ps, bool isPrimary) void QPlatformIntegration::destroyScreen(QPlatformScreen *screen) { QScreen *qScreen = screen->screen(); - QGuiApplicationPrivate::screen_list.removeOne(qScreen); + removeScreen(qScreen); delete qScreen; delete screen; } +/*! + Should be called whenever the primary screen changes. + + When the screen specified as primary changes, this method will notify + QGuiApplication and emit the QGuiApplication::primaryScreenChanged signal. + */ + +void QPlatformIntegration::setPrimaryScreen(QPlatformScreen *newPrimary) +{ + QScreen* newPrimaryScreen = newPrimary->screen(); + int idx = QGuiApplicationPrivate::screen_list.indexOf(newPrimaryScreen); + Q_ASSERT(idx >= 0); + if (idx == 0) + return; + + QGuiApplicationPrivate::screen_list.swap(0, idx); + emit qGuiApp->primaryScreenChanged(newPrimaryScreen); +} + QStringList QPlatformIntegration::themeNames() const { return QStringList(); diff --git a/src/gui/kernel/qplatformintegration.h b/src/gui/kernel/qplatformintegration.h index 2aa502b3d2..00c50a9861 100644 --- a/src/gui/kernel/qplatformintegration.h +++ b/src/gui/kernel/qplatformintegration.h @@ -172,9 +172,13 @@ public: virtual QOpenGLContext::OpenGLModuleType openGLModuleType(); #endif virtual void setApplicationIcon(const QIcon &icon) const; + + void removeScreen(QScreen *screen); + protected: void screenAdded(QPlatformScreen *screen, bool isPrimary = false); void destroyScreen(QPlatformScreen *screen); + void setPrimaryScreen(QPlatformScreen *newPrimary); }; QT_END_NAMESPACE diff --git a/src/gui/kernel/qplatformscreen.cpp b/src/gui/kernel/qplatformscreen.cpp index 2fb53fe16b..d1d8eba697 100644 --- a/src/gui/kernel/qplatformscreen.cpp +++ b/src/gui/kernel/qplatformscreen.cpp @@ -56,7 +56,7 @@ QPlatformScreen::~QPlatformScreen() Q_D(QPlatformScreen); if (d->screen) { qWarning("Manually deleting a QPlatformScreen. Call QPlatformIntegration::destroyScreen instead."); - QGuiApplicationPrivate::screen_list.removeOne(d->screen); + QGuiApplicationPrivate::platformIntegration()->removeScreen(d->screen); delete d->screen; } } -- cgit v1.2.3 From c22eceb7d097ebfe253509d001103a9a0a4a1171 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Thu, 3 Sep 2015 15:20:47 +0200 Subject: Deduplicate some code in QWindowSystemInterface MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 66050f2a changed a few exported functions used by testlib so that they sent events synchronously, by calling QGuiApp processWindowSystemEvent directly. The same effect can be achieved by setting setSynchronousWindowSystemEvents to true before calling the normal QPA functions. Change-Id: Id4c67f7d315a5607885c738ca54516434125b24e Reviewed-by: Lars Knoll Reviewed-by: Tor Arne Vestbø --- src/gui/kernel/qwindowsysteminterface.cpp | 79 +++++++++++++++---------------- 1 file changed, 38 insertions(+), 41 deletions(-) (limited to 'src/gui') diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp index 3500792f4e..78bce0f0e3 100644 --- a/src/gui/kernel/qwindowsysteminterface.cpp +++ b/src/gui/kernel/qwindowsysteminterface.cpp @@ -901,26 +901,23 @@ Q_GUI_EXPORT QDebug operator<<(QDebug dbg, const QWindowSystemInterface::TouchPo } #endif +// The following functions are used by testlib, and need to be synchronous to avoid +// race conditions with plugins delivering native events from secondary threads. + Q_GUI_EXPORT void qt_handleMouseEvent(QWindow *w, const QPointF &local, const QPointF &global, Qt::MouseButtons b, Qt::KeyboardModifiers mods, int timestamp) { - QWindowSystemInterfacePrivate::MouseEvent e(w, timestamp, local, global, b, mods, Qt::MouseEventNotSynthesized); - QGuiApplicationPrivate::processWindowSystemEvent(&e); + bool wasSynchronous = QWindowSystemInterfacePrivate::synchronousWindowSystemEvents; + QWindowSystemInterface::setSynchronousWindowSystemEvents(true); + QWindowSystemInterface::handleMouseEvent(w, timestamp, local, global, b, mods); + QWindowSystemInterface::setSynchronousWindowSystemEvents(wasSynchronous); } Q_GUI_EXPORT void qt_handleKeyEvent(QWindow *w, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1) { - unsigned long timestamp = QWindowSystemInterfacePrivate::eventTime.elapsed(); - - // This is special handling needed for OS X which eventually will call sendEvent(), on other platforms - // this might not be safe, e.g., on Android. See: QGuiApplicationPrivate::processKeyEvent() for - // shortcut overriding on other platforms. -#if defined(Q_OS_OSX) - if (t == QEvent::KeyPress && QWindowSystemInterface::tryHandleShortcutEvent(w, timestamp, k, mods, text)) - return; -#endif // Q_OS_OSX - - QWindowSystemInterfacePrivate::KeyEvent e(w, timestamp, t, k, mods, text, autorep, count); - QGuiApplicationPrivate::processWindowSystemEvent(&e); + bool wasSynchronous = QWindowSystemInterfacePrivate::synchronousWindowSystemEvents; + QWindowSystemInterface::setSynchronousWindowSystemEvents(true); + QWindowSystemInterface::handleKeyEvent(w, t, k, mods, text, autorep, count); + QWindowSystemInterface::setSynchronousWindowSystemEvents(wasSynchronous); } Q_GUI_EXPORT bool qt_sendShortcutOverrideEvent(QObject *o, ulong timestamp, int k, Qt::KeyboardModifiers mods, const QString &text = QString(), bool autorep = false, ushort count = 1) @@ -928,37 +925,37 @@ Q_GUI_EXPORT bool qt_sendShortcutOverrideEvent(QObject *o, ulong timestamp, int return QWindowSystemInterface::tryHandleShortcutEventToObject(o, timestamp, k, mods, text, autorep, count); } -Q_GUI_EXPORT void qt_handleTouchEvent(QWindow *w, QTouchDevice *device, - const QList &points, - Qt::KeyboardModifiers mods = Qt::NoModifier) +static QWindowSystemInterface::TouchPoint touchPoint(const QTouchEvent::TouchPoint& pt) { - unsigned long timestamp = QWindowSystemInterfacePrivate::eventTime.elapsed(); - - if (!points.size()) // Touch events must have at least one point - return; - - if (!QTouchDevicePrivate::isRegistered(device)) // Disallow passing bogus, non-registered devices. - return; - - QEvent::Type type; - Qt::TouchPointStates states; + QWindowSystemInterface::TouchPoint p; + p.id = pt.id(); + p.flags = pt.flags(); + p.normalPosition = pt.normalizedPos(); + p.area = pt.screenRect(); + p.pressure = pt.pressure(); + p.state = pt.state(); + p.velocity = pt.velocity(); + p.rawPositions = pt.rawScreenPositions(); + return p; +} +static QList touchPointList(const QList& pointList) +{ + QList newList; - QList::const_iterator point = points.constBegin(); - QList::const_iterator end = points.constEnd(); - while (point != end) { - states |= point->state(); - ++point; - } + Q_FOREACH (QTouchEvent::TouchPoint p, pointList) + newList.append(touchPoint(p)); - // Determine the event type based on the combined point states. - type = QEvent::TouchUpdate; - if (states == Qt::TouchPointPressed) - type = QEvent::TouchBegin; - else if (states == Qt::TouchPointReleased) - type = QEvent::TouchEnd; + return newList; +} - QWindowSystemInterfacePrivate::TouchEvent e(w, timestamp, type, device, points, mods); - QGuiApplicationPrivate::processWindowSystemEvent(&e); +Q_GUI_EXPORT void qt_handleTouchEvent(QWindow *w, QTouchDevice *device, + const QList &points, + Qt::KeyboardModifiers mods = Qt::NoModifier) +{ + bool wasSynchronous = QWindowSystemInterfacePrivate::synchronousWindowSystemEvents; + QWindowSystemInterface::setSynchronousWindowSystemEvents(true); + QWindowSystemInterface::handleTouchEvent(w, device, touchPointList(points), mods); + QWindowSystemInterface::setSynchronousWindowSystemEvents(wasSynchronous); } QWindowSystemEventHandler::~QWindowSystemEventHandler() -- cgit v1.2.3 From 30335364a114dd145bad21e9c2519ac390cd73b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Fri, 4 Sep 2015 17:56:14 +0200 Subject: Update QPA handleExtendedKeyEvent to return the accepted state of the event MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ie85a4e987eb069d4dd0dbd39860f299a7204b585 Reviewed-by: Morten Johan Sørvig Reviewed-by: Tor Arne Vestbø --- src/gui/kernel/qwindowsysteminterface.cpp | 8 ++++---- src/gui/kernel/qwindowsysteminterface.h | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src/gui') diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp index 78bce0f0e3..91a935ad0f 100644 --- a/src/gui/kernel/qwindowsysteminterface.cpp +++ b/src/gui/kernel/qwindowsysteminterface.cpp @@ -324,18 +324,18 @@ bool QWindowSystemInterface::handleKeyEvent(QWindow *tlw, ulong timestamp, QEven return QWindowSystemInterfacePrivate::handleWindowSystemEvent(e); } -void QWindowSystemInterface::handleExtendedKeyEvent(QWindow *w, QEvent::Type type, int key, Qt::KeyboardModifiers modifiers, +bool QWindowSystemInterface::handleExtendedKeyEvent(QWindow *w, QEvent::Type type, int key, Qt::KeyboardModifiers modifiers, quint32 nativeScanCode, quint32 nativeVirtualKey, quint32 nativeModifiers, const QString& text, bool autorep, ushort count) { unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed(); - handleExtendedKeyEvent(w, time, type, key, modifiers, nativeScanCode, nativeVirtualKey, nativeModifiers, + return handleExtendedKeyEvent(w, time, type, key, modifiers, nativeScanCode, nativeVirtualKey, nativeModifiers, text, autorep, count); } -void QWindowSystemInterface::handleExtendedKeyEvent(QWindow *tlw, ulong timestamp, QEvent::Type type, int key, +bool QWindowSystemInterface::handleExtendedKeyEvent(QWindow *tlw, ulong timestamp, QEvent::Type type, int key, Qt::KeyboardModifiers modifiers, quint32 nativeScanCode, quint32 nativeVirtualKey, quint32 nativeModifiers, @@ -346,7 +346,7 @@ void QWindowSystemInterface::handleExtendedKeyEvent(QWindow *tlw, ulong timestam QWindowSystemInterfacePrivate::KeyEvent * e = new QWindowSystemInterfacePrivate::KeyEvent(tlw, timestamp, type, key, modifiers, nativeScanCode, nativeVirtualKey, nativeModifiers, text, autorep, count); - QWindowSystemInterfacePrivate::handleWindowSystemEvent(e); + return QWindowSystemInterfacePrivate::handleWindowSystemEvent(e); } void QWindowSystemInterface::handleWheelEvent(QWindow *w, const QPointF & local, const QPointF & global, int d, Qt::Orientation o, Qt::KeyboardModifiers mods) { diff --git a/src/gui/kernel/qwindowsysteminterface.h b/src/gui/kernel/qwindowsysteminterface.h index 3e0b788c0f..99589e8aa1 100644 --- a/src/gui/kernel/qwindowsysteminterface.h +++ b/src/gui/kernel/qwindowsysteminterface.h @@ -98,12 +98,12 @@ public: static bool handleKeyEvent(QWindow *w, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1); static bool handleKeyEvent(QWindow *w, ulong timestamp, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1); - static void handleExtendedKeyEvent(QWindow *w, QEvent::Type type, int key, Qt::KeyboardModifiers modifiers, + static bool handleExtendedKeyEvent(QWindow *w, QEvent::Type type, int key, Qt::KeyboardModifiers modifiers, quint32 nativeScanCode, quint32 nativeVirtualKey, quint32 nativeModifiers, const QString& text = QString(), bool autorep = false, ushort count = 1); - static void handleExtendedKeyEvent(QWindow *w, ulong timestamp, QEvent::Type type, int key, Qt::KeyboardModifiers modifiers, + static bool handleExtendedKeyEvent(QWindow *w, ulong timestamp, QEvent::Type type, int key, Qt::KeyboardModifiers modifiers, quint32 nativeScanCode, quint32 nativeVirtualKey, quint32 nativeModifiers, const QString& text = QString(), bool autorep = false, -- cgit v1.2.3 From 47b3e7d1308f01a243745e175071b24316671021 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 9 Sep 2015 14:55:54 +0200 Subject: Fix some doc warnings. qtbase/src/gui/text/qzip.cpp:797:warn:Cannot find 'FileInfo::d' specified with '\variable' in any header file qtbase/src/opengl/doc/src/qtopengl-index.qdoc:28:warn:Can't link to 'Qt Gui' qtbase/src/opengl/doc/src/qtopengl-module.qdoc:28:warn:Can't link to 'Qt Gui' qtbase/src/widgets/widgets/qcombobox.cpp:3033:warn:Cannot find base function for '\reimp' in showPopupFromMouseEvent() qtbase/src/corelib/plugin/quuid.cpp:849: warning: Can't link to 'variant()' qtbase/src/corelib/plugin/quuid.cpp:863: warning: Can't link to 'variant()' qtbase/src/widgets/dialogs/qsidebar.cpp:72: warning: Cannot find base function for '\reimp' in mimeTypes() qtbase/src/widgets/dialogs/qsidebar.cpp:80: warning: Cannot find base function for '\reimp' in flags() qtbase/src/widgets/dialogs/qsidebar.cpp:98: warning: Cannot find base function for '\reimp' in mimeData() qtbase/src/widgets/dialogs/qsidebar.cpp:134: warning: Cannot find base function for '\reimp' in dropMimeData() qtbase/src/widgets/dialogs/qsidebar.cpp:151: warning: Cannot find base function for '\reimp' in setData() Change-Id: I39d6494eb8179f0f7532f99458736fa5e30cdc25 Reviewed-by: Leena Miettinen --- src/gui/text/qzip.cpp | 6 ------ 1 file changed, 6 deletions(-) (limited to 'src/gui') diff --git a/src/gui/text/qzip.cpp b/src/gui/text/qzip.cpp index 6053466148..be002167cb 100644 --- a/src/gui/text/qzip.cpp +++ b/src/gui/text/qzip.cpp @@ -794,12 +794,6 @@ void QZipWriterPrivate::addEntry(EntryType type, const QString &fileName, const The total size of the unpacked content. */ -/*! - \variable FileInfo::d - \internal - private pointer. -*/ - /*! \class QZipReader \internal -- cgit v1.2.3 From a96c98fc612879fdef7f9c53753521e7cdfab749 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 10 Sep 2015 15:32:20 +0200 Subject: Fix qdoc warnings of QRgba64. qtbase/src/gui/painting/qrgba64.h:107: warning: No documentation for 'QRgba64::isOpaque()' qtbase/src/gui/painting/qrgba64.h:112: warning: No documentation for 'QRgba64::isTransparent()' qtbase/src/gui/painting/qrgba64.h:121: warning: No documentation for 'QRgba64::setAlpha()' qtbase/src/gui/painting/qrgba64.h:119: warning: No documentation for 'QRgba64::setBlue()' qtbase/src/gui/painting/qrgba64.h:118: warning: No documentation for 'QRgba64::setGreen()' qtbase/src/gui/painting/qrgba64.h:117: warning: No documentation for 'QRgba64::setRed()' qtbase/src/gui/painting/qrgba64.h:163: warning: No documentation for 'QRgba64::operator=()' Change-Id: Ic6f6a8415b8ad33917e460737824fc8856776de1 Reviewed-by: Allan Sandfeld Jensen --- src/gui/painting/qrgba64.qdoc | 64 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 63 insertions(+), 1 deletion(-) (limited to 'src/gui') diff --git a/src/gui/painting/qrgba64.qdoc b/src/gui/painting/qrgba64.qdoc index 29da0aa390..b786e91b03 100644 --- a/src/gui/painting/qrgba64.qdoc +++ b/src/gui/painting/qrgba64.qdoc @@ -36,12 +36,18 @@ QRgba64 is a 64-bit data-structure containing four 16-bit color channels: Red, green, blue and alpha. QRgba64 can be used a replacement for QRgb when higher precision is needed. In particular a - premultiplied QRgba64 can operate on unpremultipled QRgb without loss of precision except + premultiplied QRgba64 can operate on unpremultiplied QRgb without loss of precision except for alpha 0. \sa QRgb, QColor */ +/*! + \fn QRgba64 QRgba64::operator=(quint64 rgba) + + Assigns the value \a rgba to this instance of QRgba64 and returns it. +*/ + /*! \fn static QRgba64 QRgba64::fromRgba64(quint16 r, quint16 g, quint16 b, quint16 a) @@ -74,28 +80,84 @@ \sa fromRgba() */ +/*! + \fn bool QRgba64::isOpaque() const + + Returns whether the color is fully opaque. + + \sa isTransparent(), alpha() +*/ + +/*! + \fn bool QRgba64::isTransparent() const + + Returns whether the color is transparent. + + \sa isOpaque(), alpha() +*/ + /*! \fn quint16 QRgba64::red() const Returns the 16-bit red color component. + + \sa setRed() +*/ + +/*! + \fn QRgba64::setRed(quint16 red) + + Sets the red color component of this color to \a red. + + \sa red() */ /*! \fn quint16 QRgba64::green() const Returns the 16-bit green color component. + + \sa setGreen() +*/ + +/*! + \fn QRgba64::setGreen(quint16 green) + + Sets the green color component of this color to \a green. + + \sa green() */ /*! \fn quint16 QRgba64::blue() const Returns the 16-bit blue color component. + + \sa setBlue() +*/ + +/*! + \fn QRgba64::setBlue(quint16 blue) + + Sets the blue color component of this color to \a blue. + + \sa blue() */ /*! \fn quint16 QRgba64::alpha() const Returns the 16-bit alpha channel. + + \sa setAlpha() +*/ + +/*! + \fn QRgba64::setAlpha(quint16 alpha) + + Sets the alpha of this color to \a alpha. + + \sa alpha() */ /*! -- cgit v1.2.3 From 2e8bec9e4b8d229ad9f5f73d2362f21c13599816 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Tue, 8 Sep 2015 16:36:50 +0200 Subject: QImage: Use d->height directly for checking dimensions on pixel() Calling height() causes an additional function call and check for d which sums up to more than 25% of the total CPU cost of pixel() if the format is simple. Change-Id: I449a3a17dc031e607e40dc1577a5553e7490de76 Reviewed-by: Allan Sandfeld Jensen --- src/gui/image/qimage.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/gui') diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 045e36323f..6af1580641 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -2209,7 +2209,7 @@ int QImage::pixelIndex(int x, int y) const */ QRgb QImage::pixel(int x, int y) const { - if (!d || x < 0 || x >= d->width || y < 0 || y >= height()) { + if (!d || x < 0 || x >= d->width || y < 0 || y >= d->height) { qWarning("QImage::pixel: coordinate (%d,%d) out of range", x, y); return 12345; } -- cgit v1.2.3 From 65efeb6f9d0e447df4e0b5b2e4d64954ddd2fdfa Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Tue, 8 Sep 2015 16:53:16 +0200 Subject: QImage: Inline constScanLine call in pixel() Calling constScanLine() is an extra function call, just for doing "data + y * width". Also, we are checking d again, even though we already know it's there. The constScanLine() call is responsible for up to 15% of the total CPU time spent in pixel(). Change-Id: Ia7a8e0a6d62fb257d1b22d91f062b66e9cfd349a Reviewed-by: Allan Sandfeld Jensen --- src/gui/image/qimage.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/gui') diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 6af1580641..7f2504ddd9 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -2214,7 +2214,7 @@ QRgb QImage::pixel(int x, int y) const return 12345; } - const uchar * s = constScanLine(y); + const uchar *s = d->data + y * d->bytes_per_line; switch(d->format) { case Format_Mono: return d->colortable.at((*(s + (x >> 3)) >> (~x & 7)) & 1); -- cgit v1.2.3 From 3601d6d7e3b029dbbfafe2c991537905241016d7 Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Fri, 4 Sep 2015 17:20:19 +0200 Subject: Document QGuiApplication::primaryScreen property MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It was just documented as a method and signal so far, even though it already was a property. This patch merges both documentations into one. Change-Id: I3fb4090b773ba8762ad9e830303812887b75add3 Reviewed-by: Frederik Gladhorn Reviewed-by: Topi Reiniö --- src/gui/kernel/qguiapplication.cpp | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) (limited to 'src/gui') diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 87bd7ea5de..fc87759227 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -875,16 +875,6 @@ QWindowList QGuiApplication::topLevelWindows() return topLevelWindows; } -/*! - Returns the primary (or default) screen of the application, or null if there is none - - This will be the screen where QWindows are initially shown, unless otherwise specified. - - On some platforms, it may be null when there are actually no screens connected. - It is not possible to start a new QGuiApplication while there are no screens. - Applications which were running at the time the primary screen was removed - will stop rendering graphics until one or more screens are restored. -*/ QScreen *QGuiApplication::primaryScreen() { if (QGuiApplicationPrivate::screen_list.isEmpty()) @@ -906,7 +896,7 @@ QList QGuiApplication::screens() This signal is emitted whenever a new screen \a screen has been added to the system. - \sa screens(), primaryScreen(), screenRemoved() + \sa screens(), primaryScreen, screenRemoved() */ /*! @@ -921,18 +911,23 @@ QList QGuiApplication::screens() \since 5.4 */ + /*! - \fn void QGuiApplication::primaryScreenChanged(QScreen *screen) + \property QGuiApplication::primaryScreen - This signal is emitted whenever the primary \a screen changes. This way - applications can keep track of the primaryScreen and react if there is a - new primary screen. + \brief the primary (or default) screen of the application, or null if there is none. - \sa primaryScreen + This will be the screen where QWindows are initially shown, unless otherwise specified. - \since 5.6 -*/ + On some platforms, it may be null when there are actually no screens connected. + It is not possible to start a new QGuiApplication while there are no screens. + Applications which were running at the time the primary screen was removed + will stop rendering graphics until one or more screens are restored. + The primaryScreenChanged signal was introduced in Qt 5.6. + + \sa screens() +*/ /*! Returns the highest screen device pixel ratio found on -- cgit v1.2.3 From d36a1dfb51af3f981262bc8e8fcd22b91aa890a6 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Tue, 1 Sep 2015 03:03:28 +0200 Subject: Serialize the capitalization value of QFont By serializing the capitalization value of QFont, it ensures that it is correctly preserved when QPicture streams it and later plays it back. Subsequently the QDataStream version has been bumped up to account for the change of the data format for serializing QFont. [ChangeLog][QtGui][QFont] QFont now serializes the capitalization setting. [ChangeLog][Important Behavior Changes] QDataStream version bumped up to 17 to account for changes in the serialization of QFont. Task-number: QTBUG-15214 Change-Id: I042680760e5a69d18d41e786b7500a3eebbe562f Reviewed-by: Mitch Curtis --- src/gui/text/qfont.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/gui') diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp index 796f223797..7d9d00713c 100644 --- a/src/gui/text/qfont.cpp +++ b/src/gui/text/qfont.cpp @@ -2218,6 +2218,8 @@ QDataStream &operator<<(QDataStream &s, const QFont &font) } if (s.version() >= QDataStream::Qt_5_4) s << (quint8)font.d->request.hintingPreference; + if (s.version() >= QDataStream::Qt_5_6) + s << (quint8)font.d->capital; return s; } @@ -2308,7 +2310,11 @@ QDataStream &operator>>(QDataStream &s, QFont &font) s >> value; font.d->request.hintingPreference = QFont::HintingPreference(value); } - + if (s.version() >= QDataStream::Qt_5_6) { + quint8 value; + s >> value; + font.d->capital = QFont::Capitalization(value); + } return s; } -- cgit v1.2.3 From ae880beb7d02141c5097ef61409fa66b2c910dd3 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 1 Sep 2015 18:52:30 -0700 Subject: Fix build error with ICC 16 on Windows This is a repeat of acf80b9a2b913e898ed4c4ed14d4ea79401484fe, but this time it appears ICC 15 works and ICC 16 doesn't. ICC doesn't like polymorphic, exported classes with inline constructors. qsvgiconengine.obj : error LNK2001: unresolved external symbol "const QIconEngine::`vftable'" (??_7QIconEngine@@6B@) Task-number: QTBUG-48062 Change-Id: I82493c0f52084e0588352cd0c26e1293b0727242 Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/gui/image/qiconengine.cpp | 7 +++++++ src/gui/image/qiconengine.h | 1 + 2 files changed, 8 insertions(+) (limited to 'src/gui') diff --git a/src/gui/image/qiconengine.cpp b/src/gui/image/qiconengine.cpp index a25b216432..c09933d45f 100644 --- a/src/gui/image/qiconengine.cpp +++ b/src/gui/image/qiconengine.cpp @@ -77,6 +77,13 @@ QSize QIconEngine::actualSize(const QSize &size, QIcon::Mode /*mode*/, QIcon::St return size; } +/*! + \since 5.6 + Constructs the icon engine. + */ +QIconEngine::QIconEngine() +{ +} /*! Destroys the icon engine. diff --git a/src/gui/image/qiconengine.h b/src/gui/image/qiconengine.h index 735da863fd..9977113054 100644 --- a/src/gui/image/qiconengine.h +++ b/src/gui/image/qiconengine.h @@ -44,6 +44,7 @@ QT_BEGIN_NAMESPACE class Q_GUI_EXPORT QIconEngine { public: + QIconEngine(); virtual ~QIconEngine(); virtual void paint(QPainter *painter, const QRect &rect, QIcon::Mode mode, QIcon::State state) = 0; virtual QSize actualSize(const QSize &size, QIcon::Mode mode, QIcon::State state); -- cgit v1.2.3 From 42c6ea4f6c29845d68e865b19a73a09cc6d0bdbe Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 15 Sep 2015 12:12:51 +0200 Subject: QPlatformWindow: Extract static method for closestAcceptableGeometry(). On Windows, some messages occur before a QPlatformWindow is actually created, for example WM_WINDOWPOSCHANGING, which is handled in QWindowsWindow::handleGeometryChangingMessage(). Extract a static function QPlatformWindow::closestAcceptableGeometry() from QPlatformWindow::windowClosestAcceptableGeometry() and use that in QWindowsWindow::handleGeometryChangingMessage(). This fixes a regression crash occurring in Qt 5.6 when running the example from QTBUG-48201. Task-number: QTBUG-36220 Task-number: QTBUG-48201 Task-number: QTBUG-46615 Change-Id: I86b8f923447c8e447382427cf5795628ef1c9717 Reviewed-by: Joerg Bornemann --- src/gui/kernel/qplatformwindow.cpp | 11 ++++++++--- src/gui/kernel/qplatformwindow.h | 1 + 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'src/gui') diff --git a/src/gui/kernel/qplatformwindow.cpp b/src/gui/kernel/qplatformwindow.cpp index 0430d5a4c6..ea3b75c81c 100644 --- a/src/gui/kernel/qplatformwindow.cpp +++ b/src/gui/kernel/qplatformwindow.cpp @@ -702,15 +702,20 @@ QRect QPlatformWindow::windowFrameGeometry() const a resize/move event for platforms that support it, for example to implement heightForWidth(). */ -QRectF QPlatformWindow::windowClosestAcceptableGeometry(const QRectF &nativeRect) const + +QRectF QPlatformWindow::closestAcceptableGeometry(const QWindow *qWindow, const QRectF &nativeRect) { - QWindow *qWindow = window(); const QRectF rectF = QHighDpi::fromNativePixels(nativeRect, qWindow); - const QRectF correctedGeometryF = qt_window_private(qWindow)->closestAcceptableGeometry(rectF); + const QRectF correctedGeometryF = qt_window_private(const_cast(qWindow))->closestAcceptableGeometry(rectF); return !correctedGeometryF.isEmpty() && rectF != correctedGeometryF ? QHighDpi::toNativePixels(correctedGeometryF, qWindow) : nativeRect; } +QRectF QPlatformWindow::windowClosestAcceptableGeometry(const QRectF &nativeRect) const +{ + return QPlatformWindow::closestAcceptableGeometry(window(), nativeRect); +} + /*! \class QPlatformWindow \since 4.8 diff --git a/src/gui/kernel/qplatformwindow.h b/src/gui/kernel/qplatformwindow.h index 1b283dbb4f..9c2817906f 100644 --- a/src/gui/kernel/qplatformwindow.h +++ b/src/gui/kernel/qplatformwindow.h @@ -140,6 +140,7 @@ public: QRect windowGeometry() const; QRect windowFrameGeometry() const; QRectF windowClosestAcceptableGeometry(const QRectF &nativeRect) const; + static QRectF closestAcceptableGeometry(const QWindow *w, const QRectF &nativeRect); protected: static QString formatWindowTitle(const QString &title, const QString &separator); -- cgit v1.2.3 From a0aad95f5ad1ff044f5e46cf2d3302c42d058f6a Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Tue, 8 Sep 2015 17:59:17 +0300 Subject: Set the source for a detached mouse button event If a mouse event from the window system changes both position and buttons at the same time, then it's split by QGuiApplication into a mouse move event followed by a mouse button event. Propagate the source of the original mouse event to the mouse button event. Change-Id: I075fb4ad9e4338bf8ec170630ce270b38d8682d9 Reviewed-by: Friedemann Kleint --- src/gui/kernel/qguiapplication.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/gui') diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index fc87759227..94c831e18c 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -1713,7 +1713,7 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo // should first send a move event followed by a button changed event. Since this is not the case // with the current event, we split it in two. QWindowSystemInterfacePrivate::MouseEvent mouseButtonEvent( - e->window.data(), e->timestamp, e->type, e->localPos, e->globalPos, e->buttons, e->modifiers); + e->window.data(), e->timestamp, e->type, e->localPos, e->globalPos, e->buttons, e->modifiers, e->source); if (e->flags & QWindowSystemInterfacePrivate::WindowSystemEvent::Synthetic) mouseButtonEvent.flags |= QWindowSystemInterfacePrivate::WindowSystemEvent::Synthetic; e->buttons = buttons; -- cgit v1.2.3 From 1af2b861d8915cfa9fe2d79f6ebb2ae22749f37b Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 7 Sep 2015 15:00:09 +0200 Subject: Ensure the accepted state of mouse events is passed to QWindowSystemInterface. On Windows, Qt needs to return false in case it does not handle the "extra" buttons (like WM_XBUTTONDOWN) which causes Windows to send the corresponding WM_APPCOMMAND message (like APPCOMMAND_BROWSER_FORWARD). Task-number: QTBUG-48117 Change-Id: I093cd2d8205a39c3a042dd8a0d19c7229003761f Reviewed-by: Andy Shaw --- src/gui/kernel/qguiapplication.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/gui') diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 94c831e18c..736580f547 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -1809,6 +1809,7 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo } QGuiApplication::sendSpontaneousEvent(window, &ev); + e->eventAccepted = ev.isAccepted(); if (!e->synthetic() && !ev.isAccepted() && !frameStrut && qApp->testAttribute(Qt::AA_SynthesizeTouchForUnhandledMouseEvents)) { -- cgit v1.2.3 From 6a8251a89b6a61258498f4af1ba7b3d5b7f7096c Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 17 Jul 2015 13:22:13 -0700 Subject: Reorganize the bits for the CPU feature detection Instead of trying to detect one bit and set another, let's just use the bits from the x86 CPUID instruction on x86. This makes use of the full 64-bit space now. Since MSVC doesn't like enums bigger than 32-bit, we have to store the bit number instead of the actual bit value in the constant. For that reason, I also renamed the constants, to catch anyone who was using them directly, instead of through qCpuHasFeature. Change-Id: Ib306f8f647014b399b87ffff13f1d587692d827a Reviewed-by: Oswald Buddenhagen Reviewed-by: Thiago Macieira --- src/gui/painting/qdrawhelper.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/gui') diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 0cf7e20605..64a363868a 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -6326,8 +6326,6 @@ template const uint *QT_FASTCALL convertA2RGB30PMFromARGB32PM_sse4 void qInitDrawhelperAsm() { - const uint features = qCpuFeatures(); - Q_UNUSED(features); #ifdef __SSE2__ qDrawHelper[QImage::Format_RGB32].bitmapBlit = qt_bitmapblit32_sse2; qDrawHelper[QImage::Format_ARGB32].bitmapBlit = qt_bitmapblit32_sse2; @@ -6372,7 +6370,7 @@ void qInitDrawhelperAsm() qt_fetch_radial_gradient = qt_fetch_radial_gradient_sse2; #ifdef QT_COMPILER_SUPPORTS_SSSE3 - if (features & SSSE3) { + if (qCpuHasFeature(SSSE3)) { extern void qt_blend_argb32_on_argb32_ssse3(uchar *destPixels, int dbpl, const uchar *srcPixels, int sbpl, int w, int h, @@ -6466,7 +6464,7 @@ void qInitDrawhelperAsm() #endif // Q_PROCESSOR_MIPS_32 #if defined(QT_COMPILER_SUPPORTS_MIPS_DSP) || defined(QT_COMPILER_SUPPORTS_MIPS_DSPR2) - if (features & (DSP | DSPR2)) { + if (qCpuHasFeature(DSP) && qCpuHasFeature(DSPR2)) { // Composition functions are all DSP r1 qt_functionForMode_C[QPainter::CompositionMode_SourceOver] = comp_func_SourceOver_asm_mips_dsp; qt_functionForMode_C[QPainter::CompositionMode_Source] = comp_func_Source_mips_dsp; -- cgit v1.2.3 From eecc351c5d05989c1b0ea3349f76a579b83eb446 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Tue, 8 Sep 2015 09:23:34 +0200 Subject: Null out QOpenGLContext::screen upon screen disconnect Returning a dangling pointer is no good. Do what QOffscreenSurface does: just null it out. Task-number: QTBUG-42803 Change-Id: I01a6db9ae8974a1c78157ebc67097c8dac3a6b6e Reviewed-by: Gunnar Sletta --- src/gui/kernel/qopenglcontext.cpp | 16 ++++++++++++++-- src/gui/kernel/qopenglcontext.h | 2 ++ src/gui/kernel/qopenglcontext_p.h | 2 ++ 3 files changed, 18 insertions(+), 2 deletions(-) (limited to 'src/gui') diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp index 9e5767658f..85d05959de 100644 --- a/src/gui/kernel/qopenglcontext.cpp +++ b/src/gui/kernel/qopenglcontext.cpp @@ -462,8 +462,7 @@ QPlatformOpenGLContext *QOpenGLContext::shareHandle() const QOpenGLContext::QOpenGLContext(QObject *parent) : QObject(*new QOpenGLContextPrivate(), parent) { - Q_D(QOpenGLContext); - d->screen = QGuiApplication::primaryScreen(); + setScreen(QGuiApplication::primaryScreen()); } /*! @@ -499,9 +498,20 @@ void QOpenGLContext::setShareContext(QOpenGLContext *shareContext) void QOpenGLContext::setScreen(QScreen *screen) { Q_D(QOpenGLContext); + if (d->screen) + disconnect(d->screen, SIGNAL(destroyed(QObject*)), this, SLOT(_q_screenDestroyed(QObject*))); d->screen = screen; if (!d->screen) d->screen = QGuiApplication::primaryScreen(); + if (d->screen) + connect(d->screen, SIGNAL(destroyed(QObject*)), this, SLOT(_q_screenDestroyed(QObject*))); +} + +void QOpenGLContextPrivate::_q_screenDestroyed(QObject *object) +{ + Q_Q(QOpenGLContext); + if (object == static_cast(screen)) + q->setScreen(0); } /*! @@ -1626,4 +1636,6 @@ void QOpenGLMultiGroupSharedResource::cleanup(QOpenGLContextGroup *group, QOpenG m_groups.removeOne(group); } +#include "moc_qopenglcontext.cpp" + QT_END_NAMESPACE diff --git a/src/gui/kernel/qopenglcontext.h b/src/gui/kernel/qopenglcontext.h index 85e7abfa26..841967a545 100644 --- a/src/gui/kernel/qopenglcontext.h +++ b/src/gui/kernel/qopenglcontext.h @@ -241,6 +241,8 @@ private: void setTextureFunctions(QOpenGLTextureHelper* textureFuncs); void destroy(); + + Q_PRIVATE_SLOT(d_func(), void _q_screenDestroyed(QObject *object)) }; QT_END_NAMESPACE diff --git a/src/gui/kernel/qopenglcontext_p.h b/src/gui/kernel/qopenglcontext_p.h index f9f3ce2c5f..4a746bf12b 100644 --- a/src/gui/kernel/qopenglcontext_p.h +++ b/src/gui/kernel/qopenglcontext_p.h @@ -270,6 +270,8 @@ public: static QHash makeCurrentTracker; static QMutex makeCurrentTrackerMutex; #endif + + void _q_screenDestroyed(QObject *object); }; Q_GUI_EXPORT void qt_gl_set_global_share_context(QOpenGLContext *context); -- cgit v1.2.3 From 9c71f55ef9575c0168bf8d0b305ec9591a61999d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Thu, 27 Aug 2015 18:27:57 +0200 Subject: QFontEngine: Read minimum left and right glyph bearings from 'hhea' table This table has values precomputed based on every single glyph in the font, not just the subset we use as a fallback, which should improve both performance and correctness. The fallback codepath of computing the minimum values based on a subset of the characters in the font is left in, as we still need that for bitmap fonts, and some font tables that have invalid values. Change-Id: I71aac1e09c9f9de80446b023ba15a9e2afe7d226 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/gui/text/qfontengine.cpp | 74 ++++++++++++++++++++++++++++++++------------ 1 file changed, 55 insertions(+), 19 deletions(-) (limited to 'src/gui') diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index 102946b545..bef4dc5547 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -581,34 +581,70 @@ qreal QFontEngine::minLeftBearing() const return m_minLeftBearing; } +#define q16Dot16ToFloat(i) ((i) / 65536.0) + +#define kMinLeftSideBearingOffset 12 +#define kMinRightSideBearingOffset 14 + qreal QFontEngine::minRightBearing() const { if (m_minRightBearing == kBearingNotInitialized) { - // To balance performance and correctness we only look at a subset of the - // possible glyphs in the font, based on which characters are more likely - // to have a left or right bearing. - static const ushort characterSubset[] = { - '(', 'C', 'F', 'K', 'V', 'X', 'Y', ']', '_', 'f', 'r', '|', - 127, 205, 645, 884, 922, 1070, 12386 - }; + // Try the 'hhea' font table first, which covers the entire font + QByteArray hheaTable = getSfntTable(MAKE_TAG('h', 'h', 'e', 'a')); + if (hheaTable.size() >= int(kMinRightSideBearingOffset + sizeof(qint16))) { + const uchar *tableData = reinterpret_cast(hheaTable.constData()); + Q_ASSERT(q16Dot16ToFloat(qFromBigEndian(tableData)) == 1.0); + + qint16 minLeftSideBearing = qFromBigEndian(tableData + kMinLeftSideBearingOffset); + qint16 minRightSideBearing = qFromBigEndian(tableData + kMinRightSideBearingOffset); + + // The table data is expressed as FUnits, meaning we have to take the number + // of units per em into account. Since pixelSize already has taken DPI into + // account we can use that directly instead of the point size. + int unitsPerEm = emSquareSize().toInt(); + qreal funitToPixelFactor = fontDef.pixelSize / unitsPerEm; + + // Some fonts on OS X (such as Gurmukhi Sangam MN, Khmer MN, Lao Sangam MN, etc.), have + // invalid values for their NBSPACE left bearing, causing the 'hhea' minimum bearings to + // be way off. We detect this by assuming that the minimum bearsings are within a certain + // range of the em square size. + static const int largestValidBearing = 4 * unitsPerEm; + + if (qAbs(minLeftSideBearing) < largestValidBearing) + m_minLeftBearing = minLeftSideBearing * funitToPixelFactor; + if (qAbs(minRightSideBearing) < largestValidBearing) + m_minRightBearing = minRightSideBearing * funitToPixelFactor; + } - // The font may have minimum bearings larger than 0, so we have to start at the max - m_minLeftBearing = m_minRightBearing = std::numeric_limits::max(); + // Fallback in case of missing 'hhea' table (bitmap fonts e.g.) or broken 'hhea' values + if (m_minLeftBearing == kBearingNotInitialized || m_minRightBearing == kBearingNotInitialized) { - for (uint i = 0; i < (sizeof(characterSubset) / sizeof(ushort)); ++i) { - const glyph_t glyph = glyphIndex(characterSubset[i]); - if (!glyph) - continue; + // To balance performance and correctness we only look at a subset of the + // possible glyphs in the font, based on which characters are more likely + // to have a left or right bearing. + static const ushort characterSubset[] = { + '(', 'C', 'F', 'K', 'V', 'X', 'Y', ']', '_', 'f', 'r', '|', + 127, 205, 645, 884, 922, 1070, 12386 + }; - glyph_metrics_t glyphMetrics = const_cast(this)->boundingBox(glyph); + // The font may have minimum bearings larger than 0, so we have to start at the max + m_minLeftBearing = m_minRightBearing = std::numeric_limits::max(); - // Glyphs with no contours shouldn't contribute to bearings - if (!glyphMetrics.width || !glyphMetrics.height) - continue; + for (uint i = 0; i < (sizeof(characterSubset) / sizeof(ushort)); ++i) { + const glyph_t glyph = glyphIndex(characterSubset[i]); + if (!glyph) + continue; + + glyph_metrics_t glyphMetrics = const_cast(this)->boundingBox(glyph); - m_minLeftBearing = qMin(m_minLeftBearing, glyphMetrics.leftBearing().toReal()); - m_minRightBearing = qMin(m_minRightBearing, glyphMetrics.rightBearing().toReal()); + // Glyphs with no contours shouldn't contribute to bearings + if (!glyphMetrics.width || !glyphMetrics.height) + continue; + + m_minLeftBearing = qMin(m_minLeftBearing, glyphMetrics.leftBearing().toReal()); + m_minRightBearing = qMin(m_minRightBearing, glyphMetrics.rightBearing().toReal()); + } } if (m_minLeftBearing == kBearingNotInitialized || m_minRightBearing == kBearingNotInitialized) -- cgit v1.2.3 From 847d5d1309a4365af7d0f4fa1bff5754b8286e34 Mon Sep 17 00:00:00 2001 From: Samuel Gaist Date: Mon, 17 Aug 2015 09:39:46 +0200 Subject: Implement sessionId/key generation on Windows sessionId and sessionKey generation on Windows was lost in the transition of Qt 4 to Qt 5. During the reimplementation of the QSessionManagement feature, that part has been missed. This patch fixes that. Based on Qt 4 [ChangeLog][QtGui][Windows] Fixed a regression where both sessionId/sessionKey were empty Task-number: QTBUG-47690 Change-Id: I17b5fbee9d0979d292d30b94b3a2cc3107fc54fd Reviewed-by: Friedemann Kleint --- src/gui/kernel/qguiapplication.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/gui') diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 736580f547..710aa714b7 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -99,6 +99,9 @@ #elif defined(Q_OS_WIN) && !defined(Q_OS_WINCE) # include # include +# if defined(Q_OS_WINPHONE) +# include +# endif #endif // Q_OS_WIN && !Q_OS_WINCE #include @@ -1232,6 +1235,16 @@ void QGuiApplicationPrivate::init() #ifndef QT_NO_SESSIONMANAGER QString session_id; QString session_key; +# if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) + wchar_t guidstr[40]; + GUID guid; + CoCreateGuid(&guid); + StringFromGUID2(guid, guidstr, 40); + session_id = QString::fromWCharArray(guidstr); + CoCreateGuid(&guid); + StringFromGUID2(guid, guidstr, 40); + session_key = QString::fromWCharArray(guidstr); +# endif #endif int j = argc ? 1 : 0; for (int i=1; i Date: Tue, 22 Sep 2015 11:38:09 -0700 Subject: Synchronize QInputDeviceManager touch device count with QTouchDevice This ensures that the values and signals reported by QInputDeviceManager for touch devices always have corresponding entries in the list returned by QTouchDevice::devices(). It also adds proper QTouchDevice unregistration when the underlying input device gets removed by the evdevtouch QPA plugin. Change-Id: I7bdf2f7435c775d15bddce8ba1e731afdc1d948a Reviewed-by: Friedemann Kleint Reviewed-by: Laszlo Agocs --- src/gui/kernel/qtouchdevice.cpp | 11 +++++++++++ src/gui/kernel/qtouchdevice_p.h | 1 + src/gui/kernel/qwindowsysteminterface.cpp | 7 ++++++- src/gui/kernel/qwindowsysteminterface.h | 3 ++- 4 files changed, 20 insertions(+), 2 deletions(-) (limited to 'src/gui') diff --git a/src/gui/kernel/qtouchdevice.cpp b/src/gui/kernel/qtouchdevice.cpp index 9d19fa4b92..266b5308a2 100644 --- a/src/gui/kernel/qtouchdevice.cpp +++ b/src/gui/kernel/qtouchdevice.cpp @@ -237,6 +237,17 @@ void QTouchDevicePrivate::registerDevice(const QTouchDevice *dev) deviceList()->append(dev); } +/*! + \internal + */ +void QTouchDevicePrivate::unregisterDevice(const QTouchDevice *dev) +{ + QMutexLocker lock(&devicesMutex); + bool wasRemoved = deviceList()->removeOne(dev); + if (wasRemoved && deviceList()->isEmpty()) + qRemovePostRoutine(cleanupDevicesList); +} + #ifndef QT_NO_DEBUG_STREAM QDebug operator<<(QDebug debug, const QTouchDevice *device) { diff --git a/src/gui/kernel/qtouchdevice_p.h b/src/gui/kernel/qtouchdevice_p.h index 4aff8f2f33..63b83d33ec 100644 --- a/src/gui/kernel/qtouchdevice_p.h +++ b/src/gui/kernel/qtouchdevice_p.h @@ -65,6 +65,7 @@ public: int maxTouchPoints; static void registerDevice(const QTouchDevice *dev); + static void unregisterDevice(const QTouchDevice *dev); static bool isRegistered(const QTouchDevice *dev); }; diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp index 91a935ad0f..faa1ff8068 100644 --- a/src/gui/kernel/qwindowsysteminterface.cpp +++ b/src/gui/kernel/qwindowsysteminterface.cpp @@ -486,11 +486,16 @@ bool QWindowSystemInterfacePrivate::handleWindowSystemEvent(QWindowSystemInterfa return accepted; } -void QWindowSystemInterface::registerTouchDevice(QTouchDevice *device) +void QWindowSystemInterface::registerTouchDevice(const QTouchDevice *device) { QTouchDevicePrivate::registerDevice(device); } +void QWindowSystemInterface::unregisterTouchDevice(const QTouchDevice *device) +{ + QTouchDevicePrivate::unregisterDevice(device); +} + void QWindowSystemInterface::handleTouchEvent(QWindow *w, QTouchDevice *device, const QList &points, Qt::KeyboardModifiers mods) { diff --git a/src/gui/kernel/qwindowsysteminterface.h b/src/gui/kernel/qwindowsysteminterface.h index 99589e8aa1..97bd087b53 100644 --- a/src/gui/kernel/qwindowsysteminterface.h +++ b/src/gui/kernel/qwindowsysteminterface.h @@ -127,7 +127,8 @@ public: QVector rawPositions; // in screen coordinates }; - static void registerTouchDevice(QTouchDevice *device); + static void registerTouchDevice(const QTouchDevice *device); + static void unregisterTouchDevice(const QTouchDevice *device); static void handleTouchEvent(QWindow *w, QTouchDevice *device, const QList &points, Qt::KeyboardModifiers mods = Qt::NoModifier); static void handleTouchEvent(QWindow *w, ulong timestamp, QTouchDevice *device, -- cgit v1.2.3 From 17650467302819e1fd333f0682445d50fc52eb68 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Tue, 22 Sep 2015 17:22:22 +0200 Subject: Deliver mouse press and release events on X11 also when dragging We generally assume that for every mouse press we also get a mouse release eventually. The event filter installed by QBasicDrag broke this assumption as it didn't take care of filtering mouse press and mouse release events symmetrically. We cannot immediately pass on the release event as that would mean a release event is generated from a press event (via the blocking drag call), which breaks assumptions in other places. Change-Id: If7e48c7dc0ef5265bed4f9a9366a7606ec875d93 Task-number: QTBUG-46361 Reviewed-by: Friedemann Kleint Reviewed-by: Gatis Paeglis --- src/gui/kernel/qsimpledrag.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/gui') diff --git a/src/gui/kernel/qsimpledrag.cpp b/src/gui/kernel/qsimpledrag.cpp index 6e574d82e4..b02f1dd8bd 100644 --- a/src/gui/kernel/qsimpledrag.cpp +++ b/src/gui/kernel/qsimpledrag.cpp @@ -149,7 +149,7 @@ bool QBasicDrag::eventFilter(QObject *o, QEvent *e) { QPoint nativePosition = getNativeMousePos(e, o); move(nativePosition); - return true; // Eat all mouse events + return true; // Eat all mouse move events } case QEvent::MouseButtonRelease: disableEventFilter(); @@ -160,8 +160,8 @@ bool QBasicDrag::eventFilter(QObject *o, QEvent *e) cancel(); } exitDndEventLoop(); - return true; // Eat all mouse events - case QEvent::MouseButtonPress: + QCoreApplication::postEvent(o, new QMouseEvent(*static_cast(e))); + return true; // defer mouse release events until drag event loop has returned case QEvent::MouseButtonDblClick: case QEvent::Wheel: return true; -- cgit v1.2.3 From bf2c9fd2fdff2760f3798fd1584f2da330266c46 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 24 Sep 2015 08:42:06 +0200 Subject: Guard against empty keys in QPlatformInputContextFactory::create(). The code relied on QStringList::split() returning a list consisting of one empty string when passing an enpty string. Add a check to prevent the plugin loader from trying to load in this case. Change-Id: Iadb418d32fdea1d472d6c00726ad039b4afbf409 Reviewed-by: Andy Shaw Reviewed-by: Lars Knoll --- src/gui/kernel/qplatforminputcontextfactory.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'src/gui') diff --git a/src/gui/kernel/qplatforminputcontextfactory.cpp b/src/gui/kernel/qplatforminputcontextfactory.cpp index 9d55b778ce..fedf940dda 100644 --- a/src/gui/kernel/qplatforminputcontextfactory.cpp +++ b/src/gui/kernel/qplatforminputcontextfactory.cpp @@ -65,15 +65,17 @@ QString QPlatformInputContextFactory::requested() QPlatformInputContext *QPlatformInputContextFactory::create(const QString& key) { #if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS) - QStringList paramList = key.split(QLatin1Char(':')); - const QString platform = paramList.takeFirst().toLower(); + if (!key.isEmpty()) { + QStringList paramList = key.split(QLatin1Char(':')); + const QString platform = paramList.takeFirst().toLower(); - QPlatformInputContext *ic = qLoadPlugin1 - (loader(), platform, paramList); - if (ic && ic->isValid()) - return ic; + QPlatformInputContext *ic = qLoadPlugin1 + (loader(), platform, paramList); + if (ic && ic->isValid()) + return ic; - delete ic; + delete ic; + } #endif return 0; } -- cgit v1.2.3 From b46ffbca0cfad41599873d4ca19dc79167c3955f Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Wed, 23 Sep 2015 17:40:27 +0200 Subject: Fix up QOpenGLWidget transparency support The glColorMask call was troublesome. In addition, the Qt::WA_TranslucentBackground was misinterpreted and recommended misleadingly in the documentation. The hellogl2 example's --transparent argument was disfunctional in practice. Replace glColorMask with glBlendFuncSeparate. The hellogl2 example and the docs are now corrected wrt enabling semi-transparency in a QOpenGLWidget that is not a top-level (which is the most common case). Task-number: QTBUG-47276 Change-Id: I6f40e732d455f5efcf158649ac9a52ff9f240e85 Reviewed-by: Allan Sandfeld Jensen Reviewed-by: Gunnar Sletta --- src/gui/painting/qplatformbackingstore.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'src/gui') diff --git a/src/gui/painting/qplatformbackingstore.cpp b/src/gui/painting/qplatformbackingstore.cpp index e765a9e402..c86fdebea5 100644 --- a/src/gui/painting/qplatformbackingstore.cpp +++ b/src/gui/painting/qplatformbackingstore.cpp @@ -300,11 +300,7 @@ void QPlatformBackingStore::composeAndFlush(QWindow *window, const QRegion ®i } funcs->glEnable(GL_BLEND); - funcs->glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - // Do not write out alpha. We need blending, but only for RGB. The toplevel may have - // alpha enabled in which case blending (writing out < 1.0 alpha values) would lead to - // semi-transparency even when it is not wanted. - funcs->glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_FALSE); + funcs->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE); // Backingstore texture with the normal widgets. GLuint textureId = 0; @@ -364,7 +360,6 @@ void QPlatformBackingStore::composeAndFlush(QWindow *window, const QRegion ®i blit(textures, i, window, deviceWindowRect, d_ptr->blitter); } - funcs->glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); funcs->glDisable(GL_BLEND); d_ptr->blitter->release(); -- cgit v1.2.3 From d427417c744b9035a2d28622a369908c6d347d84 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 24 Sep 2015 09:36:15 -0700 Subject: Print one warning for the new high DPI variables, not four For people with non-empty QT_MESSAGE_PATTERNS, the multiple lines would be unreadable. This is what it showed for me when starting Qt Creator: [1442136.587] qtcreator(82762 82762)(?libQt5Gui.so.5?|QGuiApplicationPrivate::createPlatformIntegration|QGuiApplicationPrivate::createEventDispatcher|QCoreApplication::init|QCoreApplication::QCoreApplication|QGuiApplication::QGuiApplication|QApplication::QApplication|?qtcreator?|?qtcreator?|__libc_start_main): Warning: QT_DEVICE_PIXEL_RATIO is deprecated. Instead use: [1442136.592] qtcreator(82762 82762)(?libQt5Gui.so.5?|QGuiApplicationPrivate::createPlatformIntegration|QGuiApplicationPrivate::createEventDispatcher|QCoreApplication::init|QCoreApplication::QCoreApplication|QGuiApplication::QGuiApplication|QApplication::QApplication|?qtcreator?|?qtcreator?|__libc_start_main): QT_AUTO_SCREEN_SCALE_FACTOR to enable platform plugin controlled per-screen factors. [1442136.592] qtcreator(82762 82762)(?libQt5Gui.so.5?|QGuiApplicationPrivate::createPlatformIntegration|QGuiApplicationPrivate::createEventDispatcher|QCoreApplication::init|QCoreApplication::QCoreApplication|QGuiApplication::QGuiApplication|QApplication::QApplication|?qtcreator?|?qtcreator?|__libc_start_main): QT_SCREEN_SCALE_FACTORS to set per-screen factors. [1442136.593] qtcreator(82762 82762)(?libQt5Gui.so.5?|QGuiApplicationPrivate::createPlatformIntegration|QGuiApplicationPrivate::createEventDispatcher|QCoreApplication::init|QCoreApplication::QCoreApplication|QGuiApplication::QGuiApplication|QApplication::QApplication|?qtcreator?|?qtcreator?|__libc_start_main): QT_SCALE_FACTOR to set the application global scale factor. (and imagine it line-broken in a terminal 140 columns wide) Change-Id: I42e7ef1a481840699a8dffff1406f73dc4d44a41 Reviewed-by: Friedemann Kleint --- src/gui/kernel/qhighdpiscaling.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/gui') diff --git a/src/gui/kernel/qhighdpiscaling.cpp b/src/gui/kernel/qhighdpiscaling.cpp index de586ac46c..daba9f94a1 100644 --- a/src/gui/kernel/qhighdpiscaling.cpp +++ b/src/gui/kernel/qhighdpiscaling.cpp @@ -62,10 +62,10 @@ static inline qreal initialScaleFactor() } } else { if (qEnvironmentVariableIsSet(legacyDevicePixelEnvVar)) { - qWarning() << "Warning:" << legacyDevicePixelEnvVar << "is deprecated. Instead use:"; - qWarning() << " " << autoScreenEnvVar << "to enable platform plugin controlled per-screen factors."; - qWarning() << " " << screenFactorsEnvVar << "to set per-screen factors."; - qWarning() << " " << scaleFactorEnvVar << "to set the application global scale factor."; + qWarning() << "Warning:" << legacyDevicePixelEnvVar << "is deprecated. Instead use:" << endl + << " " << autoScreenEnvVar << "to enable platform plugin controlled per-screen factors." << endl + << " " << screenFactorsEnvVar << "to set per-screen factors." << endl + << " " << scaleFactorEnvVar << "to set the application global scale factor."; int dpr = qEnvironmentVariableIntValue(legacyDevicePixelEnvVar); if (dpr > 0) -- cgit v1.2.3 From c9697677f4bd8e94f5367deab540b90e60e898a5 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Fri, 18 Sep 2015 13:49:49 +0200 Subject: Use a power of two division factor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Using a power of 2 instead of power of 10 means the result of the division can be accurately represented as a floating point instead of being an approximation that could lead to rounding errors. Change-Id: I8910c06113ec6b69c60ff95d59894bfb56133186 Reviewed-by: Morten Johan Sørvig --- src/gui/painting/qpaintdevice.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/gui') diff --git a/src/gui/painting/qpaintdevice.h b/src/gui/painting/qpaintdevice.h index c360573e78..72a6ca4cb3 100644 --- a/src/gui/painting/qpaintdevice.h +++ b/src/gui/painting/qpaintdevice.h @@ -81,7 +81,7 @@ public: int colorCount() const { return metric(PdmNumColors); } int depth() const { return metric(PdmDepth); } - static inline qreal devicePixelRatioFScale() {return 10000000.0; } + static inline qreal devicePixelRatioFScale() { return 0x10000; } protected: QPaintDevice() Q_DECL_NOEXCEPT; virtual int metric(PaintDeviceMetric metric) const; -- cgit v1.2.3