Cleanup QtWidgets tools examples:
- use member-init (clang-tidy)
- fix includes/don't include QtWidgets globally
- include own header first
- use nullptr (clang-tidy)
- avoid c-style casts
- use QVector instead QList
- use QItemDelegate instead QStyledItemDelegate
Change-Id: Ibe9440cdf711e5cc2138c054864edebe1fc95731
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
QFileSystemWatcher has open bugs, so users should be able to help
troubleshoot.
Change-Id: I6b703e25f294944469d20fd36012b6a55133732a
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
src/corelib/global/qnamespace.qdoc:3279: (qdoc) warning: Can't link to 'QGuiApplication::setHighDdpiScaleFactorRoundingPolicy()'
src/corelib/time/qislamiccivilcalendar.cpp:49: (qdoc) warning: Can't link to 'QJijriCalendar'
src/network/ssl/qsslsocket.cpp:1510: (qdoc) warning: Can't link to 'QSslConfiguration::defaultCaCertificates()'
src/network/access/qhttp2configuration.cpp:49: (qdoc) warning: '\brief' statement does not end with a full stop.
src/gui/text/qtextformat.cpp:532: (qdoc) warning: Undocumented enum item 'TableBorderCollapse' in QTextFormat::Property
src/gui/text/qtextdocument.cpp:2066: (qdoc) warning: Undocumented enum item 'UnknownResource' in QTextDocument::ResourceType
src/gui/kernel/qguiapplication.cpp:3500: (qdoc) warning: Undocumented parameter 'policy' in QGuiApplication::setHighDpiScaleFactorRoundingPolicy()
Change-Id: I3573ef98cf9b58d16525c356270fe009fdffcf45
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Cleanup QTableWidget autotest:
- use range-based for loops where possible
- use nullptr
- use member initialization
- use new signal/slot syntax
- remove a lot of C-style casts
- use static invocations
- use override
- instantiate objects on stack instead of heap to avoid memleaks
Change-Id: I99ed144caab88d648d5ab987ce0963fbc6f1197d
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
QSharedPointer is made for passing around by value. It is unclear why
in so many repeated cases a QSharedPointer is created on the stack,
then a copy of it is new'ed up, passed into a lambda to be deleted
inside it.
First, it requires an additional heap allocation. Because it's passed
as a raw pointer to QSharedPointer, however, there's also always the
danger that it's leaked by seemingly-innocuous changes such as adding
an early return from the lambda (and some of them could really use
one, with the ifs nesting several levels deep).
All this is not needed, though. It's perfectly ok to store a copy of a
QSharedPointer, by value, in a lambda, and keep one copy outside
it. Poor man's std::future, if you will.
So, do away with all that, just pass the shared pointer by value into
the lambda, and, as a drive-by, replace some ephemeral QLists with
QVLAs. In one case, replace a QPair<int, int> with a struct to make
the code using that type more accessible ('first' and 'second' are
really, really bad variable names if they, in fact, represent
'startOffset' and 'endOffset').
Also port directly to shared_ptr / make_shared. Saves one memory
allocation each, due to the co-allocation of payload and control
block, and even though there's QSharedPointer::create, which does
this, too, std::shared_ptr is simply much lighter on the use of
atomics (copying a QSP ups two ref counts, copying a std::shared_ptr
just one). Since these variables live behind the API boundary, there's
no reason not to prefer the more efficient alternative.
Change-Id: I4b9fe30e56df5106fc2ab7a0b55b2b8316cca5fe
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
The volume names displayed did not match those of Windows
Explorer; for example "New Volume (X:)" would be displayed for
mapped network drives.
Replace GetVolumeInformation() and manual formatting by the
normal display name of IShellItem.
Fixes: QTBUG-78043
Change-Id: Ia742b7733e8ddc31e9506f15d90d065b985a111d
Reviewed-by: André de la Rocha <andre.rocha@qt.io>
Since b3fc5e1ea3,
topData()->initialScreenIndex has always been short-lived: it only
remembers the screen in case the widget parent is a QDesktopScreenWidget
(gotten from QDesktopWidget::screen()), only until the window is
created. Then it is reset. In the case of exec() we need to avoid
calling setScreen() twice, because that would set the screen once, then
forget which screen it was supposed to be on, then set the screen again
when exec() calls popup(). This is achieved by using the stored
eventLoop pointer to detect that popup() is being called from exec(),
and avoid calling setScreen() a second time in popup(), because exec()
already needed to call createWinId() before it created the event loop.
Amends 82da8306bc
Task-number: QTBUG-76162
Change-Id: I70da517b9d530630e59d103cb2a1ce11c897b2c8
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Joni Poikelin <joni.poikelin@qt.io>
commit 900f2cb6f7 removed this from the condition, which breaks the
(common) case of having QT_AUTO_SCREEN_SCALE_FACTOR=0 and
QT_SCREEN_SCALE_FACTORS set. This used to obey the screen scale factors,
so it should still do so (despite the deprecation warning).
This is what the Plasma `kcmshell5 kscreen` module actually sets (via
startkde).
Change-Id: I5f4efed11b937498049ebf1b107954721cf54147
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
The documentation for textHighlighted/textActivated was not added within
bdf1c4f671 so add it now.
Change-Id: Ifa7ad72af4490d4ce1d6de00d0963c0e76013f42
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Now that Qt Quick's batch renderer misses one level of shader source
caching due to the nature of pipeline state objects, it can be useful
to keep and reuse shader objects when the hash of the source code
matches.
The goal here is to allow Qt Quick to be on par with what the direct
OpenGL path has when it comes to caching shader sources and compilation
results. The program binary disk cache is not in scope in this patch.
Also adds QRhi::releaseCachedResources(), similarly to what the scenegraph
has. This can be called to clear caches such as the shader object
cache we keep here.
Change-Id: Ie3d81d823f61fa65ec814439e882c498f7774d43
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
BT.2020 is an HDR color space and its luminance range doesn't match
that of the rest of the currently available color spaces. Without
support for white-point luminance in 5.14, there would be a behavior
change when luminance support is later introduced, so it is better to
remove it now, and reintroduce it when the necessary handling of
different luminance levels is available.
Change-Id: Ie29e4dd757faae3ac91d4252e1206acce42801dc
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
QList<QRect> is horribly inefficient™. Since the container only lives
for the duration of the function call, use QVLA instead.
Change-Id: I2d179caef37bb78efface5547ff8bfcdc8f9a6ac
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
[ChangeLog][QtCore] Qt installations on the host system can now be
relocated, i.e. moved to other directories.
Add a new feature 'relocatable' that's by default enabled for
non-static builds
- on platforms where libdl is available,
- on macOS when configured with -framework,
- on Windows.
If the feature is enabled, the directory where plugins, translations
and other assets are loaded from is determined by the location of
libQt5Core.so and the lib dir (bin dir on Windows) relative to the
prefix.
For static builds, the feature 'relocatable' is off by default. It can
be turned on manually by passing -feature-relocatable to configure. In
that case, QLibraryInfo::location(QLibraryInfo::TranslationsPaths) and
friends will return paths rooted in the user application's directory.
The installed and relocated qmake determines properties like
QT_INSTALL_PREFIX and QT_HOST_PREFIX from the location of the qmake
executable and the host bin dir relative to the host prefix. This is
now always done, independent of the 'relocatable' feature.
Note that qmake is currently only relocatable within an environment
that has the same layout as the original build machine due to absolute
paths to the original prefix in .prl, .pc and .la files.
This will be addressed in a separate patch.
Task-number: QTBUG-15234
Change-Id: I7319e2856d8fe17f277082d71216442f52580633
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
When Qt was configured with -libdir different from "lib", one could not
build with CMake whenever a static lib was pulled in (e.g. uitools).
Do not hard-code "/lib" but use the correct variable also for static
libraries.
Fixes: QTBUG-76255
Change-Id: I28c6861752e29e461247628d2b1f8a9ec32f0790
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Fabian Vogt <fabian@ritter-vogt.de>
Instead of assuming they do not (like in >= 5.12.3) or they do (like
in < 5.12.3). QOpenGLWidget and QQuickWidget will likely want the
opposite. So allow specifying this with a QPlatformTextureList flag,
similarly to how we do it for sRGB for QOpenGLWidget.
Task-number: QTBUG-77471
Change-Id: I594ca919c8eca190fa70c6aa84f46f456fcd80e1
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
When running with the threaded render loop of Qt Quick, it could be that
the drawable changes size while the render thread prepares the command
buffer with setViewport and setScissor. Those have no chance to see
such changes, which is normally not a big problem because the resize will
get processed eventually.
However, in debug builds running in XCode, Metal validation checks the
viewport and scissor rects against the (more or less) actual drawable
size, and so would abort Qt Quick apps from time to time when resizing
the window interactively. To solve this, we just query the drawable size
in setViewport/setScissor to keep validation happy.
Change-Id: I451f398bd1f88e3f49ea4624fc45bbb4b70e7f07
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
This was accidentally introduced by
2f33e030b8 and since manual tests are not
built by default, was not discovered earlier.
Change-Id: I5cb6d5cfe0911bdb01a33014f2648a47b7a48848
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
While working with HTTP/2, we are not re-sending failed requests.
In case we receive a GOAWAY frame, we properly handle it by
processing some active streams if possible, and aborting streams
that will not proceed further with ContentResendError. But it's
possible that some server failed to send us GOAWAY (for example,
it died) or closed the connection not finishing the streams that
were still active and valid (ID <= value from GOAWAY frame).
Now that we will not re-connect, there is no reason to be quiet
about us not progressing - emit RemoteHostClosedError on any
remaining active stream/request we cannot process further.
Fixes: QTBUG-77852
Change-Id: I4cd68a1c8c103b1fbe36c20a1cc406ab2e20dd12
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 543769666f)
QShortcut::event() did not call the base class implementation
QObject::event() which caused that e.g. QEvent::DeferredDelete was not
handled.
Fix it by calling QObject::event() when the event was not handled.
Fixes: QTBUG-66809
Change-Id: Ideebc980bc658f8f2b9ec4417e738bccda5eeab5
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
While working with HTTP/2, we are not re-sending failed requests.
In case we receive a GOAWAY frame, we properly handle it by
processing some active streams if possible, and aborting streams
that will not proceed further with ContentResendError. But it's
possible that some server failed to send us GOAWAY (for example,
it died) or closed the connection not finishing the streams that
were still active and valid (ID <= value from GOAWAY frame).
Now that we will not re-connect, there is no reason to be quiet
about us not progressing - emit RemoteHostClosedError on any
remaining active stream/request we cannot process further.
Fixes: QTBUG-77852
Change-Id: I4cd68a1c8c103b1fbe36c20a1cc406ab2e20dd12
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
I realized this is a potential scenario where we will have leftover
data, but it wasn't covered.
Change-Id: Ibaf1015bf2aee120e4a4d98888925b88ecb6ddfd
Reviewed-by: Jesus Fernandez <jsfdez@gmail.com>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
And let the meat of the function be shared with the rbSwap routine.
Change-Id: I0ea18b30c26ff050c17dcb3ad4d654bfbb8c6221
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
- use std::make_shared instead of QSharedPointer
- two memory allocations saved
- co-locate semaphore and HRESULT object in a single State object
- one more memory allocation saved
- pass the shared_ptr<State> by value into the runnable
- two more memory allocations saved
Not only is the new code much faster, it's also much more readable.
Also use QSemaphoreReleaser, just in case the delegate should throw.
Change-Id: Ib99b9da86984d440d10b72e3071aa88099e24a1f
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Cleanup GraphicsView examples with the help of clang-tidy
- modernize-use-nullptr
- modernize-use-default-member-init
- modernize-use-override.IgnoreDestructors
- Some QList -> QVector changes
- use nullptr
- use normalized includes, remove unused includes
- fix style
Change-Id: I79347e55bfde52f6ae7749cc7093fbd442044020
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
The enum OptimizationFlag::DontClipPainter is deprecated and not used in
the code since Qt4 times. Therefore also mark it as deprecated so it can
be removed with Qt6
Change-Id: I318a55cf42e7a233d13d4ec0144e1977251f5c92
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
These topics were added to Qt Creator Manual 4.9 and 4.10.
Change-Id: I2e9bf355eb78b5e9877d0ca0bc41de00ed2b4333
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
The minimum supported version is Windows 7. Remove
QOperatingSystemVersion::WindowsVista added by
b0cd007335 and replace with "true"
wherever it was used.
Change-Id: I08c0208467b655a921b6773f77d8bc099be69031
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Solves a few recursion problems in Qt, since then we won't try to
inspect the logging registry while creating the logging registry.
Fixes: QTBUG-78007
Change-Id: I44cc9ee732f54d2380bafffd15c0f51c7140682e
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Words should not be abbreviated.
Split a long line and reflowed some comments in the process.
Fixes: QTBUG-78008
Change-Id: I52d75409f02e2cecbed3e94d424617ad594c275b
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
I see no good reason why the NaN returned when reading "nan" as a
double should be a signaling one; a quiet one should be just fine.
[ChangeLog][QtCore][QLocale] The NaN obtained when reading "nan" as a
floating-point value is now quiet rather than signaling.
[ChangeLog][QtCore][QTextStream] The NaN obtained when reading "nan"
as a floating-point value is now quiet rather than signaling.
Change-Id: Ife477a30bfb813c611b13a33c38ea82f9e8a93eb
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Instead of four pairs of :1 :15 bit fields, use an array of four :1,
:15 structs. This allows to replace the case folding traits classes
with a simple enum that indexes into said array.
I don't know what the WASM #ifdef'ed code is supposed to effect (a :0
bit-field is only useful to separate adjacent bit-field into separate
memory locations for multi-threading), but I thought it safer to leave
it in, and that means the array must be a 64-bit block of its own, so
I had to move two fields around.
Saves ~4.5KiB in text size on optimized GCC 10 LTO Linux AMD64 builds.
Change-Id: Ib52cd7706342d5227b50b57545d073829c45da9a
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Spell it out, or entirely remove it if it's not necessary.
Change-Id: Idc371427e9351d948245ce7b719e3457dfc27845
Reviewed-by: Matthew Woehlke <mwoehlke.floss@gmail.com>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Besides reducing duplicate code, this also improves the checks by
sharing optimized checks:
1. Fast memrotate will now also trigger with compatible formats (RGB32
over ARGB32)
2. Fast blitting will now also trigger with smooth transforms enabled,
if the coordinates are pixel aligned.
Change-Id: I576ebb34646d62ed472b1e1772e1b876b8121634
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
I was observing rare crashes on my mac, where I was using SecureTransport.
This would imply both the client (the test) and the server were working
in h2c mode. But this is against the test's logic - the first request
will be HTTP/1.1 (and upgrading protocol) and I wanted to send 3 HTTP/2
requests instead.
Fixes: QTBUG-77476
Change-Id: I048ca242e2096ca36dd112277807d1fee530150c
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Change the lancelot baseline test runner to use generic text files for
host info data collection. This also avoids relying on QProcess and
scraping the bash scripts output from stdout.
Fixes: QTBUG-71836
Change-Id: I88a46c99dbb11f71afc18cae5a6d2fbebcbe76c5
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>