summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2020-01-13 01:01:03 +0100
committerSimon Hausmann <simon.hausmann@qt.io>2020-01-13 10:13:01 +0100
commitcccc9d0b95cd021ae93c70867771a57aaadd16ff (patch)
tree34948260f68ee30b3ee0f8656d9b518e1438b606 /src/widgets
parent0dc5562fa4f01140e98e55ceaa743b0f4fc276c7 (diff)
parent76c4c5d5581b2cd36a043234eb167dd55041301d (diff)
Merge remote-tracking branch 'origin/5.15' into dev
Conflicts: tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp Change-Id: I4d3041fa291a918c774ffa5eb5c8792a0966451d
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/dialogs/qmessagebox.cpp4
-rw-r--r--src/widgets/kernel/qapplication.cpp55
-rw-r--r--src/widgets/kernel/qapplication_p.h8
-rw-r--r--src/widgets/widgets/qdatetimeedit.cpp33
-rw-r--r--src/widgets/widgets/qtextbrowser.cpp2
5 files changed, 48 insertions, 54 deletions
diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp
index 17d199cb4f..7a6223f45c 100644
--- a/src/widgets/dialogs/qmessagebox.cpp
+++ b/src/widgets/dialogs/qmessagebox.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2018 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtWidgets module of the Qt Toolkit.
@@ -1890,7 +1890,7 @@ void QMessageBox::aboutQt(QWidget *parent, const QString &title)
"<p>Qt and the Qt logo are trademarks of The Qt Company Ltd.</p>"
"<p>Qt is The Qt Company Ltd product developed as an open source "
"project. See <a href=\"http://%3/\">%3</a> for more information.</p>"
- ).arg(QStringLiteral("2019"),
+ ).arg(QStringLiteral("2020"),
QStringLiteral("qt.io/licensing"),
QStringLiteral("qt.io"));
QMessageBox *msgBox = new QMessageBox(parent);
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index 9568e35639..4b1daab4cf 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -414,11 +414,9 @@ bool Q_WIDGETS_EXPORT qt_tab_all_widgets()
}
// ######## move to QApplicationPrivate
-// Default application palettes and fonts (per widget type)
-Q_GLOBAL_STATIC(PaletteHash, app_palettes)
+// Default fonts (per widget type)
Q_GLOBAL_STATIC(FontHash, app_fonts)
-// Exported accessors for use outside of this file
-PaletteHash *qt_app_palettes_hash() { return app_palettes(); }
+// Exported accessor for use outside of this file
FontHash *qt_app_fonts_hash() { return app_fonts(); }
QWidgetList *QApplicationPrivate::popupWidgets = nullptr; // has keyboard input focus
@@ -635,7 +633,7 @@ static void setPossiblePalette(const QPalette *palette, const char *className)
{
if (palette == nullptr)
return;
- QApplicationPrivate::setPalette_helper(*palette, className, false);
+ QApplicationPrivate::setPalette_helper(*palette, className);
}
void QApplicationPrivate::initializeWidgetPaletteHash()
@@ -643,7 +641,8 @@ void QApplicationPrivate::initializeWidgetPaletteHash()
QPlatformTheme *platformTheme = QGuiApplicationPrivate::platformTheme();
if (!platformTheme)
return;
- app_palettes()->clear();
+
+ widgetPalettes.clear();
setPossiblePalette(platformTheme->palette(QPlatformTheme::ToolButtonPalette), "QToolButton");
setPossiblePalette(platformTheme->palette(QPlatformTheme::ButtonPalette), "QAbstractButton");
@@ -802,7 +801,7 @@ QApplication::~QApplication()
delete QApplicationPrivate::app_pal;
QApplicationPrivate::app_pal = nullptr;
clearSystemPalette();
- app_palettes()->clear();
+ QApplicationPrivate::widgetPalettes.clear();
delete QApplicationPrivate::sys_font;
QApplicationPrivate::sys_font = nullptr;
@@ -1315,6 +1314,8 @@ void QApplication::setGlobalStrut(const QSize& strut)
QApplicationPrivate::app_strut = strut;
}
+// Widget specific palettes
+QApplicationPrivate::PaletteHash QApplicationPrivate::widgetPalettes;
/*!
\fn QPalette QApplication::palette(const QWidget* widget)
@@ -1329,15 +1330,13 @@ void QApplication::setGlobalStrut(const QSize& strut)
*/
QPalette QApplication::palette(const QWidget* w)
{
- typedef PaletteHash::const_iterator PaletteHashConstIt;
-
- PaletteHash *hash = app_palettes();
- if (w && hash && hash->size()) {
- PaletteHashConstIt it = hash->constFind(w->metaObject()->className());
- const PaletteHashConstIt cend = hash->constEnd();
+ auto &widgetPalettes = QApplicationPrivate::widgetPalettes;
+ if (w && !widgetPalettes.isEmpty()) {
+ auto it = widgetPalettes.constFind(w->metaObject()->className());
+ const auto cend = widgetPalettes.constEnd();
if (it != cend)
return *it;
- for (it = hash->constBegin(); it != cend; ++it) {
+ for (it = widgetPalettes.constBegin(); it != cend; ++it) {
if (w->inherits(it.key()))
return it.value();
}
@@ -1354,17 +1353,17 @@ QPalette QApplication::palette(const QWidget* w)
*/
QPalette QApplication::palette(const char *className)
{
- PaletteHash *hash = app_palettes();
- if (className && hash && hash->size()) {
- QHash<QByteArray, QPalette>::ConstIterator it = hash->constFind(className);
- if (it != hash->constEnd())
+ auto &widgetPalettes = QApplicationPrivate::widgetPalettes;
+ if (className && !widgetPalettes.isEmpty()) {
+ auto it = widgetPalettes.constFind(className);
+ if (it != widgetPalettes.constEnd())
return *it;
}
return QGuiApplication::palette();
}
-void QApplicationPrivate::setPalette_helper(const QPalette &palette, const char* className, bool clearWidgetPaletteHash)
+void QApplicationPrivate::setPalette_helper(const QPalette &palette, const char* className)
{
QPalette pal = palette;
@@ -1372,25 +1371,19 @@ void QApplicationPrivate::setPalette_helper(const QPalette &palette, const char*
QApplicationPrivate::app_style->polish(pal); // NB: non-const reference
bool all = false;
- PaletteHash *hash = app_palettes();
if (!className) {
- if (QApplicationPrivate::app_pal && pal.isCopyOf(*QApplicationPrivate::app_pal))
+ if (!QGuiApplicationPrivate::setPalette(pal))
return;
- if (!QApplicationPrivate::app_pal)
- QApplicationPrivate::app_pal = new QPalette(pal);
- else
- *QApplicationPrivate::app_pal = pal;
if (!QApplicationPrivate::sys_pal || !palette.isCopyOf(*QApplicationPrivate::sys_pal))
QCoreApplication::setAttribute(Qt::AA_SetPalette);
- if (hash && hash->size()) {
+ if (!widgetPalettes.isEmpty()) {
all = true;
- if (clearWidgetPaletteHash)
- hash->clear();
+ widgetPalettes.clear();
}
- } else if (hash) {
- hash->insert(className, pal);
+ } else {
+ widgetPalettes.insert(className, pal);
}
if (qApp)
@@ -1422,7 +1415,7 @@ void QApplicationPrivate::setPalette_helper(const QPalette &palette, const char*
void QApplication::setPalette(const QPalette &palette, const char* className)
{
- QApplicationPrivate::setPalette_helper(palette, className, /*clearWidgetPaletteHash=*/ true);
+ QApplicationPrivate::setPalette_helper(palette, className);
}
diff --git a/src/widgets/kernel/qapplication_p.h b/src/widgets/kernel/qapplication_p.h
index 79d06ed98c..71f695cc18 100644
--- a/src/widgets/kernel/qapplication_p.h
+++ b/src/widgets/kernel/qapplication_p.h
@@ -94,9 +94,6 @@ extern QClipboard *qt_clipboard;
typedef QHash<QByteArray, QFont> FontHash;
Q_WIDGETS_EXPORT FontHash *qt_app_fonts_hash();
-typedef QHash<QByteArray, QPalette> PaletteHash;
-PaletteHash *qt_app_palettes_hash();
-
#define QApplicationPrivateBase QGuiApplicationPrivate
class Q_WIDGETS_EXPORT QApplicationPrivate : public QApplicationPrivateBase
@@ -188,11 +185,14 @@ public:
static bool widgetCount; // Coupled with -widgetcount switch
static void setSystemPalette(const QPalette &pal);
- static void setPalette_helper(const QPalette &palette, const char* className, bool clearWidgetPaletteHash);
+ static void setPalette_helper(const QPalette &palette, const char* className);
static void initializeWidgetPaletteHash();
static void initializeWidgetFontHash();
static void setSystemFont(const QFont &font);
+ using PaletteHash = QHash<QByteArray, QPalette>;
+ static PaletteHash widgetPalettes;
+
static QApplicationPrivate *instance() { return self; }
#ifdef QT_KEYPAD_NAVIGATION
diff --git a/src/widgets/widgets/qdatetimeedit.cpp b/src/widgets/widgets/qdatetimeedit.cpp
index 00fe0cd776..e4abb89636 100644
--- a/src/widgets/widgets/qdatetimeedit.cpp
+++ b/src/widgets/widgets/qdatetimeedit.cpp
@@ -219,7 +219,7 @@ QDateTimeEdit::~QDateTimeEdit()
/*!
\property QDateTimeEdit::dateTime
- \brief the QDateTime that is set in the QDateTimeEdit
+ \brief The QDateTime that is set in the QDateTimeEdit.
When setting this property, the new QDateTime is converted to the timespec of
the QDateTimeEdit, which thus remains unchanged.
@@ -259,7 +259,7 @@ void QDateTimeEdit::setDateTime(const QDateTime &datetime)
/*!
\property QDateTimeEdit::date
- \brief the QDate that is set in the widget
+ \brief The QDate that is set in the widget.
By default, this property contains a date that refers to January 1, 2000.
@@ -296,7 +296,7 @@ void QDateTimeEdit::setDate(const QDate &date)
/*!
\property QDateTimeEdit::time
- \brief the QTime that is set in the widget
+ \brief The QTime that is set in the widget.
By default, this property contains a time of 00:00:00 and 0 milliseconds.
@@ -341,7 +341,8 @@ void QDateTimeEdit::setCalendar(QCalendar calendar)
/*!
\since 4.4
\property QDateTimeEdit::minimumDateTime
- \brief the minimum datetime of the date time edit
+
+ \brief The minimum datetime of the date time edit.
Changing this property implicitly updates the \l minimumDate and \l
minimumTime properties to the date and time parts of this property,
@@ -382,7 +383,7 @@ void QDateTimeEdit::setMinimumDateTime(const QDateTime &dt)
\since 4.4
\property QDateTimeEdit::maximumDateTime
- \brief the maximum datetime of the date time edit
+ \brief The maximum datetime of the date time edit.
Changing this property implicitly updates the \l maximumDate and \l
maximumTime properties to the date and time parts of this property,
@@ -450,7 +451,7 @@ void QDateTimeEdit::setDateTimeRange(const QDateTime &min, const QDateTime &max)
/*!
\property QDateTimeEdit::minimumDate
- \brief the minimum date of the date time edit
+ \brief The minimum date of the date time edit.
Changing this property updates the date of the \l minimumDateTime property
while preserving the \l minimumTime property. When setting this property,
@@ -490,7 +491,7 @@ void QDateTimeEdit::clearMinimumDate()
/*!
\property QDateTimeEdit::maximumDate
- \brief the maximum date of the date time edit
+ \brief The maximum date of the date time edit.
Changing this property updates the date of the \l maximumDateTime property
while preserving the \l maximumTime property. When setting this property, the
@@ -529,7 +530,7 @@ void QDateTimeEdit::clearMaximumDate()
/*!
\property QDateTimeEdit::minimumTime
- \brief the minimum time of the date time edit
+ \brief The minimum time of the date time edit.
Changing this property updates the time of the \l minimumDateTime property
while preserving the \l minimumDate and \l maximumDate properties. If those
@@ -568,7 +569,7 @@ void QDateTimeEdit::clearMinimumTime()
/*!
\property QDateTimeEdit::maximumTime
- \brief the maximum time of the date time edit
+ \brief The maximum time of the date time edit.
Changing this property updates the time of the \l maximumDateTime property
while preserving the \l minimumDate and \l maximumDate properties. If those
@@ -671,7 +672,7 @@ void QDateTimeEdit::setTimeRange(const QTime &min, const QTime &max)
/*!
\property QDateTimeEdit::displayedSections
- \brief the currently displayed fields of the date time edit
+ \brief The currently displayed fields of the date time edit.
Returns a bit set of the displayed sections for this format.
\a setDisplayFormat(), displayFormat()
@@ -686,7 +687,7 @@ QDateTimeEdit::Sections QDateTimeEdit::displayedSections() const
/*!
\property QDateTimeEdit::currentSection
- \brief the current section of the spinbox
+ \brief The current section of the spinbox.
\a setCurrentSection()
*/
@@ -745,7 +746,7 @@ QDateTimeEdit::Section QDateTimeEdit::sectionAt(int index) const
\property QDateTimeEdit::sectionCount
- \brief the number of sections displayed.
+ \brief The number of sections displayed.
If the format is 'yyyy/yy/yyyy', sectionCount returns 3
*/
@@ -761,7 +762,7 @@ int QDateTimeEdit::sectionCount() const
\property QDateTimeEdit::currentSectionIndex
- \brief the current section index of the spinbox
+ \brief The current section index of the spinbox.
If the format is 'yyyy/MM/dd', the displayText is '2001/05/21', and
the cursorPosition is 5, currentSectionIndex returns 1. If the
@@ -885,7 +886,7 @@ QString QDateTimeEdit::sectionText(Section section) const
/*!
\property QDateTimeEdit::displayFormat
- \brief the format used to display the time/date of the date time edit
+ \brief The format used to display the time/date of the date time edit.
This format is described in QDateTime::toString() and QDateTime::fromString()
@@ -957,7 +958,7 @@ void QDateTimeEdit::setDisplayFormat(const QString &format)
/*!
\property QDateTimeEdit::calendarPopup
- \brief the current calendar pop-up show mode.
+ \brief The current calendar pop-up show mode.
\since 4.2
The calendar pop-up will be shown upon clicking the arrow button.
@@ -989,7 +990,7 @@ void QDateTimeEdit::setCalendarPopup(bool enable)
/*!
\property QDateTimeEdit::timeSpec
- \brief the current timespec used by the date time edit.
+ \brief The current timespec used by the date time edit.
\since 4.4
*/
diff --git a/src/widgets/widgets/qtextbrowser.cpp b/src/widgets/widgets/qtextbrowser.cpp
index 3e49390315..d0ccd435b3 100644
--- a/src/widgets/widgets/qtextbrowser.cpp
+++ b/src/widgets/widgets/qtextbrowser.cpp
@@ -823,7 +823,7 @@ void QTextBrowser::setSource(const QUrl &url)
/*!
Attempts to load the document at the given \a url with the specified \a type.
- If \a type is \l {QTextDocument::ResourceType::UnknownResource}{UnknownResource}
+ If \a type is \l {QTextDocument::UnknownResource}{UnknownResource}
(the default), the document type will be detected: that is, if the url ends
with an extension of \c{.md}, \c{.mkd} or \c{.markdown}, the document will be
loaded via \l QTextDocument::setMarkdown(); otherwise it will be loaded via