From f43e947dc405b6a2324656f631c804db8e8dec3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCri=20Valdmann?= Date: Thu, 26 Jul 2018 16:03:50 +0200 Subject: QJsonDocument: Make emptyObject an object A default-constructed QJsonObject has no data payload, it is only a pair of null pointers. So, when it becomes necessary to 'materialize' such an object, a special global emptyObject constant is used as the substitute payload. There is a small problem with this global constant though, namely that it's is_object flag is unset. In other words, the emptyObject is not an object, but an array. Fix by setting the is_object flag on emptyObject. The example code in the bug report QJsonObject parent; QJsonObject child; parent["child"] = child; // 1 child = parent["child"].toObject(); // 2 child["test"] = "test"; // 3 runs into this problem on line 1. Inserting the default-constructed child means inserting a copy of emptyObject. On line 2 a pointer to this copy of emptyObject is retrieved and cast to an object. But it's not an object, it's an array, so things go wrong hereafter. Specifically, on line 3, two inserts are performed, one from operator[] and one from operator=. Each insert increments a compaction counter. The second insert triggers compaction (QJsonObject::insert calls Value::requiredStorage calls Data::compact) and compaction branches based on the is_object flag. Replacing line 3 with child.insert("test", "test"); causes the example to appear to work since compaction is not triggered and the JSON serializer does not look at the is_object flag. Still, any further insert() calls would trigger compaction and memory corruption. Task-number: QTBUG-69626 Change-Id: I8bd5174dce95998bac479c4b4ffea70bca1a4d04 Reviewed-by: Lars Knoll --- src/corelib/serialization/qjson.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib') diff --git a/src/corelib/serialization/qjson.cpp b/src/corelib/serialization/qjson.cpp index 7912b5040c..b82923fe0c 100644 --- a/src/corelib/serialization/qjson.cpp +++ b/src/corelib/serialization/qjson.cpp @@ -46,7 +46,7 @@ namespace QJsonPrivate { static Q_CONSTEXPR Base emptyArray = { { qle_uint(sizeof(Base)) }, { 0 }, { qle_uint(0) } }; -static Q_CONSTEXPR Base emptyObject = { { qle_uint(sizeof(Base)) }, { 0 }, { qle_uint(0) } }; +static Q_CONSTEXPR Base emptyObject = { { qle_uint(sizeof(Base)) }, { qToLittleEndian(1u) }, { qle_uint(0) } }; void Data::compact() { -- cgit v1.2.3 From 9a30a8f4fc19a90835e4d1032f9ab753ff3b2ae6 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Mon, 30 Jul 2018 17:43:05 +0200 Subject: Link from QLocale to where date-time formats are explained QLocale has various methods that deal in date-time formats, which may be supplied as strings; but does not document the form of a format string. That's documented in QDate, QTime and QDateTime, so link to them for the details. Task-number: QTBUG-23307 Change-Id: I6347d80a87dc03f6a4065e3d5bf4d535f05af93f Reviewed-by: Thiago Macieira --- src/corelib/tools/qlocale.cpp | 12 ++++++++++++ src/corelib/tools/qlocale.qdoc | 4 ++++ 2 files changed, 16 insertions(+) (limited to 'src/corelib') diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp index 00a2c05c35..89896cdc60 100644 --- a/src/corelib/tools/qlocale.cpp +++ b/src/corelib/tools/qlocale.cpp @@ -1773,6 +1773,8 @@ QString QLocale::toString(qulonglong i) const Returns a localized string representation of the given \a date in the specified \a format. If \a format is an empty string, an empty string is returned. + + \sa QDate::toString() */ QString QLocale::toString(const QDate &date, const QString &format) const @@ -1787,6 +1789,8 @@ QString QLocale::toString(const QDate &date, const QString &format) const Returns a localized string representation of the given \a date in the specified \a format. If \a format is an empty string, an empty string is returned. + + \sa QDate::toString() */ QString QLocale::toString(const QDate &date, QStringView format) const { @@ -1839,6 +1843,8 @@ static bool timeFormatContainsAP(QStringView format) Returns a localized string representation of the given \a time according to the specified \a format. If \a format is an empty string, an empty string is returned. + + \sa QTime::toString() */ QString QLocale::toString(const QTime &time, const QString &format) const { @@ -1852,6 +1858,8 @@ QString QLocale::toString(const QTime &time, const QString &format) const Returns a localized string representation of the given \a time according to the specified \a format. If \a format is an empty string, an empty string is returned. + + \sa QTime::toString() */ QString QLocale::toString(const QTime &time, QStringView format) const { @@ -1865,6 +1873,8 @@ QString QLocale::toString(const QTime &time, QStringView format) const Returns a localized string representation of the given \a dateTime according to the specified \a format. If \a format is an empty string, an empty string is returned. + + \sa QDateTime::toString(), QDate::toString(), QTime::toString() */ QString QLocale::toString(const QDateTime &dateTime, const QString &format) const @@ -1879,6 +1889,8 @@ QString QLocale::toString(const QDateTime &dateTime, const QString &format) cons Returns a localized string representation of the given \a dateTime according to the specified \a format. If \a format is an empty string, an empty string is returned. + + \sa QDateTime::toString(), QDate::toString(), QTime::toString() */ QString QLocale::toString(const QDateTime &dateTime, QStringView format) const { diff --git a/src/corelib/tools/qlocale.qdoc b/src/corelib/tools/qlocale.qdoc index ed3eb93313..c23e4e3439 100644 --- a/src/corelib/tools/qlocale.qdoc +++ b/src/corelib/tools/qlocale.qdoc @@ -939,6 +939,8 @@ locale doesn't support narrow names, so you should avoid using it for date formatting. Also, for the system locale this format is the same as ShortFormat. + + \sa QDateTime::toString(), QDate::toString(), QTime::toString() */ /*! @@ -1103,6 +1105,8 @@ \value ListToSeparatedString a string that represents a join of a given QStringList with a locale-defined separator. \value NativeLanguageName a string that represents the name of the native language. \value NativeCountryName a string that represents the name of the native country. + + \sa FormatType */ /*! -- cgit v1.2.3 From 6a1c26b08a56cd71315fcbbf2743c32072d806d2 Mon Sep 17 00:00:00 2001 From: Paul Wicking Date: Mon, 16 Jul 2018 09:45:48 +0200 Subject: Doc: Update signals and slots introduction page MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use this as context in connect to functors/lambdas. Add description of the use of context in connects. Update the simple example to make it slightly less confusing for (new) readers. Task-number: QTBUG-69483 Change-Id: Ibbbe98c4282cea4ebd860b1d174871559b7f195b Reviewed-by: Topi Reiniƶ --- .../doc/src/objectmodel/signalsandslots.qdoc | 48 ++++++++++++---------- 1 file changed, 26 insertions(+), 22 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/doc/src/objectmodel/signalsandslots.qdoc b/src/corelib/doc/src/objectmodel/signalsandslots.qdoc index 6d3064d217..213caa6c59 100644 --- a/src/corelib/doc/src/objectmodel/signalsandslots.qdoc +++ b/src/corelib/doc/src/objectmodel/signalsandslots.qdoc @@ -246,18 +246,20 @@ If you pass the Qt::UniqueConnection \a type, the connection will only be made if it is not a duplicate. If there is already a duplicate (exact same signal to the exact same slot on the same objects), - the connection will fail and connect will return false + the connection will fail and connect will return \c false. This example illustrates that objects can work together without needing to know any information about each other. To enable this, the objects only need to be connected together, and this can be achieved with some simple - QObject::connect() function calls, or with \c{uic}'s - \l{Automatic Connections}{automatic connections} feature. + QObject::connect() function calls, or with \l{User Interface Compiler + (uic)}{uic}'s \l{Automatic Connections}{automatic connections} feature. \section1 A Real Example - Here is a simple commented example of a widget. + The following is an example of the header of a simple widget class without + member functions. The purpose is to show how you can utilize signals and + slots in your own applications. \snippet signalsandslots/lcdnumber.h 0 \snippet signalsandslots/lcdnumber.h 1 @@ -281,19 +283,13 @@ \snippet signalsandslots/lcdnumber.h 6 \snippet signalsandslots/lcdnumber.h 7 - - It's not obviously relevant to the moc, but if you inherit - QWidget you almost certainly want to have the \c parent argument - in your constructor and pass it to the base class's constructor. - - Some destructors and member functions are omitted here; the \c - moc ignores member functions. - + \codeline \snippet signalsandslots/lcdnumber.h 8 \snippet signalsandslots/lcdnumber.h 9 - \c LcdNumber emits a signal when it is asked to show an impossible - value. + After the class constructor and \c public members, we declare the class + \c signals. The \c LcdNumber class emits a signal, \c overflow(), when it + is asked to show an impossible value. If you don't care about overflow, or you know that overflow cannot occur, you can ignore the \c overflow() signal, i.e. don't @@ -325,8 +321,8 @@ callbacks, you'd have to find five different names and keep track of the types yourself. - Some irrelevant member functions have been omitted from this - example. + \sa QLCDNumber, QObject::connect(), {Digital Clock Example}, and + {Tetrix Example}. \section1 Signals And Slots With Default Arguments @@ -361,16 +357,24 @@ You can also connect to functors or C++11 lambdas: \code - connect(sender, &QObject::destroyed, [=](){ this->m_objects.remove(sender); }); + connect(sender, &QObject::destroyed, this, [=](){ this->m_objects.remove(sender); }); \endcode + In both these cases, we provide \a this as context in the call to connect(). + The context object provides information about in which thread the receiver + should be executed. This is important, as providing the context ensures + that the receiver is executed in the context thread. + + The lambda will be disconnected when the sender or context is destroyed. + You should take care that any objects used inside the functor are still + alive when the signal is emitted. + The other way to connect a signal to a slot is to use QObject::connect() and the \c{SIGNAL} and \c{SLOT} macros. - The rule about whether to - include arguments or not in the \c{SIGNAL()} and \c{SLOT()} - macros, if the arguments have default values, is that the - signature passed to the \c{SIGNAL()} macro must \e not have fewer - arguments than the signature passed to the \c{SLOT()} macro. + The rule about whether to include arguments or not in the \c{SIGNAL()} and + \c{SLOT()} macros, if the arguments have default values, is that the + signature passed to the \c{SIGNAL()} macro must \e not have fewer arguments + than the signature passed to the \c{SLOT()} macro. All of these would work: \code -- cgit v1.2.3 From d3cbabcc6dd1c0162e01214b25631332566354bd Mon Sep 17 00:00:00 2001 From: Andre Hartmann Date: Wed, 1 Aug 2018 07:59:45 +0200 Subject: QDeadlineTimer: Fix documentation typo Change-Id: If8f7766ca0698a3defdf9c59c44fb02a8a5b3b62 Reviewed-by: Martin Smith --- src/corelib/kernel/qdeadlinetimer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/kernel/qdeadlinetimer.cpp b/src/corelib/kernel/qdeadlinetimer.cpp index 4b9a946dd8..8a5bd5d681 100644 --- a/src/corelib/kernel/qdeadlinetimer.cpp +++ b/src/corelib/kernel/qdeadlinetimer.cpp @@ -224,7 +224,7 @@ QDeadlineTimer::QDeadlineTimer(qint64 msecs, Qt::TimerType type) Q_DECL_NOTHROW Constructs a QDeadlineTimer object with a deadline at \a deadline time point, converting from the clock source \c{Clock} to Qt's internal clock - source (see QElapsedTimer::clcokType()). + source (see QElapsedTimer::clockType()). If \a deadline is in the past, this QDeadlineTimer object is set to expired, whereas if \a deadline is equal to \c{Duration::max()}, then this @@ -267,7 +267,7 @@ QDeadlineTimer::QDeadlineTimer(qint64 msecs, Qt::TimerType type) Q_DECL_NOTHROW Sets this QDeadlineTimer to the deadline marked by \a deadline time point, converting from the clock source \c{Clock} to Qt's internal clock - source (see QElapsedTimer::clcokType()). + source (see QElapsedTimer::clockType()). If \a deadline is in the past, this QDeadlineTimer object is set to expired, whereas if \a deadline is equal to \c{Duration::max()}, then this -- cgit v1.2.3 From bd7eb131782286d5b41fb1a5b9de0350b4968e3b Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Mon, 23 Jul 2018 08:25:56 +0200 Subject: Fix conditions for dup2 in QProcess::startDetached The channel pipes are only set up if the channel's type is Redirect. Fix the conditions accordingly. This amends commit 7ad55ca6. Change-Id: Ie8a800fbe2bf9f5f6709b14ba03133b80e9b4bef Reviewed-by: Thiago Macieira Reviewed-by: Oswald Buddenhagen --- src/corelib/io/qprocess_unix.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp index a849519635..713af9bd40 100644 --- a/src/corelib/io/qprocess_unix.cpp +++ b/src/corelib/io/qprocess_unix.cpp @@ -949,16 +949,14 @@ bool QProcessPrivate::startDetached(qint64 *pid) qt_safe_close(pidPipe[1]); // copy the stdin socket if asked to (without closing on exec) - if (inputChannelMode != QProcess::ForwardedInputChannel) + if (stdinChannel.type == Channel::Redirect) qt_safe_dup2(stdinChannel.pipe[0], STDIN_FILENO, 0); // copy the stdout and stderr if asked to - if (processChannelMode != QProcess::ForwardedChannels) { - if (processChannelMode != QProcess::ForwardedOutputChannel) - qt_safe_dup2(stdoutChannel.pipe[1], STDOUT_FILENO, 0); - if (processChannelMode != QProcess::ForwardedErrorChannel) - qt_safe_dup2(stderrChannel.pipe[1], STDERR_FILENO, 0); - } + if (stdoutChannel.type == Channel::Redirect) + qt_safe_dup2(stdoutChannel.pipe[1], STDOUT_FILENO, 0); + if (stderrChannel.type == Channel::Redirect) + qt_safe_dup2(stderrChannel.pipe[1], STDERR_FILENO, 0); if (!encodedWorkingDirectory.isEmpty()) { if (QT_CHDIR(encodedWorkingDirectory.constData()) == -1) -- cgit v1.2.3 From 843629dd1f4e0521ab9bcc6b3c806a5d90b13613 Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Fri, 27 Jul 2018 16:55:06 +0200 Subject: Improve documentation of QString::indexOf that take QRegExp They said "By default, this function is case sensitive" but this makes no sense when you're using a regexp for searching, the regexp is case sensitive or not by itself, QStringList does not influence that. Change-Id: I7446cb52a9f915c6551af6046ce89cbc8bab96ed Reviewed-by: Thiago Macieira --- src/corelib/tools/qstringlist.cpp | 8 -------- 1 file changed, 8 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/tools/qstringlist.cpp b/src/corelib/tools/qstringlist.cpp index c9db39a29f..e9b7397a74 100644 --- a/src/corelib/tools/qstringlist.cpp +++ b/src/corelib/tools/qstringlist.cpp @@ -611,8 +611,6 @@ static int lastIndexOfMutating(const QStringList *that, QRegExp &rx, int from) the list, searching forward from index position \a from. Returns -1 if no item matched. - By default, this function is case sensitive. - \sa lastIndexOf(), contains(), QRegExp::exactMatch() */ int QtPrivate::QStringList_indexOf(const QStringList *that, const QRegExp &rx, int from) @@ -630,8 +628,6 @@ int QtPrivate::QStringList_indexOf(const QStringList *that, const QRegExp &rx, i the list, searching forward from index position \a from. Returns -1 if no item matched. - By default, this function is case sensitive. - If an item matched, the \a rx regular expression will contain the matched objects (see QRegExp::matchedLength, QRegExp::cap). @@ -650,8 +646,6 @@ int QtPrivate::QStringList_indexOf(const QStringList *that, QRegExp &rx, int fro from is -1 (the default), the search starts at the last item. Returns -1 if no item matched. - By default, this function is case sensitive. - \sa indexOf(), contains(), QRegExp::exactMatch() */ int QtPrivate::QStringList_lastIndexOf(const QStringList *that, const QRegExp &rx, int from) @@ -670,8 +664,6 @@ int QtPrivate::QStringList_lastIndexOf(const QStringList *that, const QRegExp &r from is -1 (the default), the search starts at the last item. Returns -1 if no item matched. - By default, this function is case sensitive. - If an item matched, the \a rx regular expression will contain the matched objects (see QRegExp::matchedLength, QRegExp::cap). -- cgit v1.2.3 From f0ff73f631093b11c77d8d6fb548acfe8eb62583 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Thu, 19 Jul 2018 13:05:52 +0200 Subject: QProcess::startDetached: Fix behavior change on Windows Do not overwrite stdout/stderr by default, but only if requested. This restores the behavior of QProcess::startDetached of Qt 5.9. Task-number: QTBUG-67905 Change-Id: Idccf7b0da7bd80f88a0624286ddf2851bc974fb1 Reviewed-by: Friedemann Kleint --- src/corelib/io/qprocess.cpp | 4 ++++ src/corelib/io/qprocess_win.cpp | 14 +++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp index 2ee680a7c6..890867cd51 100644 --- a/src/corelib/io/qprocess.cpp +++ b/src/corelib/io/qprocess.cpp @@ -2147,6 +2147,10 @@ void QProcess::start(OpenMode mode) \endlist All other properties of the QProcess object are ignored. + \note The called process inherits the console window of the calling + process. To suppress console output, redirect standard/error output to + QProcess::nullDevice(). + \sa start() \sa startDetached(const QString &program, const QStringList &arguments, const QString &workingDirectory, qint64 *pid) diff --git a/src/corelib/io/qprocess_win.cpp b/src/corelib/io/qprocess_win.cpp index b1ec2c560c..8c4e5b41b4 100644 --- a/src/corelib/io/qprocess_win.cpp +++ b/src/corelib/io/qprocess_win.cpp @@ -874,6 +874,11 @@ static bool startDetachedUacPrompt(const QString &programIn, const QStringList & return true; } +static Q_PIPE pipeOrStdHandle(Q_PIPE pipe, DWORD handleNumber) +{ + return pipe != INVALID_Q_PIPE ? pipe : GetStdHandle(handleNumber); +} + bool QProcessPrivate::startDetached(qint64 *pid) { static const DWORD errorElevationRequired = 740; @@ -906,15 +911,14 @@ bool QProcessPrivate::startDetached(qint64 *pid) 0, 0, 0, STARTF_USESTDHANDLES, 0, 0, 0, - stdinChannel.pipe[0], stdoutChannel.pipe[1], stderrChannel.pipe[1] + pipeOrStdHandle(stdinChannel.pipe[0], STD_INPUT_HANDLE), + pipeOrStdHandle(stdoutChannel.pipe[1], STD_OUTPUT_HANDLE), + pipeOrStdHandle(stderrChannel.pipe[1], STD_ERROR_HANDLE) }; - const bool inheritHandles = stdinChannel.type == Channel::Redirect - || stdoutChannel.type == Channel::Redirect - || stderrChannel.type == Channel::Redirect; QProcess::CreateProcessArguments cpargs = { nullptr, reinterpret_cast(const_cast(args.utf16())), - nullptr, nullptr, inheritHandles, dwCreationFlags, envPtr, + nullptr, nullptr, true, dwCreationFlags, envPtr, workingDirectory.isEmpty() ? nullptr : reinterpret_cast(workingDirectory.utf16()), &startupInfo, &pinfo -- cgit v1.2.3 From 66be5445e64b54bf60069dfee5dd918459e3deed Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 1 Aug 2018 12:59:42 +0200 Subject: Windows: Implement Qt::WindowStaysOnBottomHint Set the Z-order to HWND_BOTTOM in that case. Add a doc note stating that it only works for frameless or full screen windows. Task-number: QTBUG-53717 Change-Id: I7abf219a88aac715c51d27d925504da9e91b56f1 Reviewed-by: Paul Wicking Reviewed-by: Andre de la Rocha Reviewed-by: Oliver Wolff --- src/corelib/global/qnamespace.qdoc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index 36f2aaee72..8e46f3f0fd 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -2271,13 +2271,17 @@ correctly. \value WindowStaysOnBottomHint Informs the window system that the - window should stay on bottom of all other windows. Note - that on X11 this hint will work only in window managers + window should stay on bottom of all other windows. + + \note On X11, this hint will work only in window managers that support _NET_WM_STATE_BELOW atom. If a window always on the bottom has a parent, the parent will also be left on the bottom. This window hint is currently not implemented for \macos. + \note On Windows, this will work only for frameless or + full-screen windows. + \value WindowTransparentForInput Informs the window system that this window is used only for output (displaying something) and does not take input. Therefore input events should pass through as if it wasn't there. -- cgit v1.2.3 From d2d59e77d5e16bc79ddfed37f4f29d1dcd9b92a7 Mon Sep 17 00:00:00 2001 From: Paul Wicking Date: Fri, 3 Aug 2018 10:49:03 +0200 Subject: Doc: Increase precision in description of convenience typedefs Task-number: QTBUG-53856 Change-Id: I57917bb311d1d93e0903f2b3e021cc4db0f0d05e Reviewed-by: Nico Vertriest --- src/corelib/global/qglobal.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib') diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index f60e47928c..a6990b88f4 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -589,7 +589,7 @@ Q_STATIC_ASSERT((std::is_same::value)); {long long int } (\c __int64 on Windows). Several convenience type definitions are declared: \l qreal for \c - double, \l uchar for \c unsigned char, \l uint for \c unsigned + double or \c float, \l uchar for \c unsigned char, \l uint for \c unsigned int, \l ulong for \c unsigned long and \l ushort for \c unsigned short. -- cgit v1.2.3 From 6953e513f9034b98a48d83b67afd671f1ee33aeb Mon Sep 17 00:00:00 2001 From: Paul Wicking Date: Fri, 3 Aug 2018 13:47:48 +0200 Subject: Doc: Clean up Qt::ApplicationAttribute docs * Remove () from links to QGuiApplication link names. The link targets QGuiApplication, and the syntax Q(Gui)Application to suggest both QGuiApplication and QApplication seems unnecessary, as QApplication derives from QGuiApplication anyway. * Move added in version line to the bottom of each entry that contains said line for consistency. * "was added in" > "has been added in" Task-number: QTBUG-56077 Change-Id: Ife93acb7936ff9f0d3af2f2f456ad0db95419797 Reviewed-by: Nico Vertriest --- src/corelib/global/qnamespace.qdoc | 68 ++++++++++++++++++++------------------ 1 file changed, 35 insertions(+), 33 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index 8e46f3f0fd..d6191d1585 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -116,8 +116,8 @@ \value AA_DontShowShortcutsInContextMenus Actions with the Shortcut property won't be shown in any shortcut menus unless specifically set by the - QAction::shortcutVisibleInContextMenu property. This value has - been added in Qt 5.10. + QAction::shortcutVisibleInContextMenu property. This value was added + in Qt 5.10. \value AA_NativeWindows Ensures that widgets have native windows. @@ -132,9 +132,8 @@ menu and not taking possession of the native menu bar. Setting this attribute to true will also set the AA_DontUseNativeMenuBar attribute to true. It also disables native event filters. - This attribute has been added in Qt 5.7. It must be set before - \l {QGuiApplication}{Q\(Gui\)Application} is constructed. - + This attribute must be set before QGuiApplication constructed. + This value was added in Qt 5.7. \value AA_DontUseNativeMenuBar All menubars created while this attribute is set to true won't be used as a native menubar (e.g, the menubar at @@ -174,14 +173,14 @@ \value AA_UseDesktopOpenGL Forces the usage of desktop OpenGL (for example, \e opengl32.dll or \e libGL.so) on platforms that use dynamic loading - of the OpenGL implementation. This value has been added in Qt 5.3. - This attribute must be set before \l {QGuiApplication} - {Q\(Gui\)Application} is constructed. + of the OpenGL implementation. This attribute must be set before + QGuiApplication is constructed. + This value was added in Qt 5.3. \value AA_UseOpenGLES Forces the usage of OpenGL ES 2.0 or higher on platforms that use dynamic loading of the OpenGL implementation. - This value has been added in Qt 5.3. This attribute must be set - before \l {QGuiApplication}{Q\(Gui\)Application} is constructed. + This attribute must be set before QGuiApplication is constructed. + This value was added in Qt 5.3. \value AA_UseSoftwareOpenGL Forces the usage of a software based OpenGL implementation on platforms that use dynamic loading of the OpenGL @@ -191,29 +190,28 @@ implementation is available. The default name of this library is \c opengl32sw.dll and can be overridden by setting the environment variable \e QT_OPENGL_DLL. See the platform-specific pages, for - instance \l{Qt for Windows}, for more information. This value has - been added in Qt 5.4. This attribute must be set before - \l {QGuiApplication}{Q\(Gui\)Application} is constructed. + instance \l{Qt for Windows}, for more information. This attribute + must be set before QGuiApplication is constructed. + This value was added in Qt 5.4. \value AA_ShareOpenGLContexts Enables resource sharing between the OpenGL contexts used by classes like QOpenGLWidget and QQuickWidget. This allows sharing OpenGL resources, like textures, between QOpenGLWidget - instances that belong to different top-level windows. This value has - been added in Qt 5.4. This attribute must be set before - \l {QGuiApplication}{Q\(Gui\)Application} is constructed. + instances that belong to different top-level windows. This attribute + must be set before QGuiApplication is constructed. + This value was added in Qt 5.4. \value AA_SetPalette Indicates whether a palette was explicitly set on the - \l {QGuiApplication}{Q\(Gui\)Application}. This value has been added - in Qt 5.5. + QGuiApplication. This value was added in Qt 5.5. \value AA_EnableHighDpiScaling Enables high-DPI scaling in Qt on supported platforms (see also \l{High DPI Displays}). Supported platforms are X11, Windows and Android. Enabling makes Qt scale the main (device independent) coordinate system according to display scale factors provided by the operating system. This corresponds to setting the - QT_AUTO_SCREEN\unicode{0x200b}_SCALE_FACTOR environment variable to 1. This value - has been added in Qt 5.6. This attribute must be set before - Q(Gui)Application is constructed. + QT_AUTO_SCREEN\unicode{0x200b}_SCALE_FACTOR environment variable to + 1. This attribute must be set before QGuiApplication is constructed. + This value was added in Qt 5.6. \value AA_DisableHighDpiScaling Disables high-DPI scaling in Qt, exposing window system coordinates. Note that the window system may do its own scaling, @@ -221,24 +219,26 @@ be equal to 1. In addition, scale factors set by QT_SCALE_FACTOR will not be affected. This corresponds to setting the QT_AUTO_SCREEN\unicode{0x200b}_SCALE_FACTOR environment variable to 0. - This value has been added in Qt 5.6. This - attribute must be set before Q(Gui)Application is constructed. + This attribute must be set before QGuiApplication is constructed. + This value was added in Qt 5.6. \value AA_UseStyleSheetPropagationInWidgetStyles By default, Qt Style Sheets disable regular QWidget palette and font propagation. When this flag is enabled, font and palette changes propagate as though the user had manually called the corresponding QWidget methods. See \l{The Style Sheet Syntax#Inheritance}{The Style Sheet Syntax - Inheritance} - for more details. This value has been added in Qt 5.7. + for more details. + This value was added in Qt 5.7. \value AA_DontUseNativeDialogs All dialogs created while this attribute is set to true won't use the native dialogs provided by the platform. - This value has been added in Qt 5.7. + This value was added in Qt 5.7. \value AA_SynthesizeMouseForUnhandledTabletEvents All tablet events that are not accepted by the application will be translated to mouse events instead. This attribute is enabled - by default. This value has been added in Qt 5.7. + by default. + This value was added in Qt 5.7. \value AA_CompressHighFrequencyEvents Enables compression of certain frequent events. On the X11 windowing system, the default value is true, which means that @@ -251,19 +251,21 @@ If your application needs to handle all events with no compression, you can unset this attribute. Notice that input events from tablet devices will not be compressed. See AA_CompressTabletEvents if you want these to be - compressed as well. This value has been added in Qt 5.7. + compressed as well. + This value was added in Qt 5.7. \value AA_CompressTabletEvents Enables compression of input events from tablet devices. Notice that AA_CompressHighFrequencyEvents must be true for events compression to be enabled, and that this flag extends the former to tablet events. Its default - value is false. This value has been added in Qt 5.10. + value is false. + This value was added in Qt 5.10. \value AA_DontCheckOpenGLContextThreadAffinity When making a context current using QOpenGLContext, do not check that the \l{QObject#Thread Affinity}{QObject thread affinity} of the QOpenGLContext object is the same thread calling - \l{QOpenGLContext::makeCurrent}{makeCurrent()}. This value has been - added in Qt 5.8. + \l{QOpenGLContext::makeCurrent}{makeCurrent()}. + This value was added in Qt 5.8. \value AA_DisableShaderDiskCache Disables caching of shader program binaries on disk. By default Qt Quick, QPainter's OpenGL backend, and any @@ -277,7 +279,7 @@ \value AA_DisableWindowContextHelpButton Disables the WindowContextHelpButtonHint by default on Qt::Sheet and Qt::Dialog widgets. This hides the \gui ? button on Windows, which only makes sense if you use \l QWhatsThis functionality. - This value has been added in Qt 5.10. For Qt 6, WindowContextHelpButtonHint + This value was added in Qt 5.10. In Qt 6, WindowContextHelpButtonHint will not be set by default. The following values are deprecated or obsolete: @@ -2651,7 +2653,7 @@ but \b{must} not return an empty string unless the cursor is at the end of the document. \value ImEnterKeyType The Enter key type. \value ImAnchorRectangle The bounding rectangle of the selection anchor. - This value has been added in Qt 5.7. + This value was added in Qt 5.7. \value ImInputItemClipRectangle The actual exposed input item rectangle. Parts of the input item might be clipped. This value will take clipping into consideration and return the actual painted item rectangle. The rectangle is in widget coordinates. @@ -2779,7 +2781,7 @@ \value ItemNeverHasChildren The item never has child items. This is used for optimization purposes only. \value ItemIsUserTristate The user can cycle through three separate states. - This value has been added in Qt 5.5. + This value was added in Qt 5.5. Note that checkable items need to be given both a suitable set of flags and an initial state, indicating whether the item is checked or not. -- cgit v1.2.3 From 64a560d977a0a511ef541d6116d82e7b5c911a92 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 3 Aug 2018 17:55:11 -0700 Subject: QObject: do allow setProperty() to change the type of the property [ChangeLog][QtCore][QObject] Fixed a bug in setProperty() that caused a property change not to take effect if the old value compared equal using QVariant's equality operator, but the values were not strictly equal. Task-number: QTBUG-69744 Change-Id: I00e04a465fcf4fc1a462fffd1547885861a07a64 Reviewed-by: Simon Hausmann Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/corelib/kernel/qobject.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/corelib') diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 566f75a6c3..c6fe787e03 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -3898,7 +3898,8 @@ bool QObject::setProperty(const char *name, const QVariant &value) d->extraData->propertyNames.append(name); d->extraData->propertyValues.append(value); } else { - if (value == d->extraData->propertyValues.at(idx)) + if (value.userType() == d->extraData->propertyValues.at(idx).userType() + && value == d->extraData->propertyValues.at(idx)) return false; d->extraData->propertyValues[idx] = value; } -- cgit v1.2.3 From 5d1809be83c667fc72f58b84d95fbe3e37451350 Mon Sep 17 00:00:00 2001 From: Andre Hartmann Date: Sun, 5 Aug 2018 14:12:37 +0200 Subject: QString: Fix documentation for toDouble() and toFloat() The character 'g' is only a valid format when converting numbers to strings, but not other way round. Change-Id: Ie772886e7a45a5067c0a3e4eaa3a6ccef8e69426 Reviewed-by: Martin Smith --- src/corelib/tools/qstring.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index bb5a1cf852..82a065efc0 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -7177,7 +7177,7 @@ ushort QString::toUShort(bool *ok, int base) const \snippet qstring/main.cpp 66 \warning The QString content may only contain valid numerical characters - which includes the plus/minus sign, the characters g and e used in scientific + which includes the plus/minus sign, the character e used in scientific notation, and the decimal point. Including the unit or additional characters leads to a conversion error. @@ -7213,7 +7213,7 @@ double QString::toDouble(bool *ok) const to \c false, and success by setting *\a{ok} to \c true. \warning The QString content may only contain valid numerical characters - which includes the plus/minus sign, the characters g and e used in scientific + which includes the plus/minus sign, the character e used in scientific notation, and the decimal point. Including the unit or additional characters leads to a conversion error. -- cgit v1.2.3