QFontMetrics(F)::width() has been deprecated and is replaced by
horizontalAdvance(). This updates all usage of it in tests and
documentation.
It is worth noting that many or most of the usages of
QFontMetrics::width() probably intended to use boundingRect().width(),
but since it currently works, I have not looked into that, just
replaced the function name mechanically.
Change-Id: Iec382e5bad0b50f37a6cfff841bfb46ed4d4555f
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Also drops a few instances where the dependency was purely runtime,
especially for examples.
Change-Id: I2a0476f79928143596bdb3b8f01193af90574ae8
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
The vast majority is actually switched to QRandomGenerator::bounded(),
which gives a mostly uniform distribution over the [0, bound)
range. There are very few floating point cases left, as many of those
that did use floating point did not need to, after all. (I did leave
some that were too ugly for me to understand)
This commit also found a couple of calls to rand() instead of qrand().
This commit does not include changes to SSL code that continues to use
qrand() (job for someone else):
src/network/ssl/qsslkey_qt.cpp
src/network/ssl/qsslsocket_mac.cpp
tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp
Change-Id: Icd0e0d4b27cb4e5eb892fffd14b5285d43f4afbf
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
The qWaitFor functions themselves can not trigger a test failure, as that
will not result in the test function exiting early, so every single call
to qWaitFor needs to be wrapped in a QVERIFY.
Change-Id: Id15a1549f31d06cdbf788e1d84ea431c28636ec8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Commit 12c5264d9a fixed the calculation of
SHA-3 in QCryptographicHash: we were previously calculating Keccak.
Unfortunately, turns out that replacing the algorithm wasn't the best
idea: there are people who need to compare with the result obtained from
a previous version of Qt and stored somewhere. This commit restores the
enum values 7 through 10 to mean Keccak and moves SHA-3 to 12 through
15. The "Sha3_nnn" enums will switch between the two according to the
QT_SHA3_KECCAK_COMPAT macro.
[ChangeLog][Important Behavior Changes] This version of Qt restores
compatibility with pre-5.9.0 calculation of QCryptographicHash
algorithms that were labelled "Sha3_nnn": that is, applications compiled
with old versions of Qt will continue using the Keccak algorithm.
Applications recompiled with this version will use SHA-3, unless
QT_SHA3_KECCAK_COMPAT is #define'd prior to #include
<QCryptographicHash>.
[ChangeLog][Binary Compatibility Note] This version of Qt changes the
values assigned to enumerations QCryptographicHash::Sha3_nnn.
Applications compiled with this version and using those enumerations
will not work with Qt 5.9.0 and 5.9.1, unless QT_SHA3_KECCAK_COMPAT is
defined.
Task-number: QTBUG-62025
Discussed-at: http://lists.qt-project.org/pipermail/development/2017-September/030818.html
Change-Id: I6e1fe42ae4b742a7b811fffd14e418fc04f096c3
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Remaining uses of Q_NULLPTR are in:
src/corelib/global/qcompilerdetection.h
(definition and documentation of Q_NULLPTR)
tests/manual/qcursor/qcursorhighdpi/main.cpp
(a test executable compilable both under Qt4 and Qt5)
Change-Id: If6b074d91486e9b784138f4514f5c6d072acda9a
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Remaining uses of Q_DECL_OVERRIDE are in:
src/corelib/global/qcompilerdetection.h
src/corelib/global/qglobal.cpp
doc/global/qt-cpp-defines.qdocconf
(definition and documentation of Q_DECL_OVERRIDE)
tests/manual/qcursor/qcursorhighdpi/main.cpp
(a test executable compilable both under Qt4 and Qt5)
Change-Id: Ib9b05d829add69e98a86238274b6a1fcb19b49ba
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Conflicts:
examples/examples.pro
qmake/library/qmakebuiltins.cpp
src/corelib/global/qglobal.cpp
Re-apply b525ec2 to qrandom.cpp(code movement in 030782e)
src/corelib/global/qnamespace.qdoc
src/corelib/global/qrandom.cpp
src/gui/kernel/qwindow.cpp
Re-apply a3d59c7 to QWindowPrivate::setVisible() (code movement in d7a9e08)
src/network/ssl/qsslkey_openssl.cpp
src/plugins/platforms/android/androidjniinput.cpp
src/plugins/platforms/xcb/qxcbconnection.cpp
src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
src/widgets/widgets/qmenu.cpp
tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp
Change-Id: If7ab427804408877a93cbe02079fca58e568bfd3
This was added in c6612de3 for WEC7 which we do not support anymore.
Change-Id: I329374bb8375d629a6f7619236371c0fc953792d
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Especially in examples, where we should show off our convenience
functions, prefer calling these functions over doing arithmetic with
M_PI (or approximations thereto) and 180 (give or take simple
factors). This incidentally documents what's going on, just by the
name of the function used (and reveals at least one place where
variables were misnamed; the return from atan is in radians, *not*
degrees).
Task-number: QTBUG-58083
Change-Id: I6e5d66721cafab423378f970af525400423e971e
Reviewed-by: Jüri Valdmann <juri.valdmann@qt.io>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
... as it has outlived its original purpose:
Qt3 implementation on X11:
void QApplication::flush() { flushX(); }
void QApplication::flushX() { if (appDpy) XFlush( appDpy ); }
Qt4 implementation on X11:
Did nothing when QApplication::flush() was called (the flush()
overrides in {unix,glib} event dispatchers with empty bodies).
In Qt5 this function somehow has been repurposed (inconsistently)
to do what QCoreApplication::sendPostedEvents already does:
QAbstractEventDispatcher::flush() = 0;
=> QCocoaEventDispatcher::flush() {}
=> QEventDispatcherCoreFoundation::flush() {}
=> QIOSEventDispatcher (does not override ::flush())
=> QEventDispatcherGlib::flush() {}
=> QPAEventDispatcherGlib (does not override ::flush())
=> QEventDispatcherUNIX::flush() {}
=> QUnixEventDispatcherQPA (when QT_NO_GLIB=true)
::flush() { if (qApp) qApp->sendPostedEvents(); })
==> QAndroidEventDispatcher (does not override ::flush())
=> QEventDispatcherWin32::flush() {}
=> QOffscreenEventDispatcher::flush() {
if (qApp) qApp->sendPostedEvents();
QEventDispatcherWin32::flush();
}
=> QWindowsGuiEventDispatcher (does not override ::flush())
=> QWindowsDirect2DEventDispatcher (does not override ::flush())
=> QEventDispatcherWinRT::flush() {}
=> QOffscreenEventDispatcher::flush() {
if (qApp) qApp->sendPostedEvents();
QEventDispatcherWinRT::flush();
}
=> QWinRTEventDispatcher (qminimaleglintegration.cpp) (does not override ::flush())
=> QWinRTEventDispatcher (qwinrteventdispatcher.h) (does not override ::flush())
Whatever this function was doing on macOS in Qt3 and Qt4 also has been
dropped in Qt5. It appears that the other event dispatchers in Qt5 that
have overrides for flush() have simply copy-pasted this logic.
Clearly the documentation of QCoreApplication::flush() is outdated and
has nothing to do with the actual implementation in Qt5.
This function is rarely used in Qt5 sources. It should be safe to remove
the calls to QCoreApplication::flush() from Qt source code, as this
function has been doing nothing on most platforms anyways. Repurposing
it even broke handling of posted events (see QTBUG-48717).
[ChangeLog][QtCore][Event loop] QCoreApplication::flush() is now
deprecated. Use QCoreApplication::processEvents() and
QCoreApplication::sendPostedEvents() instead.
Task-number: QTBUG-33489
Task-number: QTBUG-48717
Change-Id: Icc7347ff203024b7153ea74be6bf527dd07ce821
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Gunnar Sletta <gunnar@crimson.no>
Replace all QT_NO_PROCESS with QT_CONFIG(process), define it in
qconfig-bootstrapped.h, add QT_REQUIRE_CONFIG(process) to the qprocess
headers, exclude the sources from compilation when switched off, guard
header inclusions in places where compilation without QProcess seems
supported, drop some unused includes, and fix some tests that were
apparently designed to work with QT_NO_PROCESS but failed to.
Change-Id: Ieceea2504dea6fdf43b81c7c6b65c547b01b9714
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Since 5.7, QIODevice::peek() implementation is based on transaction
mechanism. While technically it's correct, seeking backward on a
buffered random-access device clears the internal buffer that affects
the performance of reading.
To solve the problem, this patch implements peek mode directly inside
the reading procedure.
Task-number: QTBUG-56032
Change-Id: Ic5269f76e44c491a0309e13aba87fa7cf7b9259f
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
benchmarktests.h:323:18: warning: field 'm_as_pixmap' is uninitialized when used here [-Wuninitialized]
benchmarktests.h:371:18: warning: field 'm_as_pixmap' is uninitialized when used here [-Wuninitialized]
benchmarktests.h:417:18: warning: field 'm_as_pixmap' is uninitialized when used here [-Wuninitialized]
Change-Id: Ica496e3baa19e0701c64222ce8ab92ec94178db7
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
getMaximum() and getMinimum(), called during parsing, create new
QDateTime instances, which on Linux end up calling mktime().
Making these static (for the common case of LocalTime spec)
improves performance dramatically, when parsing several date/times.
tests/benchmarks/corelib/tools/qdatetime/ (after fixing it to
actually parse a valid date/time) says:
RESULT : tst_QDateTime::fromString():
- 36,742,060 instruction reads per iteration (total: 36,742,060, iterations: 1)
+ 24,230,060 instruction reads per iteration (total: 24,230,060, iterations: 1)
Change-Id: I0c3931285475bf19a5be8cba1486ed07cbf5e134
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Commit c5db8fc74 changed all instances of Q_WS_FOO to have the prefix
Q_DEAD_CODE_FROM_QT4 instead, to make it clearer when reading the code
that the code in question was a left-over from Qt4, when we used
Q_WS_ defines instead of Q_OS_ defines.
This worked well for cases of #ifdef Q_DEAD_CODE_FROM_QT4, but less so
for cases of #ifndef Q_DEAD_CODE_FROM_QT4, where the code was actually
unconditionally included.
To make this even clearer, the defines have been replaced by checks for
1 or 0, with a comment describing how the code used to look in Qt4. The
use of constants in the check also makes it easier for editors to parse
the condition and show visually that the code is defined out.
Change-Id: I152070d87334df7259b417cd5e17d7b7950379b7
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Adds missing image-formats so it doesn't segfault.
Also changes the exclusion of rare formats to lists of included ones
Change-Id: I1d00562cf8e96baa03121a0b996764224911e06a
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
Move the different parts of configure.json/.pri into the libraries where
they belong.
Gui is not yet fully modularized, and contains many things related to
the different QPA plugins.
Done-with: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Change-Id: I6659bb29354ed1f36b95b8c69e7fce58f642053f
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Use the new qtConfig macro in all pro/pri files.
This required adding some feature entries, and adding
{private,public}Feature to every referenced already existing entry.
Change-Id: I164214dad1154df6ad84e86d99ed14994ef97cf4
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
this migrates the cases where the build system already made (some) use
of variables (possibly) set by configure.
Change-Id: I43a08caed481d5f887a3a40821e71a4797760e7e
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Before: HexRgb: 0.00230 ms per iteration, HexArgb: 0.00290 ms per iteration
After: HexRgb: 0.00051 ms per iteration, HexArgb: 0.00061 ms per iteration
This showed up as a relevant optimization when profiling KIconLoader
which uses QColor::name() as part of the key -- thanks to Mark Gaiser for
the investigation and first suggestion of a solution. I have also seen
customer code writing a replacement for QColor::name() because it was
too slow to be used as a hash key.
Change-Id: I009ccdd712ea0d869d466e2c9894e0cea58f0e68
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
This reverts commit 13040043b2.
It introduced a bad regression, noticeable for longer documents, as
it would cause the documentChanged(0, length) to trigger a layout of
the entire document.
The bug report for the commit (or the commit itself) does not contain
a test case, but it is regardless the wrong approach. Note that
QQuickTextEdit already listens to the contentsChange signal and
invalidates the changed parts of the document as a reaction to this,
so it should already work as expected.
[ChangeLog][Qt Gui][Text] Fixed performance hit from showing large
QTextDocuments in a QTextEdit or QTextBrowser. (Regression introduced
in Qt 5.3.0)
Task-number: QTBUG-51411
Change-Id: I6e7fbf8f62a1d68779eef5da3781de14d9fdcad8
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This proved to be quite slow in the past due to QReadWriteLock's implementation
being suboptimal (prior to its improvement in
343e5d066a).
This codepath is exercised quite extensively by QML with enum registrations.
Change-Id: I94d1e13933bf005604dc4494e2cb5bc25ef3d387
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
The first is "exact", not "more": qCalculateBlockSize. It ensures that
there's no overflow in multiplying, adding the header size or when
converting back to an int.
The second is the replacement for qAllocMore: it calculates the block
size like the first, but increases the block size to accommodate future
appends. The number of elements that fit in the block is also returned.
Task-number: QTBUG-41230
Change-Id: I52dd43c12685407bb9a6ffff13f5da09f816e667
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Basic optimization of conversion from indexed8.
Task-number: QTBUG-35747
Change-Id: Ic9d32789769eadb05fbecfebf2d2f2c87d66610b
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
This benchmark requires QtScript1 headers, and can not build as is.
Change-Id: I98e57ca2db82270a0887462d7959ff00e352166b
Reviewed-by: hjk <hjk@theqtcompany.com>
Most libs use QMAKE_LIBS/CFLAGS, but some have other naming
conventions. Unify them into using QMAKE_LIBS/CFLAGS.
Change-Id: I39b188adc1f9a223a83b294c5315c3095a9c68de
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Our handling of plugins when Qt is build statically is
nowadays good enough, so we don't need to build the
JPEG and GIF support directly into Qt for static builds.
Let's simply always build them as plugins.
Also simplify the logic in configure, and get rid of the
no-gif, no-jpeg and no-png config variables.
[ChangelLog][Build system] JPEG and GIF image support is now
always built as a plugin. Removed -imageformat-[jpeg|gif]
arguments to configure.
Change-Id: Ic01559ff406c966807b3be8761252e8802adcdf7
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Calling qMin often prevents effective vectorization, and it is only
necessary when converting from formats with mixed color-channel widths.
Change-Id: I2a0f3f3fb528d45be1fd025758f9d915ee1736c0
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
Using shuffle and align storing our quint24 format can be done much
faster. This in particular improves conversions to RGB888.
Change-Id: I179748706a33a43fd6f60f5c40287317418c8867
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
I wrote a script to help find the files, but I reviewed the
contributions manually to be sure I wasn't claiming copyright for search
& replace, adding Q_DECL_NOTHROW or adding "We mean it" headers.
Change-Id: I7a9e11d7b64a4cc78e24ffff142b506368fc8842
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>