diff options
author | Liang Qi <liang.qi@qt.io> | 2018-11-21 23:59:03 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2018-11-22 01:53:29 +0100 |
commit | bf58c70546c5f9cb66d99b82abfde9ba1a056192 (patch) | |
tree | df3675d3377ef6576f82fb167ebd67fcc900a91b /src/widgets | |
parent | 37f617c405ae4f26cbb6bb4f08d61d6ccc111a98 (diff) | |
parent | 41cba737a98b16a2767c55cda0532f38b6b6a37d (diff) |
Merge remote-tracking branch 'origin/5.12' into dev
Conflicts:
src/corelib/io/qdir.cpp
src/corelib/kernel/qtimer.cpp
src/corelib/kernel/qtimer.h
Done-With: Edward Welbourne <edward.welbourne@qt.io>
Change-Id: I683d897760ec06593136d77955f8bc87fdef3f9f
Diffstat (limited to 'src/widgets')
-rw-r--r-- | src/widgets/dialogs/qcolordialog.cpp | 2 | ||||
-rw-r--r-- | src/widgets/dialogs/qfiledialog.cpp | 37 | ||||
-rw-r--r-- | src/widgets/dialogs/qfiledialog_p.h | 2 | ||||
-rw-r--r-- | src/widgets/dialogs/qmessagebox.cpp | 2 | ||||
-rw-r--r-- | src/widgets/effects/qpixmapfilter.cpp | 10 | ||||
-rw-r--r-- | src/widgets/kernel/qapplication_p.h | 2 | ||||
-rw-r--r-- | src/widgets/styles/qcommonstyle.cpp | 2 | ||||
-rw-r--r-- | src/widgets/styles/qstylesheetstyle.cpp | 16 |
8 files changed, 48 insertions, 25 deletions
diff --git a/src/widgets/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp index be60ea60b0..93e49466cb 100644 --- a/src/widgets/dialogs/qcolordialog.cpp +++ b/src/widgets/dialogs/qcolordialog.cpp @@ -57,7 +57,9 @@ #include "qpainter.h" #include "qpixmap.h" #include "qpushbutton.h" +#if QT_CONFIG(settings) #include "qsettings.h" +#endif #include "qsharedpointer.h" #include "qstyle.h" #include "qstyleoption.h" diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp index 5c6c03d3aa..69496dbd29 100644 --- a/src/widgets/dialogs/qfiledialog.cpp +++ b/src/widgets/dialogs/qfiledialog.cpp @@ -57,7 +57,9 @@ #include <qmessagebox.h> #endif #include <stdlib.h> +#if QT_CONFIG(settings) #include <qsettings.h> +#endif #include <qdebug.h> #if QT_CONFIG(mimetype) #include <qmimedatabase.h> @@ -221,6 +223,9 @@ Q_GLOBAL_STATIC(QUrl, lastVisitedDir) of QFileDialog that contains the Q_OBJECT macro, or the platform does not have a native dialog of the type that you require. + \note This option must be set before changing dialog properties + or showing the dialog. + \value ReadOnly Indicates that the model is readonly. \value HideNameFilterDetails Indicates if the file name filter details are @@ -383,7 +388,7 @@ QFileDialog::QFileDialog(const QFileDialogArgs &args) */ QFileDialog::~QFileDialog() { -#ifndef QT_NO_SETTINGS +#if QT_CONFIG(settings) Q_D(QFileDialog); d->saveSettings(); #endif @@ -722,6 +727,16 @@ bool QFileDialogPrivate::usingWidgets() const Sets the given \a option to be enabled if \a on is true; otherwise, clears the given \a option. + Options (particularly the DontUseNativeDialogs option) should be set + before changing dialog properties or showing the dialog. + + Setting options while the dialog is visible is not guaranteed to have + an immediate effect on the dialog (depending on the option and on the + platform). + + Setting options after changing other properties may cause these + values to have no effect. + \sa options, testOption() */ void QFileDialog::setOption(Option option, bool on) @@ -752,9 +767,15 @@ bool QFileDialog::testOption(Option option) const By default, all options are disabled. - Options should be set before showing the dialog. Setting them while the - dialog is visible is not guaranteed to have an immediate effect on the - dialog (depending on the option and on the platform). + Options (particularly the DontUseNativeDialogs option) should be set + before changing dialog properties or showing the dialog. + + Setting options while the dialog is visible is not guaranteed to have + an immediate effect on the dialog (depending on the option and on the + platform). + + Setting options after changing other properties may cause these + values to have no effect. \sa setOption(), testOption() */ @@ -2720,7 +2741,7 @@ void QFileDialog::accept() } } -#ifndef QT_NO_SETTINGS +#if QT_CONFIG(settings) void QFileDialogPrivate::saveSettings() { Q_Q(QFileDialog); @@ -2778,7 +2799,7 @@ bool QFileDialogPrivate::restoreFromSettings() return restoreWidgetState(history, settings.value(QLatin1String("sidebarWidth"), -1).toInt()); } -#endif // QT_NO_SETTINGS +#endif // settings bool QFileDialogPrivate::restoreWidgetState(QStringList &history, int splitterPosition) { @@ -2851,7 +2872,7 @@ void QFileDialogPrivate::init(const QUrl &directory, const QString &nameFilter, else q->selectUrl(directory); -#ifndef QT_NO_SETTINGS +#if QT_CONFIG(settings) // Try to restore from the FileDialog settings group; if it fails, fall back // to the pre-5.5 QByteArray serialized settings. if (!restoreFromSettings()) { @@ -3016,7 +3037,7 @@ void QFileDialogPrivate::createWidgets() createToolButtons(); createMenuActions(); -#ifndef QT_NO_SETTINGS +#if QT_CONFIG(settings) // Try to restore from the FileDialog settings group; if it fails, fall back // to the pre-5.5 QByteArray serialized settings. if (!restoreFromSettings()) { diff --git a/src/widgets/dialogs/qfiledialog_p.h b/src/widgets/dialogs/qfiledialog_p.h index 3a93a53911..2e49696b77 100644 --- a/src/widgets/dialogs/qfiledialog_p.h +++ b/src/widgets/dialogs/qfiledialog_p.h @@ -187,7 +187,7 @@ public: #endif } -#ifndef QT_NO_SETTINGS +#if QT_CONFIG(settings) void saveSettings(); bool restoreFromSettings(); #endif diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp index d8cd19ef1a..32190151bc 100644 --- a/src/widgets/dialogs/qmessagebox.cpp +++ b/src/widgets/dialogs/qmessagebox.cpp @@ -1839,7 +1839,7 @@ void QMessageBox::aboutQt(QWidget *parent, const QString &title) "<p>Qt provides single-source portability across all major desktop " "operating systems. It is also available for embedded Linux and other " "embedded and mobile operating systems.</p>" - "<p>Qt is available under three different licensing options designed " + "<p>Qt is available under multiple licensing options designed " "to accommodate the needs of our various users.</p>" "<p>Qt licensed under our commercial license agreement is appropriate " "for development of proprietary/commercial software where you do not " diff --git a/src/widgets/effects/qpixmapfilter.cpp b/src/widgets/effects/qpixmapfilter.cpp index b330afebed..e1e8175423 100644 --- a/src/widgets/effects/qpixmapfilter.cpp +++ b/src/widgets/effects/qpixmapfilter.cpp @@ -1105,13 +1105,15 @@ void QPixmapColorizeFilter::draw(QPainter *painter, const QPointF &dest, const Q if (srcRect.isNull()) { srcImage = src.toImage(); - srcImage = srcImage.convertToFormat(srcImage.hasAlphaChannel() ? QImage::Format_ARGB32_Premultiplied : QImage::Format_RGB32); + const auto format = srcImage.hasAlphaChannel() ? QImage::Format_ARGB32_Premultiplied : QImage::Format_RGB32; + srcImage = std::move(srcImage).convertToFormat(format); destImage = QImage(srcImage.size(), srcImage.format()); } else { QRect rect = srcRect.toAlignedRect().intersected(src.rect()); srcImage = src.copy(rect).toImage(); - srcImage = srcImage.convertToFormat(srcImage.hasAlphaChannel() ? QImage::Format_ARGB32_Premultiplied : QImage::Format_RGB32); + const auto format = srcImage.hasAlphaChannel() ? QImage::Format_ARGB32_Premultiplied : QImage::Format_RGB32; + srcImage = std::move(srcImage).convertToFormat(format); destImage = QImage(rect.size(), srcImage.format()); } destImage.setDevicePixelRatio(src.devicePixelRatioF()); @@ -1130,7 +1132,7 @@ void QPixmapColorizeFilter::draw(QPainter *painter, const QPointF &dest, const Q bufPainter.setOpacity(d->strength); bufPainter.drawImage(0, 0, destImage); bufPainter.end(); - destImage = buffer; + destImage = std::move(buffer); } if (srcImage.hasAlphaChannel()) @@ -1334,7 +1336,7 @@ void QPixmapDropShadowFilter::draw(QPainter *p, qt_blurImage(&blurPainter, tmp, d->radius, false, true); blurPainter.end(); - tmp = blurred; + tmp = std::move(blurred); // blacken the image... tmpPainter.begin(&tmp); diff --git a/src/widgets/kernel/qapplication_p.h b/src/widgets/kernel/qapplication_p.h index 2d9468cc21..05bc2468c1 100644 --- a/src/widgets/kernel/qapplication_p.h +++ b/src/widgets/kernel/qapplication_p.h @@ -113,7 +113,7 @@ public: bool tryCloseAllWindows() override; #if 0 // Used to be included in Qt4 for Q_WS_X11 -#ifndef QT_NO_SETTINGS +#if QT_CONFIG(settings) static bool x11_apply_settings(); #endif static void reset_instance_pointer(); diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp index 0821c6af59..ccf4252b79 100644 --- a/src/widgets/styles/qcommonstyle.cpp +++ b/src/widgets/styles/qcommonstyle.cpp @@ -105,7 +105,9 @@ #endif #include <qfileinfo.h> #include <qdir.h> +#if QT_CONFIG(settings) #include <qsettings.h> +#endif #include <qvariant.h> #include <qpixmapcache.h> #if QT_CONFIG(animation) diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index 121de548b0..5ed7195b60 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -5641,22 +5641,18 @@ QRect QStyleSheetStyle::subControlRect(ComplexControl cc, const QStyleOptionComp } else { sliderlen = maxlen; } - const int sliderPosition = sb->orientation == Qt::Horizontal && sb->direction == Qt::RightToLeft ? sb->maximum - sb->sliderPosition + sb->minimum : sb->sliderPosition; int sliderstart = (styleOptionSlider.orientation == Qt::Horizontal ? contentRect.left() : contentRect.top()) - + sliderPositionFromValue(sb->minimum, sb->maximum, sliderPosition, + + sliderPositionFromValue(sb->minimum, sb->maximum, sb->sliderPosition, maxlen - sliderlen, sb->upsideDown); QRect sr = (sb->orientation == Qt::Horizontal) ? QRect(sliderstart, contentRect.top(), sliderlen, contentRect.height()) : QRect(contentRect.left(), sliderstart, contentRect.width(), sliderlen); - if (sc == SC_ScrollBarSlider) { - return sr; - } else if (sc == SC_ScrollBarSubPage) { - return QRect(contentRect.topLeft(), sb->orientation == Qt::Horizontal ? sr.bottomLeft() : sr.topRight()); - } else { // SC_ScrollBarAddPage - return QRect(sb->orientation == Qt::Horizontal ? sr.topRight() : sr.bottomLeft(), contentRect.bottomRight()); - } - break; + if (sc == SC_ScrollBarSubPage) + sr = QRect(contentRect.topLeft(), sb->orientation == Qt::Horizontal ? sr.bottomLeft() : sr.topRight()); + else if (sc == SC_ScrollBarAddPage) + sr = QRect(sb->orientation == Qt::Horizontal ? sr.topRight() : sr.bottomLeft(), contentRect.bottomRight()); + return visualRect(styleOptionSlider.direction, grooveRect, sr); } case SC_ScrollBarAddLine: pe = PseudoElement_ScrollBarAddLine; break; case SC_ScrollBarSubLine: pe = PseudoElement_ScrollBarSubLine; break; |