diff options
author | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2015-05-04 13:16:14 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2015-05-04 13:19:31 +0200 |
commit | 7f8719e663edae8b08d34cc67cb5000e8402d3d7 (patch) | |
tree | b098d2c8077a88c2ada577ac874e1416adaf66f7 /src | |
parent | af851c290b7cea22f26bb8c852b0029696469d74 (diff) | |
parent | eb82959d6688f9e58be4b67670afba3649f1f799 (diff) |
Merge remote-tracking branch 'origin/5.5' into HEAD
Change-Id: I487a4b7c05687a10c498ac219c31367d4db6fbc0
Diffstat (limited to 'src')
30 files changed, 429 insertions, 284 deletions
diff --git a/src/corelib/io/qiodevice.cpp b/src/corelib/io/qiodevice.cpp index 47484ad596..e73a200fb4 100644 --- a/src/corelib/io/qiodevice.cpp +++ b/src/corelib/io/qiodevice.cpp @@ -989,6 +989,10 @@ QByteArray QIODevice::readAll() // Size is unknown, read incrementally. qint64 readResult; do { + if (quint64(readBytes) + QIODEVICE_BUFFERSIZE > QByteArray::MaxSize) { + // If resize would fail, don't read more, return what we have. + break; + } result.resize(readBytes + QIODEVICE_BUFFERSIZE); readResult = read(result.data() + readBytes, QIODEVICE_BUFFERSIZE); if (readResult > 0 || readBytes == 0) diff --git a/src/corelib/io/qtextstream.cpp b/src/corelib/io/qtextstream.cpp index 6149a04a74..5fe4cfef9d 100644 --- a/src/corelib/io/qtextstream.cpp +++ b/src/corelib/io/qtextstream.cpp @@ -447,6 +447,9 @@ bool QTextStreamPrivate::fillReadBuffer(qint64 maxBytes) bytesRead = device->read(buf, sizeof(buf)); } + if (bytesRead <= 0) + return false; + #ifndef QT_NO_TEXTCODEC // codec auto detection, explicitly defaults to locale encoding if the // codec has been set to 0. @@ -470,9 +473,6 @@ bool QTextStreamPrivate::fillReadBuffer(qint64 maxBytes) qt_prettyDebug(buf, qMin(32,int(bytesRead)) , int(bytesRead)).constData(), int(sizeof(buf)), int(bytesRead)); #endif - if (bytesRead <= 0) - return false; - int oldReadBufferSize = readBuffer.size(); #ifndef QT_NO_TEXTCODEC // convert to unicode diff --git a/src/corelib/itemmodels/qsortfilterproxymodel.cpp b/src/corelib/itemmodels/qsortfilterproxymodel.cpp index 3a604c15f4..922d0f1622 100644 --- a/src/corelib/itemmodels/qsortfilterproxymodel.cpp +++ b/src/corelib/itemmodels/qsortfilterproxymodel.cpp @@ -2577,8 +2577,8 @@ void QSortFilterProxyModel::invalidateFilter() /*! Returns \c true if the value of the item referred to by the given - index \a left is less than the value of the item referred to by - the given index \a right, otherwise returns \c false. + index \a source_left is less than the value of the item referred to by + the given index \a source_right, otherwise returns \c false. This function is used as the < operator when sorting, and handles the following QVariant types: @@ -2612,11 +2612,11 @@ void QSortFilterProxyModel::invalidateFilter() \sa sortRole, sortCaseSensitivity, dynamicSortFilter */ -bool QSortFilterProxyModel::lessThan(const QModelIndex &left, const QModelIndex &right) const +bool QSortFilterProxyModel::lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const { Q_D(const QSortFilterProxyModel); - QVariant l = (left.model() ? left.model()->data(left, d->sort_role) : QVariant()); - QVariant r = (right.model() ? right.model()->data(right, d->sort_role) : QVariant()); + QVariant l = (source_left.model() ? source_left.model()->data(source_left, d->sort_role) : QVariant()); + QVariant r = (source_right.model() ? source_right.model()->data(source_right, d->sort_role) : QVariant()); switch (l.userType()) { case QVariant::Invalid: return (r.type() != QVariant::Invalid); diff --git a/src/corelib/itemmodels/qsortfilterproxymodel.h b/src/corelib/itemmodels/qsortfilterproxymodel.h index 9ba4e48d09..a08d7c6416 100644 --- a/src/corelib/itemmodels/qsortfilterproxymodel.h +++ b/src/corelib/itemmodels/qsortfilterproxymodel.h @@ -111,7 +111,7 @@ public Q_SLOTS: protected: virtual bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const; virtual bool filterAcceptsColumn(int source_column, const QModelIndex &source_parent) const; - virtual bool lessThan(const QModelIndex &left, const QModelIndex &right) const; + virtual bool lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const; void filterChanged(); void invalidateFilter(); diff --git a/src/corelib/kernel/qmimedata.cpp b/src/corelib/kernel/qmimedata.cpp index 0753faf469..3e9cdac966 100644 --- a/src/corelib/kernel/qmimedata.cpp +++ b/src/corelib/kernel/qmimedata.cpp @@ -566,7 +566,22 @@ QByteArray QMimeData::data(const QString &mimeType) const void QMimeData::setData(const QString &mimeType, const QByteArray &data) { Q_D(QMimeData); - d->setData(mimeType, QVariant(data)); + + if (mimeType == QLatin1String("text/uri-list")) { + QByteArray ba = data; + if (ba.endsWith('\0')) + ba.chop(1); + QList<QByteArray> urls = ba.split('\n'); + QList<QVariant> list; + for (int i = 0; i < urls.size(); ++i) { + QByteArray ba = urls.at(i).trimmed(); + if (!ba.isEmpty()) + list.append(QUrl::fromEncoded(ba)); + } + d->setData(mimeType, list); + } else { + d->setData(mimeType, QVariant(data)); + } } /*! diff --git a/src/corelib/statemachine/qstatemachine.cpp b/src/corelib/statemachine/qstatemachine.cpp index 04c82b5cd3..3d2da77390 100644 --- a/src/corelib/statemachine/qstatemachine.cpp +++ b/src/corelib/statemachine/qstatemachine.cpp @@ -483,6 +483,8 @@ function removeConflictingTransitions(enabledTransitions): filteredTransitions.add(t1) return filteredTransitions + +Note: the implementation below does not build the transitionsToRemove, but removes them in-place. */ void QStateMachinePrivate::removeConflictingTransitions(QList<QAbstractTransition*> &enabledTransitions) { @@ -492,24 +494,36 @@ void QStateMachinePrivate::removeConflictingTransitions(QList<QAbstractTransitio foreach (QAbstractTransition *t1, enabledTransitions) { bool t1Preempted = false; - QVarLengthArray<QAbstractTransition *> transitionsToRemove; QSet<QAbstractState*> exitSetT1 = computeExitSet_Unordered(QList<QAbstractTransition*>() << t1); - foreach (QAbstractTransition *t2, filteredTransitions) { + QList<QAbstractTransition*>::iterator t2It = filteredTransitions.begin(); + while (t2It != filteredTransitions.end()) { + QAbstractTransition *t2 = *t2It; + if (t1 == t2) { + // Special case: someone added the same transition object to a state twice. In this + // case, t2 (which is already in the list) "preempts" t1. + t1Preempted = true; + break; + } + QSet<QAbstractState*> exitSetT2 = computeExitSet_Unordered(QList<QAbstractTransition*>() << t2); - if (!exitSetT1.intersect(exitSetT2).isEmpty()) { + if (exitSetT1.intersect(exitSetT2).isEmpty()) { + // No conflict, no cry. Next patient please. + ++t2It; + } else { + // Houston, we have a conflict. Check which transition can be removed. if (isDescendant(t1->sourceState(), t2->sourceState())) { - transitionsToRemove.append(t2); + // t1 preempts t2, so we can remove t2 + t2It = filteredTransitions.erase(t2It); } else { + // t2 preempts t1, so there's no use in looking further and we don't need to add + // t1 to the list. t1Preempted = true; break; } } } - if (!t1Preempted) { - foreach (QAbstractTransition *t3, transitionsToRemove) - filteredTransitions.removeAll(t3); + if (!t1Preempted) filteredTransitions.append(t1); - } } enabledTransitions = filteredTransitions; diff --git a/src/corelib/tools/qregularexpression.cpp b/src/corelib/tools/qregularexpression.cpp index cbc5a0486e..9950b90720 100644 --- a/src/corelib/tools/qregularexpression.cpp +++ b/src/corelib/tools/qregularexpression.cpp @@ -2657,7 +2657,8 @@ static const char *pcreCompileErrorCodes[] = QT_TRANSLATE_NOOP("QRegularExpression", "parentheses are too deeply nested"), QT_TRANSLATE_NOOP("QRegularExpression", "invalid range in character class"), QT_TRANSLATE_NOOP("QRegularExpression", "group name must start with a non-digit"), - QT_TRANSLATE_NOOP("QRegularExpression", "parentheses are too deeply nested (stack check)") + QT_TRANSLATE_NOOP("QRegularExpression", "parentheses are too deeply nested (stack check)"), + QT_TRANSLATE_NOOP("QRegularExpression", "digits missing in \\x{} or \\o{}") }; #endif // #if 0 diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 8373a5556b..47d187fc0e 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -1091,6 +1091,15 @@ void QImage::detach() } +static void copyMetadata(QImageData *dst, const QImageData *src) +{ + // Doesn't copy colortable and alpha_clut, or offset. + dst->dpmx = src->dpmx; + dst->dpmy = src->dpmy; + dst->devicePixelRatio = src->devicePixelRatio; + dst->text = src->text; +} + /*! \fn QImage QImage::copy(int x, int y, int width, int height) const \overload @@ -1140,12 +1149,9 @@ QImage QImage::copy(const QRect& r) const } else memcpy(image.bits(), bits(), d->nbytes); image.d->colortable = d->colortable; - image.d->dpmx = d->dpmx; - image.d->dpmy = d->dpmy; - image.d->devicePixelRatio = d->devicePixelRatio; image.d->offset = d->offset; image.d->has_alpha_clut = d->has_alpha_clut; - image.d->text = d->text; + copyMetadata(image.d, d); return image; } @@ -1231,12 +1237,9 @@ QImage QImage::copy(const QRect& r) const } } - image.d->dpmx = dotsPerMeterX(); - image.d->dpmy = dotsPerMeterY(); - image.d->devicePixelRatio = devicePixelRatio(); + copyMetadata(image.d, d); image.d->offset = offset(); image.d->has_alpha_clut = d->has_alpha_clut; - image.d->text = d->text; return image; } @@ -1987,19 +1990,19 @@ QImage QImage::convertToFormat_helper(Format format, Qt::ImageConversionFlags fl QIMAGE_SANITYCHECK_MEMORY(image); - image.setDotsPerMeterY(dotsPerMeterY()); - image.setDotsPerMeterX(dotsPerMeterX()); - image.setDevicePixelRatio(devicePixelRatio()); - - image.d->text = d->text; + image.d->offset = offset(); + copyMetadata(image.d, d); converter(image.d, d, flags); return image; } - // Convert indexed formats over ARGB32 to the final format. - Q_ASSERT(format != QImage::Format_ARGB32); - Q_ASSERT(d->format != QImage::Format_ARGB32); + // Convert indexed formats over ARGB32 or RGB32 to the final format. + Q_ASSERT(format != QImage::Format_ARGB32 && format != QImage::Format_RGB32); + Q_ASSERT(d->format != QImage::Format_ARGB32 && d->format != QImage::Format_RGB32); + + if (!hasAlphaChannel()) + return convertToFormat(Format_RGB32, flags).convertToFormat(format, flags); return convertToFormat(Format_ARGB32, flags).convertToFormat(format, flags); } @@ -2116,9 +2119,9 @@ QImage QImage::convertToFormat(Format format, const QVector<QRgb> &colorTable, Q QImage image(d->width, d->height, format); QIMAGE_SANITYCHECK_MEMORY(image); - image.setDevicePixelRatio(devicePixelRatio()); - image.d->text = d->text; + image.d->offset = offset(); + copyMetadata(image.d, d); converter(image.d, d, flags); return image; @@ -3051,9 +3054,7 @@ QImage QImage::mirrored_helper(bool horizontal, bool vertical) const result.d->colortable = d->colortable; result.d->has_alpha_clut = d->has_alpha_clut; - result.d->devicePixelRatio = d->devicePixelRatio; - result.d->dpmx = d->dpmx; - result.d->dpmy = d->dpmy; + copyMetadata(result.d, d); do_mirror(result.d, d, horizontal, vertical); @@ -3202,6 +3203,7 @@ QImage QImage::rgbSwapped_helper() const rgbSwapped_generic(d->width, d->height, this, &res, &qPixelLayouts[d->format]); break; } + copyMetadata(res.d, d); return res; } @@ -4353,8 +4355,8 @@ int QImage::bitPlaneCount() const return bpc; } -static QImage smoothScaled(const QImage &source, int w, int h) { - QImage src = source; +QImage QImage::smoothScaled(int w, int h) const { + QImage src = *this; switch (src.format()) { case QImage::Format_RGB32: case QImage::Format_ARGB32_Premultiplied: @@ -4369,11 +4371,11 @@ static QImage smoothScaled(const QImage &source, int w, int h) { else src = src.convertToFormat(QImage::Format_RGB32); } - - return qSmoothScaleImage(src, w, h); + src = qSmoothScaleImage(src, w, h); + copyMetadata(src.d, d); + return src; } - static QImage rotated90(const QImage &image) { QImage out(image.height(), image.width(), image.format()); if (image.colorCount() > 0) @@ -4574,13 +4576,13 @@ QImage QImage::transformed(const QTransform &matrix, Qt::TransformationMode mode // Make use of the optimized algorithm when we're scaling if (scale_xform && mode == Qt::SmoothTransformation) { if (mat.m11() < 0.0F && mat.m22() < 0.0F) { // horizontal/vertical flip - return smoothScaled(mirrored(true, true), wd, hd); + return smoothScaled(wd, hd).mirrored(true, true); } else if (mat.m11() < 0.0F) { // horizontal flip - return smoothScaled(mirrored(true, false), wd, hd); + return smoothScaled(wd, hd).mirrored(true, false); } else if (mat.m22() < 0.0F) { // vertical flip - return smoothScaled(mirrored(false, true), wd, hd); + return smoothScaled(wd, hd).mirrored(false, true); } else { // no flipping - return smoothScaled(*this, wd, hd); + return smoothScaled(wd, hd); } } @@ -4632,9 +4634,6 @@ QImage QImage::transformed(const QTransform &matrix, Qt::TransformationMode mode dImage.d->has_alpha_clut = d->has_alpha_clut | complex_xform; } - dImage.d->dpmx = dotsPerMeterX(); - dImage.d->dpmy = dotsPerMeterY(); - // initizialize the data if (d->format == QImage::Format_Indexed8) { if (dImage.d->colortable.size() < 256) { @@ -4672,8 +4671,8 @@ QImage QImage::transformed(const QTransform &matrix, Qt::TransformationMode mode int dbpl = dImage.bytesPerLine(); qt_xForm_helper(mat, 0, type, bpp, dImage.bits(), dbpl, 0, hd, sptr, sbpl, ws, hs); } + copyMetadata(dImage.d, d); - dImage.d->devicePixelRatio = devicePixelRatio(); return dImage; } @@ -4715,8 +4714,7 @@ bool QImageData::convertInPlace(QImage::Format newFormat, Qt::ImageConversionFla if (ref.load() > 1 || ro_data) return false; - const InPlace_Image_Converter *const converterPtr = &qimage_inplace_converter_map[format][newFormat]; - InPlace_Image_Converter converter = *converterPtr; + InPlace_Image_Converter converter = qimage_inplace_converter_map[format][newFormat]; if (converter) return converter(this, flags); else if (format > QImage::Format_Indexed8 && newFormat > QImage::Format_Indexed8 && !qimage_converter_map[format][newFormat]) diff --git a/src/gui/image/qimage.h b/src/gui/image/qimage.h index 7751bbe3d3..0ccbab819f 100644 --- a/src/gui/image/qimage.h +++ b/src/gui/image/qimage.h @@ -335,6 +335,7 @@ protected: void rgbSwapped_inplace(); QImage convertToFormat_helper(Format format, Qt::ImageConversionFlags flags) const; bool convertToFormat_inplace(Format format, Qt::ImageConversionFlags flags); + QImage smoothScaled(int w, int h) const; private: friend class QWSOnScreenSurface; diff --git a/src/gui/image/qimage_conversions.cpp b/src/gui/image/qimage_conversions.cpp index 28e3a48689..e0ca2c5331 100644 --- a/src/gui/image/qimage_conversions.cpp +++ b/src/gui/image/qimage_conversions.cpp @@ -425,25 +425,25 @@ static void convert_ARGB_to_RGBA(QImageData *dest, const QImageData *src, Qt::Im } } +template<QImage::Format DestFormat> static bool convert_ARGB_to_RGBA_inplace(QImageData *data, Qt::ImageConversionFlags) { Q_ASSERT(data->format == QImage::Format_ARGB32 || data->format == QImage::Format_ARGB32_Premultiplied); const int pad = (data->bytes_per_line >> 2) - data->width; quint32 *rgb_data = (quint32 *) data->data; + Q_CONSTEXPR uint mask = (DestFormat == QImage::Format_RGBX8888) ? 0xff000000 : 0; for (int i = 0; i < data->height; ++i) { const quint32 *end = rgb_data + data->width; while (rgb_data < end) { - *rgb_data = ARGB2RGBA(*rgb_data); + *rgb_data = ARGB2RGBA(*rgb_data | mask); ++rgb_data; } rgb_data += pad; } - if (data->format == QImage::Format_ARGB32) - data->format = QImage::Format_RGBA8888; - else - data->format = QImage::Format_RGBA8888_Premultiplied; + + data->format = DestFormat; return true; } @@ -497,8 +497,7 @@ static void convert_RGB_to_RGB30(QImageData *dest, const QImageData *src, Qt::Im { Q_ASSERT(src->format == QImage::Format_RGB32 || src->format == QImage::Format_ARGB32); - Q_ASSERT(dest->format == QImage::Format_BGR30 || dest->format == QImage::Format_A2BGR30_Premultiplied - || dest->format == QImage::Format_RGB30 || dest->format == QImage::Format_A2RGB30_Premultiplied); + Q_ASSERT(dest->format == QImage::Format_BGR30 || dest->format == QImage::Format_RGB30); Q_ASSERT(src->width == dest->width); Q_ASSERT(src->height == dest->height); @@ -520,28 +519,24 @@ static void convert_RGB_to_RGB30(QImageData *dest, const QImageData *src, Qt::Im } template<QtPixelOrder PixelOrder> -static void convert_RGB30_to_RGB(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags) +static bool convert_RGB_to_RGB30_inplace(QImageData *data, Qt::ImageConversionFlags) { - Q_ASSERT(src->format == QImage::Format_BGR30 || src->format == QImage::Format_RGB30); - Q_ASSERT(dest->format == QImage::Format_RGB32 || dest->format == QImage::Format_ARGB32 || dest->format == QImage::Format_ARGB32_Premultiplied); - Q_ASSERT(src->width == dest->width); - Q_ASSERT(src->height == dest->height); + Q_ASSERT(data->format == QImage::Format_RGB32 || data->format == QImage::Format_ARGB32); - const int src_pad = (src->bytes_per_line >> 2) - src->width; - const int dest_pad = (dest->bytes_per_line >> 2) - dest->width; - const quint32 *src_data = (quint32 *) src->data; - quint32 *dest_data = (quint32 *) dest->data; + const int pad = (data->bytes_per_line >> 2) - data->width; + QRgb *rgb_data = (QRgb *) data->data; - for (int i = 0; i < src->height; ++i) { - const quint32 *end = src_data + src->width; - while (src_data < end) { - *dest_data = qConvertA2rgb30ToArgb32<PixelOrder>(*src_data); - ++src_data; - ++dest_data; + for (int i = 0; i < data->height; ++i) { + const QRgb *end = rgb_data + data->width; + while (rgb_data < end) { + *rgb_data = qConvertRgb32ToRgb30<PixelOrder>(*rgb_data); + ++rgb_data; } - src_data += src_pad; - dest_data += dest_pad; + rgb_data += pad; } + + data->format = (PixelOrder == PixelOrderRGB) ? QImage::Format_RGB30 : QImage::Format_BGR30; + return true; } static inline uint qUnpremultiplyRgb30(uint rgb30) @@ -557,7 +552,7 @@ static inline uint qUnpremultiplyRgb30(uint rgb30) } case 2: { uint rgb = rgb30 & 0x3fffffff; - rgb += rgb >> 1; + rgb += (rgb >> 1) & 0x5ff7fdff; return (a << 30) | rgb; } case 3: @@ -567,6 +562,7 @@ static inline uint qUnpremultiplyRgb30(uint rgb30) return 0; } +template<bool rgbswap> static void convert_A2RGB30_PM_to_RGB30(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags) { Q_ASSERT(src->format == QImage::Format_A2RGB30_Premultiplied || src->format == QImage::Format_A2BGR30_Premultiplied); @@ -582,7 +578,8 @@ static void convert_A2RGB30_PM_to_RGB30(QImageData *dest, const QImageData *src, for (int i = 0; i < src->height; ++i) { const quint32 *end = src_data + src->width; while (src_data < end) { - *dest_data = 0xc0000000 | qUnpremultiplyRgb30(*src_data); + const uint p = 0xc0000000 | qUnpremultiplyRgb30(*src_data); + *dest_data = (rgbswap) ? qRgbSwapRgb30(p) : p; ++src_data; ++dest_data; } @@ -591,6 +588,7 @@ static void convert_A2RGB30_PM_to_RGB30(QImageData *dest, const QImageData *src, } } +template<bool rgbswap> static bool convert_A2RGB30_PM_to_RGB30_inplace(QImageData *data, Qt::ImageConversionFlags) { Q_ASSERT(data->format == QImage::Format_A2RGB30_Premultiplied || data->format == QImage::Format_A2BGR30_Premultiplied); @@ -601,16 +599,17 @@ static bool convert_A2RGB30_PM_to_RGB30_inplace(QImageData *data, Qt::ImageConve for (int i = 0; i < data->height; ++i) { const uint *end = rgb_data + data->width; while (rgb_data < end) { - *rgb_data = 0xc0000000 | qUnpremultiplyRgb30(*rgb_data); + const uint p = 0xc0000000 | qUnpremultiplyRgb30(*rgb_data); + *rgb_data = (rgbswap) ? qRgbSwapRgb30(p) : p; ++rgb_data; } rgb_data += pad; } if (data->format == QImage::Format_A2RGB30_Premultiplied) - data->format = QImage::Format_RGB30; + data->format = (rgbswap) ? QImage::Format_BGR30 : QImage::Format_RGB30; else - data->format = QImage::Format_BGR30; + data->format = (rgbswap) ? QImage::Format_RGB30 : QImage::Format_BGR30; return true; } @@ -678,6 +677,64 @@ static bool convert_BGR30_to_RGB30_inplace(QImageData *data, Qt::ImageConversion return true; } +static bool convert_BGR30_to_A2RGB30_inplace(QImageData *data, Qt::ImageConversionFlags flags) +{ + Q_ASSERT(data->format == QImage::Format_RGB30 || data->format == QImage::Format_BGR30); + if (!convert_BGR30_to_RGB30_inplace(data, flags)) + return false; + + if (data->format == QImage::Format_RGB30) + data->format = QImage::Format_A2RGB30_Premultiplied; + else + data->format = QImage::Format_A2BGR30_Premultiplied; + return true; +} + +template<QtPixelOrder PixelOrder> +static void convert_A2RGB30_PM_to_ARGB(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags) +{ + Q_ASSERT(src->format == QImage::Format_A2RGB30_Premultiplied || src->format == QImage::Format_A2BGR30_Premultiplied); + Q_ASSERT(dest->format == QImage::Format_ARGB32); + Q_ASSERT(src->width == dest->width); + Q_ASSERT(src->height == dest->height); + + const int src_pad = (src->bytes_per_line >> 2) - src->width; + const int dest_pad = (dest->bytes_per_line >> 2) - dest->width; + const quint32 *src_data = (quint32 *) src->data; + quint32 *dest_data = (quint32 *) dest->data; + + for (int i = 0; i < src->height; ++i) { + const quint32 *end = src_data + src->width; + while (src_data < end) { + *dest_data = qConvertA2rgb30ToArgb32<PixelOrder>(qUnpremultiplyRgb30(*src_data)); + ++src_data; + ++dest_data; + } + src_data += src_pad; + dest_data += dest_pad; + } +} + +template<QtPixelOrder PixelOrder> +static bool convert_A2RGB30_PM_to_ARGB_inplace(QImageData *data, Qt::ImageConversionFlags) +{ + Q_ASSERT(data->format == QImage::Format_A2RGB30_Premultiplied || data->format == QImage::Format_A2BGR30_Premultiplied); + + const int pad = (data->bytes_per_line >> 2) - data->width; + uint *rgb_data = (uint *) data->data; + + for (int i = 0; i < data->height; ++i) { + const uint *end = rgb_data + data->width; + while (rgb_data < end) { + *rgb_data = qConvertA2rgb30ToArgb32<PixelOrder>(qUnpremultiplyRgb30(*rgb_data)); + ++rgb_data; + } + rgb_data += pad; + } + data->format = QImage::Format_ARGB32; + return true; +} + static bool convert_indexed8_to_ARGB_PM_inplace(QImageData *data, Qt::ImageConversionFlags) { Q_ASSERT(data->format == QImage::Format_Indexed8); @@ -732,7 +789,7 @@ static bool convert_indexed8_to_ARGB_PM_inplace(QImageData *data, Qt::ImageConve return true; } -static bool convert_indexed8_to_RGB_inplace(QImageData *data, Qt::ImageConversionFlags) +static bool convert_indexed8_to_ARGB_inplace(QImageData *data, Qt::ImageConversionFlags) { Q_ASSERT(data->format == QImage::Format_Indexed8); if (!data->own_data) @@ -775,7 +832,7 @@ static bool convert_indexed8_to_RGB_inplace(QImageData *data, Qt::ImageConversio } data->colortable = QVector<QRgb>(); - data->format = QImage::Format_RGB32; + data->format = QImage::Format_ARGB32; data->bytes_per_line = dst_bytes_per_line; data->depth = depth; data->nbytes = nbytes; @@ -783,6 +840,24 @@ static bool convert_indexed8_to_RGB_inplace(QImageData *data, Qt::ImageConversio return true; } +static bool convert_indexed8_to_RGB_inplace(QImageData *data, Qt::ImageConversionFlags flags) +{ + Q_ASSERT(data->format == QImage::Format_Indexed8); + if (!data->own_data) + return false; + + if (data->has_alpha_clut) { + for (int i = 0; i < data->colortable.size(); ++i) + data->colortable[i] |= 0xff000000; + } + + if (!convert_indexed8_to_ARGB_inplace(data, flags)) + return false; + + data->format = QImage::Format_RGB32; + return true; +} + static bool convert_indexed8_to_RGB16_inplace(QImageData *data, Qt::ImageConversionFlags) { Q_ASSERT(data->format == QImage::Format_Indexed8); @@ -965,8 +1040,9 @@ static void mask_alpha_converter(QImageData *dest, const QImageData *src, Qt::Im template<QImage::Format DestFormat> static bool mask_alpha_converter_inplace(QImageData *data, Qt::ImageConversionFlags) { - Q_ASSERT(data->format == QImage::Format_RGB32 || DestFormat == QImage::Format_RGB32); - + Q_ASSERT(data->format == QImage::Format_RGB32 + || DestFormat == QImage::Format_RGB32 + || DestFormat == QImage::Format_RGBX8888); const int pad = (data->bytes_per_line >> 2) - data->width; QRgb *rgb_data = (QRgb *) data->data; @@ -1009,6 +1085,29 @@ static void mask_alpha_converter_RGBx(QImageData *dest, const QImageData *src, Q #endif } +static bool mask_alpha_converter_rgbx_inplace(QImageData *data, Qt::ImageConversionFlags flags) +{ +#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN + return mask_alpha_converter_inplace<QImage::Format_RGBX8888>(data, flags); +#else + Q_UNUSED(flags); + + const int pad = (data->bytes_per_line >> 2) - data->width; + QRgb *rgb_data = (QRgb *) data->data; + + for (int i = 0; i < data->height; ++i) { + const QRgb *end = rgb_data + data->width; + while (rgb_data < end) { + *rgb_data = *rgb_data | 0x000000fff; + ++rgb_data; + } + rgb_data += pad; + } + data->format = DestFormat; + return true; +#endif +} + static QVector<QRgb> fix_color_table(const QVector<QRgb> &ctbl, QImage::Format format) { QVector<QRgb> colorTable = ctbl; @@ -1948,9 +2047,9 @@ Image_Converter qimage_converter_map[QImage::NImageFormats][QImage::NImageFormat 0, 0, convert_RGB_to_RGB30<PixelOrderBGR>, - convert_RGB_to_RGB30<PixelOrderBGR>, - convert_RGB_to_RGB30<PixelOrderRGB>, + 0, convert_RGB_to_RGB30<PixelOrderRGB>, + 0, 0, 0 }, // Format_RGB32 @@ -2282,9 +2381,9 @@ Image_Converter qimage_converter_map[QImage::NImageFormats][QImage::NImageFormat 0, 0, 0, - convert_RGB30_to_RGB<PixelOrderBGR>, - convert_RGB30_to_RGB<PixelOrderBGR>, - convert_RGB30_to_RGB<PixelOrderBGR>, + 0, + 0, + 0, 0, 0, 0, @@ -2309,6 +2408,7 @@ Image_Converter qimage_converter_map[QImage::NImageFormats][QImage::NImageFormat 0, 0, 0, + convert_A2RGB30_PM_to_ARGB<PixelOrderBGR>, 0, 0, 0, @@ -2322,10 +2422,9 @@ Image_Converter qimage_converter_map[QImage::NImageFormats][QImage::NImageFormat 0, 0, 0, + convert_A2RGB30_PM_to_RGB30<false>, 0, - convert_A2RGB30_PM_to_RGB30, - 0, - 0, + convert_A2RGB30_PM_to_RGB30<true>, convert_BGR30_to_RGB30, 0, 0 }, // Format_BGR30A2_Premultiplied @@ -2334,9 +2433,10 @@ Image_Converter qimage_converter_map[QImage::NImageFormats][QImage::NImageFormat 0, 0, 0, - convert_RGB30_to_RGB<PixelOrderRGB>, - convert_RGB30_to_RGB<PixelOrderRGB>, - convert_RGB30_to_RGB<PixelOrderRGB>, + 0, + 0, + 0, + 0, 0, 0, 0, @@ -2351,7 +2451,6 @@ Image_Converter qimage_converter_map[QImage::NImageFormats][QImage::NImageFormat convert_BGR30_to_RGB30, convert_BGR30_to_RGB30, 0, - 0, convert_passthrough, 0, 0 }, // Format_RGB30 @@ -2361,6 +2460,7 @@ Image_Converter qimage_converter_map[QImage::NImageFormats][QImage::NImageFormat 0, 0, 0, + convert_A2RGB30_PM_to_ARGB<PixelOrderRGB>, 0, 0, 0, @@ -2374,13 +2474,11 @@ Image_Converter qimage_converter_map[QImage::NImageFormats][QImage::NImageFormat 0, 0, 0, - 0, - 0, + convert_A2RGB30_PM_to_RGB30<true>, convert_BGR30_to_RGB30, - convert_A2RGB30_PM_to_RGB30, - 0, - 0, + convert_A2RGB30_PM_to_RGB30<false>, 0, + 0, 0 }, // Format_RGB30A2_Premultiplied { 0, @@ -2440,8 +2538,8 @@ InPlace_Image_Converter qimage_inplace_converter_map[QImage::NImageFormats][QIma 0, 0, 0, - 0, convert_indexed8_to_RGB_inplace, + convert_indexed8_to_ARGB_inplace, convert_indexed8_to_ARGB_PM_inplace, convert_indexed8_to_RGB16_inplace, 0, @@ -2478,7 +2576,11 @@ InPlace_Image_Converter qimage_inplace_converter_map[QImage::NImageFormats][QIma 0, 0, 0, - 0, 0, 0, 0, 0, 0 + convert_RGB_to_RGB30_inplace<PixelOrderBGR>, + 0, + convert_RGB_to_RGB30_inplace<PixelOrderRGB>, + 0, + 0, 0 }, // Format_RGB32 { 0, @@ -2501,10 +2603,14 @@ InPlace_Image_Converter qimage_inplace_converter_map[QImage::NImageFormats][QIma 0, 0, 0, + convert_ARGB_to_RGBA_inplace<QImage::Format_RGBX8888>, + convert_ARGB_to_RGBA_inplace<QImage::Format_RGBA8888>, 0, - convert_ARGB_to_RGBA_inplace, + convert_RGB_to_RGB30_inplace<PixelOrderBGR>, 0, - 0, 0, 0, 0, 0, 0 + convert_RGB_to_RGB30_inplace<PixelOrderRGB>, + 0, + 0, 0 }, // Format_ARGB32 { 0, @@ -2525,8 +2631,12 @@ InPlace_Image_Converter qimage_inplace_converter_map[QImage::NImageFormats][QIma 0, 0, 0, - convert_ARGB_to_RGBA_inplace, - 0, 0, 0, 0, 0, 0 + convert_ARGB_to_RGBA_inplace<QImage::Format_RGBA8888_Premultiplied>, + 0, + 0, + 0, + 0, + 0, 0 }, // Format_ARGB32_Premultiplied { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 @@ -2594,7 +2704,7 @@ InPlace_Image_Converter qimage_inplace_converter_map[QImage::NImageFormats][QIma 0, 0, 0, - 0, + mask_alpha_converter_rgbx_inplace, #if Q_BYTE_ORDER == Q_LITTLE_ENDIAN && __SSE2__ 0, convert_ARGB_to_ARGB_PM_inplace_sse2, @@ -2646,10 +2756,10 @@ InPlace_Image_Converter qimage_inplace_converter_map[QImage::NImageFormats][QIma 0, 0, 0, - 0, + 0, // self convert_passthrough_inplace<QImage::Format_A2BGR30_Premultiplied>, convert_BGR30_to_RGB30_inplace, - convert_BGR30_to_RGB30_inplace, + convert_BGR30_to_A2RGB30_inplace, 0, 0 }, // Format_BGR30 { @@ -2658,6 +2768,7 @@ InPlace_Image_Converter qimage_inplace_converter_map[QImage::NImageFormats][QIma 0, 0, 0, + convert_A2RGB30_PM_to_ARGB_inplace<PixelOrderBGR>, 0, 0, 0, @@ -2671,10 +2782,9 @@ InPlace_Image_Converter qimage_inplace_converter_map[QImage::NImageFormats][QIma 0, 0, 0, - 0, - convert_A2RGB30_PM_to_RGB30_inplace, - 0, - 0, + convert_A2RGB30_PM_to_RGB30_inplace<false>, + 0, // self + convert_A2RGB30_PM_to_RGB30_inplace<true>, convert_BGR30_to_RGB30_inplace, 0, 0 }, // Format_BGR30A2_Premultiplied @@ -2699,8 +2809,8 @@ InPlace_Image_Converter qimage_inplace_converter_map[QImage::NImageFormats][QIma 0, 0, convert_BGR30_to_RGB30_inplace, - convert_BGR30_to_RGB30_inplace, - 0, + convert_BGR30_to_A2RGB30_inplace, + 0, // self convert_passthrough_inplace<QImage::Format_A2RGB30_Premultiplied>, 0, 0 }, // Format_RGB30 @@ -2710,6 +2820,7 @@ InPlace_Image_Converter qimage_inplace_converter_map[QImage::NImageFormats][QIma 0, 0, 0, + convert_A2RGB30_PM_to_ARGB_inplace<PixelOrderRGB>, 0, 0, 0, @@ -2723,11 +2834,10 @@ InPlace_Image_Converter qimage_inplace_converter_map[QImage::NImageFormats][QIma 0, 0, 0, - 0, - 0, + convert_A2RGB30_PM_to_RGB30_inplace<true>, convert_BGR30_to_RGB30_inplace, - convert_A2RGB30_PM_to_RGB30_inplace, - 0, + convert_A2RGB30_PM_to_RGB30_inplace<false>, + 0, // self 0, 0 }, // Format_RGB30A2_Premultiplied { diff --git a/src/gui/opengl/qopengl.h b/src/gui/opengl/qopengl.h index a70bd79997..72abce760d 100644 --- a/src/gui/opengl/qopengl.h +++ b/src/gui/opengl/qopengl.h @@ -221,7 +221,7 @@ typedef unsigned long long int uint64_t; typedef long int int32_t; typedef long long int int64_t; typedef unsigned long long int uint64_t; -#elif defined(_WIN32) && defined(__GNUC__) +#elif defined(_WIN32) && (defined(__GNUC__) || (defined(_MSC_VER) && _MSC_VER >= 1600)) #include <stdint.h> #elif defined(_WIN32) typedef __int32 int32_t; diff --git a/src/gui/opengl/qopenglext.h b/src/gui/opengl/qopenglext.h index 36bad4ce28..72316ca496 100644 --- a/src/gui/opengl/qopenglext.h +++ b/src/gui/opengl/qopenglext.h @@ -1399,7 +1399,7 @@ typedef unsigned long long int uint64_t; typedef long int int32_t; typedef long long int int64_t; typedef unsigned long long int uint64_t; -#elif defined(_WIN32) && defined(__GNUC__) +#elif defined(_WIN32) && (defined(__GNUC__) || (defined(_MSC_VER) && _MSC_VER >= 1600)) #include <stdint.h> #elif defined(_WIN32) typedef __int32 int32_t; diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp index a5fade99fd..ce39645246 100644 --- a/src/gui/text/qfont.cpp +++ b/src/gui/text/qfont.cpp @@ -1724,10 +1724,8 @@ bool QFont::rawMode() const */ QFont QFont::resolve(const QFont &other) const { - if (*this == other - && (resolve_mask == other.resolve_mask || resolve_mask == 0) - && d->dpi == other.d->dpi) { - QFont o = other; + if (resolve_mask == 0 || (resolve_mask == other.resolve_mask && *this == other)) { + QFont o(other); o.resolve_mask = resolve_mask; return o; } diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index 0f3cb21c70..126f0bf3ec 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -172,16 +172,6 @@ static int getFontWeight(const QString &weightString) return QFont::Normal; } -struct QtFontEncoding -{ - signed int encoding : 16; - - uint xpoint : 16; - uint xres : 8; - uint yres : 8; - uint avgwidth : 16; - uchar pitch : 8; -}; struct QtFontSize { @@ -617,19 +607,13 @@ static void parseFontName(const QString &name, QString &foundry, QString &family struct QtFontDesc { - inline QtFontDesc() : family(0), foundry(0), style(0), size(0), encoding(0), familyIndex(-1) {} + inline QtFontDesc() : family(0), foundry(0), style(0), size(0) {} QtFontFamily *family; QtFontFoundry *foundry; QtFontStyle *style; QtFontSize *size; - QtFontEncoding *encoding; - int familyIndex; }; -static int match(int script, const QFontDef &request, - const QString &family_name, const QString &foundry_name, int force_encoding_id, - QtFontDesc *desc, const QList<int> &blacklisted); - static void initFontDef(const QtFontDesc &desc, const QFontDef &request, QFontDef *fontDef, bool multi) { fontDef->family = desc.family->name; @@ -981,16 +965,14 @@ static unsigned int bestFoundry(int script, unsigned int score, int styleStrategy, const QtFontFamily *family, const QString &foundry_name, QtFontStyle::Key styleKey, int pixelSize, char pitch, - QtFontDesc *desc, int force_encoding_id, const QString &styleName = QString()) + QtFontDesc *desc, const QString &styleName = QString()) { - Q_UNUSED(force_encoding_id); Q_UNUSED(script); Q_UNUSED(pitch); desc->foundry = 0; desc->style = 0; desc->size = 0; - desc->encoding = 0; FM_DEBUG(" REMARK: looking for best foundry for family '%s' [%d]", family->name.toLatin1().constData(), family->count); @@ -1084,8 +1066,7 @@ unsigned int bestFoundry(int script, unsigned int score, int styleStrategy, enum { PitchMismatch = 0x4000, StyleMismatch = 0x2000, - BitmapScaledPenalty = 0x1000, - EncodingMismatch = 0x0002 + BitmapScaledPenalty = 0x1000 }; if (pitch != '*') { if ((pitch == 'm' && !family->fixedPitch) @@ -1128,10 +1109,9 @@ static bool matchFamilyName(const QString &familyName, QtFontFamily *f) Tries to find the best match for a given request and family/foundry */ static int match(int script, const QFontDef &request, - const QString &family_name, const QString &foundry_name, int force_encoding_id, + const QString &family_name, const QString &foundry_name, QtFontDesc *desc, const QList<int> &blacklistedFamilies) { - Q_UNUSED(force_encoding_id); int result = -1; QtFontStyle::Key styleKey; @@ -1156,8 +1136,6 @@ static int match(int script, const QFontDef &request, desc->foundry = 0; desc->style = 0; desc->size = 0; - desc->encoding = 0; - desc->familyIndex = -1; unsigned int score = ~0u; @@ -1174,16 +1152,12 @@ static int match(int script, const QFontDef &request, continue; QtFontDesc test; test.family = db->families[x]; - test.familyIndex = x; if (!matchFamilyName(family_name, test.family)) continue; test.family->ensurePopulated(); - if (family_name.isEmpty()) - load(test.family->name, script); - // Check if family is supported in the script we want if (writingSystem != QFontDatabase::Any && !(test.family->writingSystems[writingSystem] & QtFontFamily::Supported)) continue; @@ -1193,13 +1167,13 @@ static int match(int script, const QFontDef &request, unsigned int newscore = bestFoundry(script, score, request.styleStrategy, test.family, foundry_name, styleKey, request.pixelSize, pitch, - &test, force_encoding_id, request.styleName); + &test, request.styleName); if (test.foundry == 0 && !foundry_name.isEmpty()) { // the specific foundry was not found, so look for // any foundry matching our requirements newscore = bestFoundry(script, score, request.styleStrategy, test.family, QString(), styleKey, request.pixelSize, - pitch, &test, force_encoding_id, request.styleName); + pitch, &test, request.styleName); } if (newscore < score) { @@ -2537,8 +2511,6 @@ QFontDatabase::findFont(int script, const QFontPrivate *fp, { QMutexLocker locker(fontDatabaseMutex()); - const int force_encoding_id = -1; - if (!privateDb()->count) initializeDb(); @@ -2561,7 +2533,7 @@ QFontDatabase::findFont(int script, const QFontPrivate *fp, QtFontDesc desc; QList<int> blackListed; - int index = match(script, request, family_name, foundry_name, force_encoding_id, &desc, blackListed); + int index = match(script, request, family_name, foundry_name, &desc, blackListed); if (index >= 0) { engine = loadEngine(script, request, desc.family, desc.foundry, desc.style, desc.size); if (!engine) @@ -2604,7 +2576,7 @@ QFontDatabase::findFont(int script, const QFontPrivate *fp, if (!engine) { QtFontDesc desc; do { - index = match(script, def, def.family, QLatin1String(""), 0, &desc, blackListed); + index = match(script, def, def.family, QLatin1String(""), &desc, blackListed); if (index >= 0) { QFontDef loadDef = def; if (loadDef.family.isEmpty()) diff --git a/src/gui/text/qplatformfontdatabase.cpp b/src/gui/text/qplatformfontdatabase.cpp index 5fa43948aa..502348a79a 100644 --- a/src/gui/text/qplatformfontdatabase.cpp +++ b/src/gui/text/qplatformfontdatabase.cpp @@ -611,7 +611,7 @@ QSupportedWritingSystems QPlatformFontDatabase::writingSystemsFromTrueTypeBits(q hasScript = true; //qDebug("font %s supports Korean", familyName.latin1()); } - if (codePageRange[0] & (1 << SymbolCsbBit)) { + if (codePageRange[0] & (1U << SymbolCsbBit)) { writingSystems = QSupportedWritingSystems(); hasScript = false; } diff --git a/src/plugins/platforms/windows/qwindowsclipboard.cpp b/src/plugins/platforms/windows/qwindowsclipboard.cpp index bfcc9e9bce..4cea845c36 100644 --- a/src/plugins/platforms/windows/qwindowsclipboard.cpp +++ b/src/plugins/platforms/windows/qwindowsclipboard.cpp @@ -71,22 +71,23 @@ static const char formatTextHtmlC[] = "text/html"; QDebug operator<<(QDebug d, const QMimeData &m) { - QDebug nospace = d.nospace(); + QDebugStateSaver saver(d); + d.nospace(); const QStringList formats = m.formats(); - nospace << "QMimeData: " << formats.join(QStringLiteral(", ")) << '\n' + d << "QMimeData: " << formats.join(QStringLiteral(", ")) << '\n' << " Text=" << m.hasText() << " HTML=" << m.hasHtml() << " Color=" << m.hasColor() << " Image=" << m.hasImage() << " URLs=" << m.hasUrls() << '\n'; if (m.hasText()) - nospace << " Text: '" << m.text() << "'\n"; + d << " Text: '" << m.text() << "'\n"; if (m.hasHtml()) - nospace << " HTML: '" << m.html() << "'\n"; + d << " HTML: '" << m.html() << "'\n"; if (m.hasColor()) - nospace << " Color: " << qvariant_cast<QColor>(m.colorData()) << '\n'; + d << " Color: " << qvariant_cast<QColor>(m.colorData()) << '\n'; if (m.hasImage()) - nospace << " Image: " << qvariant_cast<QImage>(m.imageData()).size() << '\n'; + d << " Image: " << qvariant_cast<QImage>(m.imageData()).size() << '\n'; if (m.hasUrls()) - nospace << " URLs: " << m.urls() << '\n'; + d << " URLs: " << m.urls() << '\n'; return d; } diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index 7d7ea031a5..a532e92397 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -566,8 +566,8 @@ QString QWindowsContext::registerWindowClass(QString cname, d->m_registeredWindowClassNames.insert(cname); qCDebug(lcQpaWindows).nospace() << __FUNCTION__ << ' ' << cname - << " style=0x" << QString::number(style, 16) - << " brush=" << brush << " icon=" << icon << " atom=" << atom; + << " style=0x" << hex << style << dec + << " brush=" << brush << " icon=" << icon << " atom=" << atom; return cname; } diff --git a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp index 3284795fc1..da0ba27e3a 100644 --- a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp +++ b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp @@ -379,7 +379,12 @@ static inline QString guidToString(const GUID &g) } inline QDebug operator<<(QDebug d, const GUID &g) -{ d.nospace() << guidToString(g); return d; } +{ + QDebugStateSaver saver(d); + d.nospace(); + d << guidToString(g); + return d; +} // Return an allocated wchar_t array from a QString, reserve more memory if desired. static wchar_t *qStringToWCharArray(const QString &s, size_t reserveSize = 0) diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp index 28fb3b6498..a544b9d81e 100644 --- a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp +++ b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp @@ -608,11 +608,13 @@ static inline bool initDirectWrite(QWindowsFontEngineData *d) QDebug operator<<(QDebug d, const QFontDef &def) { - d.nospace() << "Family=" << def.family << " Stylename=" << def.styleName - << " pointsize=" << def.pointSize << " pixelsize=" << def.pixelSize - << " styleHint=" << def.styleHint << " weight=" << def.weight - << " stretch=" << def.stretch << " hintingPreference=" - << def.hintingPreference << ' '; + QDebugStateSaver saver(d); + d.nospace(); + d << "Family=" << def.family << " Stylename=" << def.styleName + << " pointsize=" << def.pointSize << " pixelsize=" << def.pixelSize + << " styleHint=" << def.styleHint << " weight=" << def.weight + << " stretch=" << def.stretch << " hintingPreference=" + << def.hintingPreference; return d; } diff --git a/src/plugins/platforms/windows/qwindowsglcontext.cpp b/src/plugins/platforms/windows/qwindowsglcontext.cpp index d9eec9f603..a7c14ed2ac 100644 --- a/src/plugins/platforms/windows/qwindowsglcontext.cpp +++ b/src/plugins/platforms/windows/qwindowsglcontext.cpp @@ -286,40 +286,41 @@ static inline void initPixelFormatDescriptor(PIXELFORMATDESCRIPTOR *d) QDebug operator<<(QDebug d, const PIXELFORMATDESCRIPTOR &pd) { - QDebug nsp = d.nospace(); - nsp << "PIXELFORMATDESCRIPTOR " + QDebugStateSaver saver(d); + d.nospace(); + d << "PIXELFORMATDESCRIPTOR " << "dwFlags=" << hex << showbase << pd.dwFlags << dec << noshowbase; - if (pd.dwFlags & PFD_DRAW_TO_WINDOW) nsp << " PFD_DRAW_TO_WINDOW"; - if (pd.dwFlags & PFD_DRAW_TO_BITMAP) nsp << " PFD_DRAW_TO_BITMAP"; - if (pd.dwFlags & PFD_SUPPORT_GDI) nsp << " PFD_SUPPORT_GDI"; - if (pd.dwFlags & PFD_SUPPORT_OPENGL) nsp << " PFD_SUPPORT_OPENGL"; - if (pd.dwFlags & PFD_GENERIC_ACCELERATED) nsp << " PFD_GENERIC_ACCELERATED"; - if (pd.dwFlags & PFD_SUPPORT_DIRECTDRAW) nsp << " PFD_SUPPORT_DIRECTDRAW"; - if (pd.dwFlags & PFD_DIRECT3D_ACCELERATED) nsp << " PFD_DIRECT3D_ACCELERATED"; - if (pd.dwFlags & PFD_SUPPORT_COMPOSITION) nsp << " PFD_SUPPORT_COMPOSITION"; - if (pd.dwFlags & PFD_GENERIC_FORMAT) nsp << " PFD_GENERIC_FORMAT"; - if (pd.dwFlags & PFD_NEED_PALETTE) nsp << " PFD_NEED_PALETTE"; - if (pd.dwFlags & PFD_NEED_SYSTEM_PALETTE) nsp << " PFD_NEED_SYSTEM_PALETTE"; - if (pd.dwFlags & PFD_DOUBLEBUFFER) nsp << " PFD_DOUBLEBUFFER"; - if (pd.dwFlags & PFD_STEREO) nsp << " PFD_STEREO"; - if (pd.dwFlags & PFD_SWAP_LAYER_BUFFERS) nsp << " PFD_SWAP_LAYER_BUFFERS"; - if (hasGLOverlay(pd)) nsp << " overlay"; - nsp << " iPixelType=" << pd.iPixelType << " cColorBits=" << pd.cColorBits + if (pd.dwFlags & PFD_DRAW_TO_WINDOW) d << " PFD_DRAW_TO_WINDOW"; + if (pd.dwFlags & PFD_DRAW_TO_BITMAP) d << " PFD_DRAW_TO_BITMAP"; + if (pd.dwFlags & PFD_SUPPORT_GDI) d << " PFD_SUPPORT_GDI"; + if (pd.dwFlags & PFD_SUPPORT_OPENGL) d << " PFD_SUPPORT_OPENGL"; + if (pd.dwFlags & PFD_GENERIC_ACCELERATED) d << " PFD_GENERIC_ACCELERATED"; + if (pd.dwFlags & PFD_SUPPORT_DIRECTDRAW) d << " PFD_SUPPORT_DIRECTDRAW"; + if (pd.dwFlags & PFD_DIRECT3D_ACCELERATED) d << " PFD_DIRECT3D_ACCELERATED"; + if (pd.dwFlags & PFD_SUPPORT_COMPOSITION) d << " PFD_SUPPORT_COMPOSITION"; + if (pd.dwFlags & PFD_GENERIC_FORMAT) d << " PFD_GENERIC_FORMAT"; + if (pd.dwFlags & PFD_NEED_PALETTE) d << " PFD_NEED_PALETTE"; + if (pd.dwFlags & PFD_NEED_SYSTEM_PALETTE) d << " PFD_NEED_SYSTEM_PALETTE"; + if (pd.dwFlags & PFD_DOUBLEBUFFER) d << " PFD_DOUBLEBUFFER"; + if (pd.dwFlags & PFD_STEREO) d << " PFD_STEREO"; + if (pd.dwFlags & PFD_SWAP_LAYER_BUFFERS) d << " PFD_SWAP_LAYER_BUFFERS"; + if (hasGLOverlay(pd)) d << " overlay"; + d << " iPixelType=" << pd.iPixelType << " cColorBits=" << pd.cColorBits << " cRedBits=" << pd.cRedBits << " cRedShift=" << pd.cRedShift << " cGreenBits=" << pd.cGreenBits << " cGreenShift=" << pd.cGreenShift << " cBlueBits=" << pd.cBlueBits << " cBlueShift=" << pd.cBlueShift; - nsp << " cDepthBits=" << pd.cDepthBits; + d << " cDepthBits=" << pd.cDepthBits; if (pd.cStencilBits) - nsp << " cStencilBits=" << pd.cStencilBits; + d << " cStencilBits=" << pd.cStencilBits; if (pd.cAuxBuffers) - nsp << " cAuxBuffers=" << pd.cAuxBuffers; - nsp << " iLayerType=" << pd.iLayerType; + d << " cAuxBuffers=" << pd.cAuxBuffers; + d << " iLayerType=" << pd.iLayerType; if (pd.dwVisibleMask) - nsp << " dwVisibleMask=" << pd.dwVisibleMask; + d << " dwVisibleMask=" << pd.dwVisibleMask; if (pd.cAlphaBits) - nsp << " cAlphaBits=" << pd.cAlphaBits << " cAlphaShift=" << pd.cAlphaShift; + d << " cAlphaBits=" << pd.cAlphaBits << " cAlphaShift=" << pd.cAlphaShift; if (pd.cAccumBits) - nsp << " cAccumBits=" << pd.cAccumBits << " cAccumRedBits=" << pd.cAccumRedBits + d << " cAccumBits=" << pd.cAccumBits << " cAccumRedBits=" << pd.cAccumRedBits << " cAccumGreenBits=" << pd.cAccumGreenBits << " cAccumBlueBits=" << pd.cAccumBlueBits << " cAccumAlphaBits=" << pd.cAccumAlphaBits; return d; @@ -906,9 +907,10 @@ void QWindowsOpenGLContextFormat::apply(QSurfaceFormat *format) const QDebug operator<<(QDebug d, const QWindowsOpenGLContextFormat &f) { - d.nospace() << "ContextFormat: v" << (f.version >> 8) << '.' - << (f.version & 0xFF) << " profile: " << f.profile - << " options: " << f.options; + QDebugStateSaver saver(d); + d.nospace(); + d << "ContextFormat: v" << (f.version >> 8) << '.' << (f.version & 0xFF) + << " profile: " << f.profile << " options: " << f.options; return d; } @@ -1018,16 +1020,17 @@ QOpenGLStaticContext *QOpenGLStaticContext::create(bool softwareRendering) QDebug operator<<(QDebug d, const QOpenGLStaticContext &s) { - QDebug nsp = d.nospace(); - nsp << "OpenGL: " << s.vendor << ',' << s.renderer << " default " + QDebugStateSaver saver(d); + d.nospace(); + d << "OpenGL: " << s.vendor << ',' << s.renderer << " default " << s.defaultFormat; if (s.extensions & QOpenGLStaticContext::SampleBuffers) - nsp << ",SampleBuffers"; + d << ",SampleBuffers"; if (s.hasExtensions()) - nsp << ", Extension-API present"; - nsp << "\nExtensions: " << (s.extensionNames.count(' ') + 1); + d << ", Extension-API present"; + d << "\nExtensions: " << (s.extensionNames.count(' ') + 1); if (QWindowsContext::verbose > 1) - nsp << s.extensionNames; + d << s.extensionNames; return d; } diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp index 1041ecf44d..9b0f126241 100644 --- a/src/plugins/platforms/windows/qwindowsintegration.cpp +++ b/src/plugins/platforms/windows/qwindowsintegration.cpp @@ -315,13 +315,12 @@ QWindowsWindowData QWindowsIntegration::createWindowData(QWindow *window) const QWindowsWindowData obtained = QWindowsWindowData::create(window, requested, window->title()); qCDebug(lcQpaWindows).nospace() - << __FUNCTION__ << '<' << window - << "\n Requested: " << requested.geometry << "frame incl.: " + << __FUNCTION__ << ' ' << window + << "\n Requested: " << requested.geometry << " frame incl.=" << QWindowsGeometryHint::positionIncludesFrame(window) - << " Flags=" << requested.flags - << "\n Obtained : " << obtained.geometry << " Margins "<< obtained.frame - << " Flags=" << obtained.flags - << " Handle=" << obtained.hwnd << '\n'; + << ' ' << requested.flags + << "\n Obtained : " << obtained.geometry << " margins=" << obtained.frame + << " handle=" << obtained.hwnd << ' ' << obtained.flags << '\n'; if (obtained.hwnd) { if (requested.flags != obtained.flags) diff --git a/src/plugins/platforms/windows/qwindowsscreen.cpp b/src/plugins/platforms/windows/qwindowsscreen.cpp index 28e2aadf14..7756c77001 100644 --- a/src/plugins/platforms/windows/qwindowsscreen.cpp +++ b/src/plugins/platforms/windows/qwindowsscreen.cpp @@ -173,20 +173,22 @@ static inline WindowsScreenDataList monitorData() static QDebug operator<<(QDebug dbg, const QWindowsScreenData &d) { - QDebug nospace = dbg.nospace(); - nospace << "Screen " << d.name << ' ' - << d.geometry.width() << 'x' << d.geometry.height() << '+' << d.geometry.x() << '+' << d.geometry.y() - << " avail: " - << d.availableGeometry.width() << 'x' << d.availableGeometry.height() << '+' << d.availableGeometry.x() << '+' << d.availableGeometry.y() - << " physical: " << d.physicalSizeMM.width() << 'x' << d.physicalSizeMM.height() - << " DPI: " << d.dpi.first << 'x' << d.dpi.second << " Depth: " << d.depth - << " Format: " << d.format; + QDebugStateSaver saver(dbg); + dbg.nospace(); + dbg.noquote(); + dbg << "Screen \"" << d.name << "\" " + << d.geometry.width() << 'x' << d.geometry.height() << '+' << d.geometry.x() << '+' << d.geometry.y() + << " avail: " + << d.availableGeometry.width() << 'x' << d.availableGeometry.height() << '+' << d.availableGeometry.x() << '+' << d.availableGeometry.y() + << " physical: " << d.physicalSizeMM.width() << 'x' << d.physicalSizeMM.height() + << " DPI: " << d.dpi.first << 'x' << d.dpi.second << " Depth: " << d.depth + << " Format: " << d.format; if (d.flags & QWindowsScreenData::PrimaryScreen) - nospace << " primary"; + dbg << " primary"; if (d.flags & QWindowsScreenData::VirtualDesktop) - nospace << " virtual desktop"; + dbg << " virtual desktop"; if (d.flags & QWindowsScreenData::LockScreen) - nospace << " lock screen"; + dbg << " lock screen"; return dbg; } diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index b19510073a..923040fd71 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -109,12 +109,13 @@ static QByteArray debugWinExStyle(DWORD exStyle) #ifndef Q_OS_WINCE // maybe available on some SDKs revisit WM_GETMINMAXINFO QDebug operator<<(QDebug d, const MINMAXINFO &i) { - d.nospace() << "MINMAXINFO maxSize=" << i.ptMaxSize.x << ',' - << i.ptMaxSize.y << " maxpos=" << i.ptMaxPosition.x - << ',' << i.ptMaxPosition.y << " mintrack=" - << i.ptMinTrackSize.x << ',' << i.ptMinTrackSize.y - << " maxtrack=" << i.ptMaxTrackSize.x << ',' - << i.ptMaxTrackSize.y; + QDebugStateSaver saver(d); + d.nospace(); + d << "MINMAXINFO maxSize=" << i.ptMaxSize.x << ',' + << i.ptMaxSize.y << " maxpos=" << i.ptMaxPosition.x + << ',' << i.ptMaxPosition.y << " mintrack=" + << i.ptMinTrackSize.x << ',' << i.ptMinTrackSize.y + << " maxtrack=" << i.ptMaxTrackSize.x << ',' << i.ptMaxTrackSize.y; return d; } #endif // !Q_OS_WINCE @@ -139,18 +140,20 @@ static inline RECT RECTfromQRect(const QRect &rect) QDebug operator<<(QDebug d, const RECT &r) { - d.nospace() << "RECT: left/top=" << r.left << ',' << r.top - << " right/bottom=" << r.right << ',' << r.bottom; + QDebugStateSaver saver(d); + d.nospace(); + d << "RECT: left/top=" << r.left << ',' << r.top + << " right/bottom=" << r.right << ',' << r.bottom; return d; } #ifndef Q_OS_WINCE // maybe available on some SDKs revisit WM_NCCALCSIZE QDebug operator<<(QDebug d, const NCCALCSIZE_PARAMS &p) { - qDebug().nospace() << "NCCALCSIZE_PARAMS " - << qrectFromRECT(p.rgrc[0]) - << ' ' << qrectFromRECT(p.rgrc[1]) << ' ' - << qrectFromRECT(p.rgrc[2]); + QDebugStateSaver saver(d); + d.nospace(); + d << "NCCALCSIZE_PARAMS " << qrectFromRECT(p.rgrc[0]) + << ' ' << qrectFromRECT(p.rgrc[1]) << ' ' << qrectFromRECT(p.rgrc[2]); return d; } #endif // !Q_OS_WINCE @@ -417,13 +420,18 @@ struct WindowCreationData QDebug operator<<(QDebug debug, const WindowCreationData &d) { - debug.nospace() << d.flags - << " topLevel=" << d.topLevel << " popup=" - << d.popup << " dialog=" << d.dialog << " desktop=" << d.desktop - << " embedded=" << d.embedded - << " tool=" << d.tool << " style=" << debugWinStyle(d.style) - << " exStyle=" << debugWinExStyle(d.exStyle) - << " parent=" << d.parentHandle; + QDebugStateSaver saver(debug); + debug.nospace(); + debug.noquote(); + debug << "WindowCreationData: " << d.flags + << "\n topLevel=" << d.topLevel; + if (d.parentHandle) + debug << " parent=" << d.parentHandle; + debug << " popup=" << d.popup << " dialog=" << d.dialog << " desktop=" << d.desktop + << " embedded=" << d.embedded << " tool=" << d.tool + << "\n style=" << debugWinStyle(d.style); + if (d.exStyle) + debug << "\n exStyle=" << debugWinExStyle(d.exStyle); return debug; } @@ -614,8 +622,8 @@ QWindowsWindowData QWindowsContext::instance()->setWindowCreationContext(context); qCDebug(lcQpaWindows).nospace() - << "CreateWindowEx: " << w << *this << " class=" <<windowClassName << " title=" << title - << "\nrequested: " << rect << ": " + << "CreateWindowEx: " << w << " class=" << windowClassName << " title=" << title + << '\n' << *this << "\nrequested: " << rect << ": " << context->frameWidth << 'x' << context->frameHeight << '+' << context->frameX << '+' << context->frameY << " custom margins: " << context->customMargins; @@ -631,7 +639,7 @@ QWindowsWindowData #endif qCDebug(lcQpaWindows).nospace() << "CreateWindowEx: returns " << w << ' ' << result.hwnd << " obtained geometry: " - << context->obtainedGeometry << context->margins; + << context->obtainedGeometry << ' ' << context->margins; if (!result.hwnd) { qErrnoWarning("%s: CreateWindowEx failed", __FUNCTION__); @@ -732,9 +740,9 @@ QMargins QWindowsGeometryHint::frame(DWORD style, DWORD exStyle) qErrnoWarning("%s: AdjustWindowRectEx failed", __FUNCTION__); const QMargins result(qAbs(rect.left), qAbs(rect.top), qAbs(rect.right), qAbs(rect.bottom)); - qCDebug(lcQpaWindows).nospace() << __FUNCTION__ << " style= 0x" - << QString::number(style, 16) << " exStyle=0x" << QString::number(exStyle, 16) << ' ' << rect << ' ' << result; - + qCDebug(lcQpaWindows).nospace() << __FUNCTION__ << " style=" + << showbase << hex << style << " exStyle=" << exStyle << dec << noshowbase + << ' ' << rect << ' ' << result; return result; } @@ -853,12 +861,12 @@ QWindowCreationContext::QWindowCreationContext(const QWindow *w, } qCDebug(lcQpaWindows).nospace() - << __FUNCTION__ << ' ' << w << geometry - << " pos incl. frame" << QWindowsGeometryHint::positionIncludesFrame(w) - << " frame: " << frameWidth << 'x' << frameHeight << '+' + << __FUNCTION__ << ' ' << w << ' ' << geometry + << " pos incl. frame=" << QWindowsGeometryHint::positionIncludesFrame(w) + << " frame=" << frameWidth << 'x' << frameHeight << '+' << frameX << '+' << frameY - << " min" << geometryHint.minimumSize << " max" << geometryHint.maximumSize - << " custom margins " << customMargins; + << " min=" << geometryHint.minimumSize << " max=" << geometryHint.maximumSize + << " custom margins=" << customMargins; } /*! @@ -1422,10 +1430,10 @@ void QWindowsWindow::setGeometry_sys(const QRect &rect) const const QMargins margins = frameMarginsDp(); const QRect frameGeometry = rect + margins; - qCDebug(lcQpaWindows) << '>' << __FUNCTION__ << this << window() - << " \n from " << geometry_sys() << " frame: " - << margins << " to " <<rect - << " new frame: " << frameGeometry; + qCDebug(lcQpaWindows) << '>' << __FUNCTION__ << window() + << "\n from " << geometry_sys() << " frame: " + << margins << " to " <<rect + << " new frame: " << frameGeometry; bool result = false; #ifndef Q_OS_WINCE @@ -1446,8 +1454,8 @@ void QWindowsWindow::setGeometry_sys(const QRect &rect) const result = MoveWindow(m_data.hwnd, frameGeometry.x(), frameGeometry.y(), frameGeometry.width(), frameGeometry.height(), true); } - qCDebug(lcQpaWindows) << '<' << __FUNCTION__ << this << window() - << " \n resulting " << result << geometry_sys(); + qCDebug(lcQpaWindows) << '<' << __FUNCTION__ << window() + << "\n resulting " << result << geometry_sys(); } QRect QWindowsWindow::frameGeometry_sys() const @@ -2131,8 +2139,8 @@ void QWindowsWindow::setCursor(const QWindowsWindowCursor &c) #ifndef QT_NO_CURSOR if (c.handle() != m_cursor.handle()) { const bool apply = applyNewCursor(window()); - qCDebug(lcQpaWindows) <<window() << __FUNCTION__ - << "Shape=" << c.cursor().shape() << " doApply=" << apply; + qCDebug(lcQpaWindows) << window() << __FUNCTION__ + << c.cursor().shape() << " doApply=" << apply; m_cursor = c; if (apply) applyCursor(); diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp index a0d6d88d11..c14ec0bb3f 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.cpp +++ b/src/plugins/platforms/xcb/qxcbscreen.cpp @@ -108,10 +108,6 @@ QXcbScreen::QXcbScreen(QXcbConnection *connection, QXcbVirtualDesktop *virtualDe } const int dpr = int(devicePixelRatio()); - // On VNC, it can be that physical size is unknown while - // virtual size is known (probably back-calculated from DPI and resolution) - if (m_sizeMillimeters.isEmpty()) - m_sizeMillimeters = m_virtualSizeMillimeters; if (m_geometry.isEmpty()) { m_geometry = QRect(QPoint(), m_virtualSize/dpr); m_nativeGeometry = QRect(QPoint(), m_virtualSize); @@ -353,6 +349,12 @@ QImage::Format QXcbScreen::format() const return QImage::Format_RGB32; } +QDpi QXcbScreen::virtualDpi() const +{ + return QDpi(Q_MM_PER_INCH * m_virtualSize.width() / m_virtualSizeMillimeters.width(), + Q_MM_PER_INCH * m_virtualSize.height() / m_virtualSizeMillimeters.height()); +} + QDpi QXcbScreen::logicalDpi() const { static const int overrideDpi = qEnvironmentVariableIntValue("QT_FONT_DPI"); @@ -363,8 +365,7 @@ QDpi QXcbScreen::logicalDpi() const int primaryDpr = int(connection()->screens().at(0)->devicePixelRatio()); return QDpi(m_forcedDpi/primaryDpr, m_forcedDpi/primaryDpr); } - return QDpi(Q_MM_PER_INCH * m_virtualSize.width() / m_virtualSizeMillimeters.width(), - Q_MM_PER_INCH * m_virtualSize.height() / m_virtualSizeMillimeters.height()); + return virtualDpi(); } @@ -415,7 +416,6 @@ void QXcbScreen::handleScreenChange(xcb_randr_screen_change_notify_event_t *chan return; m_rotation = change_event->rotation; - updateGeometry(change_event->timestamp); switch (m_rotation) { case XCB_RANDR_ROTATION_ROTATE_0: // xrandr --rotate normal m_orientation = Qt::LandscapeOrientation; @@ -451,6 +451,8 @@ void QXcbScreen::handleScreenChange(xcb_randr_screen_change_notify_event_t *chan case XCB_RANDR_ROTATION_REFLECT_Y: break; } + updateGeometry(change_event->timestamp); + QWindowSystemInterface::handleScreenGeometryChange(QPlatformScreen::screen(), geometry(), availableGeometry()); QWindowSystemInterface::handleScreenOrientationChange(QPlatformScreen::screen(), m_orientation); @@ -504,6 +506,15 @@ void QXcbScreen::updateGeometry(const QRect &geom, uint8_t rotation) break; } + // It can be that physical size is unknown while virtual size + // is known (probably back-calculated from DPI and resolution), + // e.g. on VNC or with some hardware. + if (m_sizeMillimeters.isEmpty()) { + QDpi dpi = virtualDpi(); + m_sizeMillimeters = QSizeF(Q_MM_PER_INCH * xGeometry.width() / dpi.first, + Q_MM_PER_INCH * xGeometry.width() / dpi.second); + } + xcb_get_property_reply_t * workArea = xcb_get_property_reply(xcb_connection(), xcb_get_property_unchecked(xcb_connection(), false, screen()->root, diff --git a/src/plugins/platforms/xcb/qxcbscreen.h b/src/plugins/platforms/xcb/qxcbscreen.h index a29efc1e79..ec05e3bb25 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.h +++ b/src/plugins/platforms/xcb/qxcbscreen.h @@ -94,6 +94,7 @@ public: QSizeF physicalSize() const Q_DECL_OVERRIDE { return m_sizeMillimeters; } QSize virtualSize() const { return m_virtualSize; } QSizeF physicalVirtualSize() const { return m_virtualSizeMillimeters; } + QDpi virtualDpi() const; QDpi logicalDpi() const Q_DECL_OVERRIDE; qreal devicePixelRatio() const Q_DECL_OVERRIDE; QPlatformCursor *cursor() const Q_DECL_OVERRIDE; diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp index b88a9b1ff0..1be2f93478 100644 --- a/src/widgets/dialogs/qfiledialog.cpp +++ b/src/widgets/dialogs/qfiledialog.cpp @@ -906,7 +906,7 @@ void QFileDialog::setDirectory(const QString &directory) return; QUrl newDirUrl = QUrl::fromLocalFile(newDirectory); - d->setLastVisitedDirectory(newDirUrl); + QFileDialogPrivate::setLastVisitedDirectory(newDirUrl); d->options->setInitialDirectory(QUrl::fromLocalFile(directory)); if (!d->usingWidgets()) { @@ -967,7 +967,7 @@ void QFileDialog::setDirectoryUrl(const QUrl &directory) if (!directory.isValid()) return; - d->setLastVisitedDirectory(directory); + QFileDialogPrivate::setLastVisitedDirectory(directory); d->options->setInitialDirectory(directory); if (d->nativeDialogInUse) diff --git a/src/widgets/dialogs/qfiledialog_p.h b/src/widgets/dialogs/qfiledialog_p.h index 8a10896966..f610e46f83 100644 --- a/src/widgets/dialogs/qfiledialog_p.h +++ b/src/widgets/dialogs/qfiledialog_p.h @@ -187,7 +187,7 @@ public: #endif bool restoreWidgetState(QStringList &history, int splitterPosition); - void setLastVisitedDirectory(const QUrl &dir); + static void setLastVisitedDirectory(const QUrl &dir); void retranslateWindowTitle(); void retranslateStrings(); void emitFilesSelected(const QStringList &files); diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp index 188a503d10..43db43fcd4 100644 --- a/src/widgets/itemviews/qtreeview.cpp +++ b/src/widgets/itemviews/qtreeview.cpp @@ -1913,7 +1913,7 @@ void QTreeView::mouseReleaseEvent(QMouseEvent *event) if (d->itemDecorationAt(event->pos()) == -1) { QAbstractItemView::mouseReleaseEvent(event); } else { - if (state() == QAbstractItemView::DragSelectingState) + if (state() == QAbstractItemView::DragSelectingState || state() == QAbstractItemView::DraggingState) setState(QAbstractItemView::NoState); if (style()->styleHint(QStyle::SH_ListViewExpand_SelectMouseType, 0, this) == QEvent::MouseButtonRelease) d->expandOrCollapseItemAtPos(event->pos()); diff --git a/src/widgets/kernel/qwidget_p.h b/src/widgets/kernel/qwidget_p.h index 9425426215..fe65cb19c7 100644 --- a/src/widgets/kernel/qwidget_p.h +++ b/src/widgets/kernel/qwidget_p.h @@ -358,7 +358,7 @@ public: void updateFont(const QFont &); inline void setFont_helper(const QFont &font) { - if (data.fnt == font && data.fnt.resolve() == font.resolve()) + if (data.fnt.resolve() == font.resolve() && data.fnt == font) return; updateFont(font); } diff --git a/src/widgets/util/qsystemtrayicon_x11.cpp b/src/widgets/util/qsystemtrayicon_x11.cpp index 2752c56c65..9a69db1bc8 100644 --- a/src/widgets/util/qsystemtrayicon_x11.cpp +++ b/src/widgets/util/qsystemtrayicon_x11.cpp @@ -354,7 +354,7 @@ void QSystemTrayIconPrivate::showMessage_sys(const QString &title, const QString } if (!sys) return; - QBalloonTip::showBalloon(icon, message, title, sys->systemTrayIcon(), + QBalloonTip::showBalloon(icon, title, message, sys->systemTrayIcon(), sys->globalGeometry().center(), msecs); } |