C++11 deprecated 'register' as a storage specifier, and C++17 removes
it.
Fixes GCC 7.0 warning-turned-error:
nativepainting/qpixmap_x11.cpp:2013:25: error: ISO C++1z does not allow ‘register’ storage class specifier [-Werror=register]
Amends 07942adb77.
Change-Id: Ideb674d903e5e6eb5ae92cfc3979ff59b243520c
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
There's no reason to restrict the LHS and the RHS to the same type
like it was done before. That just leads to lots of casting. or use
of QVERIFY(. == .) instead of QCOMPARE, with all the disadvantages
like no printing of the LHS and RHS values.
The rationale given in the documentation for this behavior is
incorrect. Ensuring that RHS and LHS have the same type by no means
ensures that no implicit conversions take place when calling
operator==. Proof:
QCOMPARE(QLatin1Char('a'), QLatin1Char('a'));
// instantiates
qCompare<QLatin1Char, QLatin1Char>
// but calls
operator==(QChar, QChar)
If the intent is to disable implicit conversions of the argument
types, then some serious metaprogramming magic would be needed, along
the following lines:
1. find out which op== overload is actually chosen
2. find that overload's RHS parameter type, assert it's the same as
(possibly cv-qualified) T1.
3. ditto for the LHS parameter type and T2
This is not attempted here.
Fix the inconvenience this restriction caused by simply allowing
two types.
This cannot break existing code, since we didn't actually change
anything in the qCompare() overload set. All we do is implement the
existing qCompare<T1, T2>() overload.
[ChangeLog][QtTest] QCOMPARE can now be used for mixed-type
comparisons.
Change-Id: I0413dbd3689809852413eaca22827257f1527720
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
qtbase/src/corelib/tools/qbytearray.cpp:3043: warning: Can't link to '.'
qtbase/src/corelib/tools/qstring.cpp:4522: warning: Can't link to '.'
qtbase/src/corelib/tools/qstring.cpp:10331: warning: Can't link to '.'
qtbase/src/network/access/qhstspolicy.cpp:105: warning: Undocumented parameter 'flags' in QHstsPolicy::QHstsPolicy()
qtbase/src/network/access/qhstspolicy.cpp:105: warning: No such parameter 'includeSubDomains' in QHstsPolicy::QHstsPolicy()
qtbase/src/network/access/qnetworkaccessmanager.cpp:732: warning: Undocumented parameter 'knownHosts' in QNetworkAccessManager::addStrictTransportSecurityHosts()
qtbase/src/network/access/qnetworkreply.cpp:307: warning: Can't link to 'QNetworkRequest::UserVerifiedRedirectsPolicy'
qtbase/src/gui/painting/qpagedpaintdevice.cpp:246: warning: No such enum item 'PdfFormat_1_4' in QPagedPaintDevice::PdfVersion
qtbase/src/gui/painting/qpagedpaintdevice.cpp:246: warning: Undocumented enum item 'PdfVersion_1_4' in QPagedPaintDevice::PdfVersion
qtbase/src/gui/painting/qpagedpaintdevice.cpp:246: warning: Undocumented enum item 'PdfVersion_A1b' in QPagedPaintDevice::PdfVersion
qtbase/src/gui/painting/qpagedpaintdevice.cpp:246: warning: No such enum item 'PdfFormat_A1b' in QPagedPaintDevice::PdfVersion
qtbase/src/widgets/kernel/qopenglwidget.cpp:1076: warning: Undocumented parameter 'texFormat' in QOpenGLWidget::setTextureFormat()
qtbase/src/corelib/tools/qversionnumber.cpp:460: warning: Command '\snippet (//! [3-latin1-1])' failed at end of file 'qversionnumber/main.cpp'
Change-Id: Icc163dd8d94cee7e0858040bf8241a3c1f1d221d
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
C++ does not specify which kind of floating point implementation is
being used. The C Standard doesn't either, but it includes a normative
reference for implementations adoping it (ISO/IEC 9899:2011 Annex F).
There are a few existing checks in qfloat16.cpp; move them to qglobal.cpp
(next to the other, similar checks), and improve them by actually
checking that the radix used for floating point numbers is 2.
Change-Id: I704a3a8efeb51014b3be23fb236654d647a6f44f
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit revives the old native QPixmap and QPaintEngine
implementations that were present in Qt4. The backing store supports
regular raster windows in this commit. Support for render-to-texture
widgets and OpenGL compositing will be added in a follow-up commit.
Change-Id: I80a9c4f0c42a6f68f571dfee930d95000d5dd950
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Just like all QObject subclasses. Use a delegating constructor
call to share the code from the existing constructor.
Change-Id: Ia3c893ccc4c94883e61337f8952d80b665c17fbf
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
CSS style such as "line-height: 1.5;" should be used as a multiplier,
but Qt uses it as percentage which makes line spacing way too small. To
workaround this, convert it to percent and use as
QTextBlockFormat::ProportionalHeight instead.
[ChangeLog][QtGui][Important Behvior Changes] Changed CSS line-height
property with multiplier to follow CSS spec
Task-number: QTBUG-56848
Task-number: QTCREATORBUG-17683
Change-Id: Icc98f7c0d4d07542a220702c287f23fa450ef875
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Every bit pattern of a QStringView is a Partially-Formed Object, and
QStringViews are trivially copyable. That's what Q_PRIMITIVE_TYPE
means, even if the docs are still talking about valid instead of
partially-formed objects.
Change-Id: I79d4f79fbab0ec2608620e88b6593e26686af304
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Fixing qdoc warnings:
qtbase/src/gui/kernel/qstylehints.cpp:367: warning: Cannot find 'QStyleHints::showShortcutsInContextMenus' specified with '\property' in any header file
qtbase/src/gui/kernel/qstylehints.cpp:378: warning: No documentation for 'QStyleHints::showShortcutsInContextMenus()'
Amends change c2c3452ba5.
Task-number: QTBUG-49435
Change-Id: I2db52f013c0fc46c80a1200667c19d63a2c9c0c4
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
... instead of the combination with Q_OS_WIN we used so far.
This patch adapts ocurrences that are new in 5.10.
Change-Id: If392df481713e56c776c2326e0e02324a3a80c89
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Fixes a few ugly code pieces I added over the years.
Change-Id: I5c06b73e858add04ea184120c6df71720baf9be3
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
... to be compatible with the C++17 [[nodiscard]].
Change-Id: I60fb9b9077e8c59a03a212c73d4e6c814cc0357d
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
As for the formatting code, de-duplicate the parsing code by only
parsing char*s, converting QChars to Latin-1 first in a small buffer.
The QUuid(const char*) ctor performed no length checking, relying
instead on the checks performed within _q_uuidFromHex(), which
includes an implicit check for premature end (because NUL is not
a valid token for the parser).
The (QString) and (QByteArray) ctors did perform length checking.
To the extent possible, this is removed, since it is handled by
_q_uuidFromHex(). Failure cases need not be optimized. Only the
QLatin1String overload needs to do some checking, because views in
general are not NUL-terminated. The QStringView overload can just
append a NUL when it converts to Latin-1.
The only check I added to _q_uuidFromHex() is that for src ==
nullptr. It would otherwise be duplicated in several callers.
While touching the internal functions, port to passing and returning
by value.
Saves 1.6KiB in text size on optimized GCC 6.1 Linux AMD64 builds,
even though we added new API.
Port some users to the new functions. Expand fromString() test.
[ChangeLog][QtCore][QUuid] Added fromString(QStringView/QLatin1String).
Change-Id: I519339419129550c86e0ea80514865cd6a768f5d
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
8a375341cf added swap() to QJson* classes
and marked them shared-not-movable-until-qt6.
That unveiled a broken test in QVariant which was relying on QJsonDocument
being not relocatable. So fix the test by using a proper datatype for the task.
Change-Id: Ic35f09f936b00dfaeb368ccb42aecf35cc506029
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
8a375341cf added swap() to QJson* classes
and marked them shared-not-movable-until-qt6.
This change made QMetaType start reporting that QJson* classes were
movable; however, the test used QTypeInfo and not QTypeInfoQuery to
double check that information.
Port the test to QTypeInfoQuery.
Change-Id: I3227a70a8f24c0013257e180e9cb9cfebe9947f9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Since commit bf2160e72c, we can rely on
charNN_t support in all compilers except MSVC 2013, and since that
commit, we use (in 5.10, not 5.9, yet)
!defined(Q_OS_WIN) || defined(Q_COMPILER_UNICODE_STRINGS)
when we only need charNN_t, the type, as opposed to its library
support (u16string, char_traits<char16_t>, ...).
This patch splits the Q_C_UNICODE_STRINGS macro into two, adding
Q_STDLIB_UNICODE_STRINGS for when we need std::uNNstring, leaving
Q_C_UNICODE_STRINGS for when we need just charNN_t support.
In QDebug, when constructing a QChar out of a char16_t, cast to ushort
first, since QChar(char16_t) was only officially introduced in Qt 5.10.
[ChangeLog][Potentially Source-Incompatible Changes] The internal
Q_COMPILER_UNICODE_STRINGS macro is now defined if the compiler
supports charNN_t, even if the standard library does not. To check for
availability of std::uNNstring, use the new Q_STDLIB_UNICODE_STRINGS
macro.
Change-Id: I8f210fd7f1799fe21faf54506475a759b1f76a59
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
That's before the return type or static, inline, constexpr or such
keywords (if any).
Perl Script:
s/^(\s+)(.*) Q_REQUIRED_RESULT(;)?(\s*\/\/.*)?$/\1Q_REQUIRED_RESULT \2\3\4/
Change-Id: I7814054a102a407d876ffffd14b6a16182f159e2
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
They're not affected by the GCC bug noted in the comment.
Change-Id: I7814054a102a407d876ffffd14b69e8a8e2527f1
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Creating a precompiled header exclusively for a one- or two-file module
is wasteful. The time that it takes to build the precompiled source is
on the same order as a regular compilation, so enabling precompiled
headers for those modules just makes the build slower.
Also make it possible to override the precompiled header by just setting
PRECOMPILED_HEADER to empty.
Change-Id: I0e1a09998253489388abfffd14b5f221288c4826
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Let's not allow any new code that uses non-conforming syntaxes. With
GCC and like, we already use -std=c++11 instead of -std=gnu++11 for that
very reason.
Change-Id: I4a7dc1fe14154695b968fffd14aba9f8cea69c47
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Do not use a self-assignment, as that may trigger compiler warnings.
Casting to void is also what Q_UNUSED is doing these days, but we can't
use it here because qgrayraster.c does not include qglobal.h.
Remove a 15-years old comment related to the self assignment.
Found by clazy.
Change-Id: I8cc92b7a1b0b5fb13824959740243e17606ec753
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This reverts commit 47cc9e23a3.
We use QCoreApplication::applicationDirPath in the logging initialization to find
a possible qtlogging.ini file. Because QCoreApplication::applicationDirPath requires
a QCoreApplication instance this leads to a qWarning, which in turn leads to a
recursive call to the logging initialization, and in turn to a recursive mutex deadlock.
Task-number: QTCREATORBUG-18031
Change-Id: Ic75e1e8c062eb647991725378489bf87c9648cca
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Commit 288bfb0bbd added a test that uses QLineEditIconButton, which
requires QT_BUILD_INTERNAL to be defined in order for the findChild()
call to work as expected.
Change-Id: Ieda18f4e26a91322e8a83c14f8d1fbbe4313ecf0
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Delete the QGraphicsEffect from the QWidget destructor instead of from
the QWidgetPrivate destructor. The destructor of QGraphicsEffect still
access methods of the QWidget, but the QObjectPrivate being destroyed
from ~QObject, the pointer is no longer a QWidget.
Fix warning with UB sanitizer in tst_QWidget::setGraphicsEffect
qwidget_p.h:900:23: runtime error: member call on address 0x000001d822c0 which does not point to an object of type 'QWidget'
0x000001d822c0: note: object is of type 'QObject'
00 00 00 00 b0 46 5f 40 e5 7f 00 00 00 23 d8 01 00 00 00 00 f0 e6 00 44 e5 7f 00 00 00 00 74 47
^~~~~~~~~~~~~~~~~~~~~~~
vptr for 'QObject'
#0 0x7fe54767db76 in QWidgetEffectSourcePrivate::detach()
#1 0x7fe548f29815 in QGraphicsEffect::~QGraphicsEffect()
#2 0x7fe548f2a1b7 in QGraphicsBlurEffect::~QGraphicsBlurEffect()
#3 0x7fe548f2a208 in QGraphicsBlurEffect::~QGraphicsBlurEffect()
#4 0x7fe5475cd463 in QWidgetPrivate::~QWidgetPrivate()
#5 0x7fe5475ce62c in QWidgetPrivate::~QWidgetPrivate()
#6 0x7fe5400d0dda in QObject::~QObject()
#7 0x7fe54763d411 in QWidget::~QWidget()
#8 0x7fe54763d7f4 in QWidget::~QWidget()
#9 0x4cc309 in QScopedPointerDeleter<QWidget>::cleanup(QWidget*)
#10 0x4cc309 in QScopedPointer<QWidget, QScopedPointerDeleter<QWidget> >::reset(QWidget*)
#11 0x4cc309 in tst_QWidget::setGraphicsEffect()
Change-Id: I19c049e979cfce2adda908af8336cb4adac8f6c4
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
We can't just static_cast a child to QLayout, because the child might
not be a QLayout, and even if it was, we might be called from the
QObject destructor so we would not be a layout anymore.
Instead we can just qobject_cast the deleted object to a QLayout and
remove it from the layout with removeItem.
This would not take in account the case where we would be called because
the QLayout gets destroyed, so we handle this case from ~QLayout by
removing ourself from the parent.
Note that the comment in ~QLayout was wrong, as the layout gets destroyed
explicitly from ~QWidget, not from ~QObject.
Change-Id: I49c6f17a76f207b9d750b6e5d987469498b96b31
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
We don't need to defer to NSWindow creation before determining the initial
window geometry, and we don't need to redetermine each time we re-create
an NSWindow for a QCocoaWindow.
Change-Id: Ie13380830b44e96670ff16513f29deef5f5ae313
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
De-duplicate the QString/Ref code paths by using QStringView instead.
Keep the old overloads so we can centrally apply the qToStringView-
IgnoringNull() optimization.
Replace insert(p, ..) where p = size() with append(..). The code
ensures in the lines before that the insertion position is the end of
the string.
Port the few QLatin1String arguments to addToStringStorage() to
QStringViewLiteral. I also considered adding a QLatin1String()
overload, but the test size increased, so the function wasn't pulling
its own weight.
This version saves 360B in text size on optimized GCC 6.1 Linux AMD64
builds.
Change-Id: I4b759fddc38b1f97a7218954e756cc19400922e9
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Saves just over ¼KiB in QtCore text size on optimized GCC 6.1 Linux
AMD64 builds, iow: qToStringViewIgnoringNull() saves ~40B per use.
Change-Id: I3278306d5ce594e8ccd0f58b8f8d0319637d1b2b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
As long as a null QString still returns non-null data(), QStringView's
QString constructor needs to call isNull(). That's a branch we often
can do without, so add an internal function that bypasses this
correctness check.
It's internal, since we might have a Q6String that returns nullptr
data() when null, which will remove the need for this function.
What the QStringView(QString) ctor does will also have to be
re-evaluated come Qt 6, but for now, keep the public QString-
QStringView conversion correct.
Change-Id: I35dc7383bc3bd018f46aeec429185135a38ddcef
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
qimage.cpp:2127: warning: Can't link to 'isDetached()'
qmatrix4x4.cpp:1933: warning: Can't link to 'operator()()'
Change-Id: I93a2ead9650faf139040173f8d3b24cfa1e730ae
Reviewed-by: Martin Smith <martin.smith@qt.io>
The code was duplicated for QChar and char characters. Keep only the
char version, and use QString::fromLatin1() to convert to QString.
This does not perform more allocations. It just copies 38 bytes more
than before.
Saves 788B in text size on optimized GCC 6.1 Linux AMD64 builds.
Change-Id: I1a65c8128eb2097e11527961618d54ea362e1b80
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
CoreWindow::GetAsyncKeyState returns flags and not enums so checking
equality does not give the needed result.
As seen in qwindowskeymapper.cpp key events that only contain a modifier
key should not have the key itself as a modifier when calling
handleExtendedKeyEvent.
With the current approach the modifier states are the same as
on desktop Windows.
Task-number: QTBUG-58750
Change-Id: Ie0f3e1d3e8294e1a6b41c9223a7a5153306579f6
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
CorePhysicalKeyStatus::KeyStatus does not give the information we are
after so we have to keep track of "auto repeat" state of the keys
ourself.
Task-number: QTBUG-59232
Change-Id: I22aa185780e5fa1f7f3c23c2deb2a0dde0c4a582
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
Fixes two separate errors. QImage::transform was incorrectly adding
colors to the color-table of the returned image when the converted image
would not be indexed, and qpnghandler was looking at non-empty color-
table instead of color format.
Task-number: QTBUG-43708
Change-Id: Ife14b6428ca65ac7d3a0b36a89a73e56d64586b4
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
This patch updates the Windows QPA backend code to use QRegularExpression
in place of the deprecated QRegExp.
Change-Id: Ib45c374578bed5b9f2771df1ca04cc09cab6e7c9
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
QLineEditIconButton currently draws a fully transparent pixmap in its
paintEvent() function, when the line edit is empty. This does not work
when there is another trailing QAction that is visible even when the
line edit has no text, as reported in QTBUG-59957.
To fix this issue, make sure the clear button is always the leftmost
button.
Task-number: QTBUG-59957
Change-Id: I8a4f96aae07856aa0e1053ebb338ba9bdf052a16
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
A signal emitted after the first 'isOpen' check on QNetworkReply can
trigger a slot that aborts/closes our reply. So before we can append
any data to reply's buffer, we have to re-check that we're still open.
Task-number: QTBUG-59909
Change-Id: I781d5a4fd5fc30d485af63f45cf36c254378af64
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Alex Trotsenko <alex1973tr@gmail.com>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Mark QPlatformGraphicsBuffer and QSystemTrayIcon as internal.
Change-Id: I39e5b4f635fca21ab0544cd840a113514b6b1e99
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Now we have a swap() member, remove the comment.
Amends bbb440bab2.
Change-Id: I3640d544bbd0927109460d843252c8e5f0aefaf5
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Re-add the move operations, add a swap(), mark as shared
(we're already using them in containers).
QJsonValue is slightly tricky, because it has an anonymous union,
which can't be easily moved in C++. Use the implementation of
the copy constructor as inspiration for the move.
[ChangeLog][QtCore][JSON] QJsonArray, QJsonDocument, QJsonObject
and QJsonValue now have move operations and a swap() member function.
Change-Id: Idfb94a93370ace96100efbd6559ef05b4c5adc39
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Allows categorized logging before QCoreApplication has been created,
which otherwise would silently fail to output anything because the
category would never be enabled, despite QT_LOGGING_RULES being set.
Change-Id: Ia733105c5b6f28e22af511ced5271e45782da12b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>