All users of the QPixmap ctor can pass rvalues, so take by rvalue-ref
and move into place. Adapt callers to actually pass rvalues.
Change-Id: Iacff2ed893ceaa1665b270ce466ffdc21ba800f1
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
QHostInfo isn't implicitly shared. The more important to optimize away
copies by providing a move constructor.
Port from QScopedPointer to Q_DECLARE_PRIVATE, as otherwise the move
ctor can't be inline, and we don't implement move ctors out-of-line in
Qt.
[ChangeLog][QtNetwork][QHostInfo] Added move contructor.
Change-Id: I6b63a04e36f63e299205830fdc590ff7e2af338b
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Applications might receive paths with Windows' '\\?\' markers, which
indicates a long path to Win32 APIs, when the application is opened by
explorer via file association. Qt not ignoring those markers will fail
to open such files.
By stripping the marker in QDir::fromNativeSeparators, QFile, QFileInfo
etc automatically are able to handle such paths. QDir::cleanPath is
also documented to normalize separators, so it needs to be done there
as well.
[ChangeLog][QtCore][QDir] Remove Windows specific long path markers
when handling file paths with native separators.
Change-Id: I526a890614edee8c85b39fc12c98e7ddb6e0d793
Fixes: QTBUG-75117
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This matches what translateDeadKey() returns for unhandled keys, and
processKeyboard() checks for when replacing qtKey with the result of
translateDeadKey().
Change-Id: I1500576b7b31047a7a35633a15cd6975b77d842d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Somehow I didn't test using QNetwork{Status,Connection}Monitor together
with Gui. In qwindowstheme.cpp we call CoInitialize and as such we
cannot use CoInitializeEx with a different thread mode.
Change-Id: If4a4441cc2616371d8b7cda72cfad11187d8f153
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Current codebases assume isCompressed() implies ZlibCompression, since
there was no compressionAlgorithm() getter. In order to force codebases
to change, deprecate isCompressed() and force handling of the algorithm.
The replacement API is being introduced in 5.14, which is why the
warning is being emitted in 5.15 only.
Change-Id: Ief874765cd7b43798de3fffd15a9f5d978951ea5
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Cache can't be null, since it's a member of an extant object.
Change-Id: Id98140e1c2f0426cabbefffd157ed3cdd62a8bba
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Windows has a problem relating to cross-DLL variable relocations: they
are not supported. Since QMetaObject's link to the parent class is done
via a pointer, every QMetaObject in a DLL or in the EXE that derives
from a class from another DLL (such as QObject) will be dynamically
initialized.
This commit changes the meta object pointers in QMetaObject::d from raw
pointers to a wrapper class SuperData, which is almost entirely source-
compatible with the pointer itself. On all systems except for Windows
with Qt 6, it's binary compatible with the current implementation.
But for Windows with Qt 6, this commit will store both the raw pointer
and a pointer to a function that returns the QMetaObject, with one of
them non-null only. For all meta objects constructed by moc, we store
the function pointer, which allows the staticMetaObject to be statically
intialized. For dynamic meta objects (QMetaObjectBuilder, QtDBus, QtQml,
ActiveQt), we'll store the actual raw pointer.
[ChangeLog][QtCore][QMetaObject] Some internal members of the
QMetaObject class have changed types. Those members are not public API
and thus should not cause source incompatibilities.
The macro QT_NO_DATA_RELOCATION existed in Qt 4 but was called
Q_NO_DATA_RELOCATION and only applied to Symbian. It was removed in
commit 24a72c4efa ("qglobal: Remove
symbian specific features").
Task-number: QTBUG-38876
Fixes: QTBUG-69963
Change-Id: Id92f4a61915b49ddaee6fffd14ae1cf615525e92
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
These were hidden in !QT_CONFIG(thread) code. The irony!
This patch does not change the semantics of the operations. It
just makes the implicit operations explicit.
Any fixes or optimizations are left for follow-up patches, if any.
Change-Id: I014eb71745532dae2efe7963aa87321f61b1bd7a
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
The mapping is static, but a dynamic (even mutable) container was
used.
Fix by using C tables and liner scan, which will be just as fast or
faster than a hash lookup, for the maximum of six entries of each
table.
Change-Id: I899d5b1428dc82cf58862f238595a266aef8279f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
Now that we can depend on C++11, use _WITH_ARGS and std::initializer_list.
Saves ~400B in text size on optimized AMD64 GCC 9.1 Linux LTO builds.
Change-Id: I37fce1c63a5f74f6dfc059febf0152ac93c8be7f
Reviewed-by: David Faure <david.faure@kdab.com>
The mutex is only protecting 'nameMap'. Proof: it's only defined on
platforms on which there is a 'nameMap'. Also, nothing else is
mutable, so no lazy init going on here.
So, drop all the mutex protection, except where we access 'nameMap',
and draw the mutex as close as possible to the nameMap uses, iow: copy
ctor, prepareName() and nameToString().
As a consequence, the old (Ordered)MutexLocker class only needs to be
defined on Unix.
Change-Id: Ic969313bc48ad7ebf24c5dca7fd48359956b048d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The code basically wants to get the last element of equal_range(id).
The problem is that backwards iteration on QHash is very expensive,
because it's implemented as forward search with wrap-around at bucket
end.
So it was implementing its own equal_range with look-ahead. The
problem is that it compared each key in the equal_range twice: once in
the if, and once more in the following while iteration.
I expect to see this kind of algorithm more as we move away from the
fake bidirectionalism of QHash, so I decided to implement it in a
generic way. We can copy it somewhere else when we find more users.
Change-Id: I7951652107ab897f6a456035f02e0339835e078d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
As in QVarLengthArray (c34242c679), this will
probably bite someone someday, so fix it before there's a bug report.
Use ctor delegation to keep code size increase small.
There's also the benefit that default-constructing a QNetworkRequest now
no longer creates an expensive QUrl object just to destroy it unused again.
Add an auto-test.
Change-Id: I5ceb5402ca3946048d695244d1b1c36564a1e80a
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Not visible in QMake, because of too old C++ standard used to compile it,
but in the qttools copy. Fix here, as the authorative source, first.
Change-Id: I2552eccfaab2cef0863686dcd888f2a5f25ca29f
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
QChar currently is convertible from nearly every integral type. This
is bad code hygiene and should be fixed come Qt 6.
The present patch is the result of compile fixes from marking these
constructors explicit.
Amends 60ca2f5f7c.
Change-Id: I06887104d42f8327eb6196afcde5f942a74a6a78
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
The first one is trivially correct: it clearly doesn't modify the
container under iteration.
The second is a bit more subtle, because drawWindow() could be
expected to call a paintEvent and this could theoretically lead to
lowering, closing, or opening of a window. But this function just ends
up blit()ting, so it doesn't call into user code.
Change-Id: Id15e0102e9c8aa12516af27d771104e9993c48a1
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
The content is static, so a dynamic container is overkill. Use a C array.
Don't make it static, as that creates more problems than is solves (static
initialization).
Change-Id: I07534c3336efbb6bbc19bfa1b8dad0c578d4e274
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
The qdoublescanprint_p.h header moved from tools/ to text/ when
text/ was introduced.
Amends a9aa206b7b.
Change-Id: Ia7167fc3c4cdb05d4f2e56c0a0427a80e3cee362
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Don't call realloc() with all its machinery when we know exactly what
to do: destroy the last element and decrease the size by one.
Extend the test, removing the unused Foo class for a new Tracker one.
Change-Id: I568eef4f6335669689fb16fd23af92cb4d6464bd
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Clang warns that the private field semaphore_ is unused, and is correct,
of course.
Change-Id: Ic1372cedd3f4b2facca9f6f6be398d26f406b379
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
On the WASM platform, the macro CMDG_NEXTHDR, which is not under our
control, emits a warning about comparing ulong and long with each
other, which -Werror turns into an error:
qnativesocketengine_unix.cpp:1004:24: error: comparison of integers of different signs: 'unsigned long' and 'long' [-Werror,-Wsign-compare]
cmsgptr = CMSG_NXTHDR(&msg, cmsgptr)) {
^~~~~~~~~~~~~~~~~~~~~~~~~~
emsdk/emscripten/1.38.30/system/include/libc/sys/socket.h:286:44: note: expanded from macro 'CMSG_NXTHDR'
__CMSG_LEN(cmsg) + sizeof(struct cmsghdr) >= __MHDR_END(mhdr) - (unsigned char *)(cmsg) \
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Fix by locally disabling the warning.
Change-Id: Ia2ed4318b2ef679b84ac8544835d1e383568ccac
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
- Replaced the usages of deprecated APIs by corresponding
alternatives in the library code and documentation.
- Modified the tests to make them build when deprecated APIs disabled:
* Made the the parts of the tests testing the deprecated APIs to
be compiled conditionally, only when the corresponding methods are
enabled.
* If the test-case tests only the deprecated API, but not the
corresponding replacement, added tests for the replacement.
Change-Id: Ic38245015377fc0c8127eb5458c184ffd4b450f1
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
There's currently only one user, but another one is coming up, so apply DRY
and centralize the work-around for the MSVC warning C4996 on use of 3-arg STL
algorithms in one place.
The code is prepared to handle other algorithms with ease, should any more
crop up.
Change-Id: Ia881888d6a2b5286c6d8d823bc2b76788efad624
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Declare it shared to Qt and make the move method noexcept.
Change-Id: I25d5d255d300fda109ffa1a08e1849b15e9ff29c
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
The public QWidget::create still has them, but we don't need to
propagate them on - that just makes debugging the window creation
flow harder.
The window argument to QWidget::create is technically used to
guard an early exit in the function, but to keep behavior the
same we leave it for now.
Change-Id: Ic0287575aa25f1272e216adc1b75e34d6f55f6d9
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
- First compare the d-pointer before dipping into *d
- Keep a running count as we calculate thisEqualRange, as
std::distance() on QHash::iterator is very expensive.
- Skip the pointless first comparison of the unadvanced
iterator's key() with itself (found by Mårten Nordheim)
Also rename (it, thisEqualRangeEnd) → (thisEqualRangeStart, it),
to keep advancing `it`, which is more natural than advancing
an `end` and later resetting it = end.
Change-Id: I2c27c071b9ee23425a763328402dad9efee4cbd0
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
In Qt 5.0, delta() and orientation() were already marked obsolete,
but Widgets and tests have kept on depending on them all this time.
We now start using alternative API so they can really be deprecated.
All constructors except the newest one are also deprecated.
The plan is for all events from pointing devices to have
QPointF position() and globalPosition(), so we deprecate
the other position accessors.
[ChangeLog][QtGui] Obsolete constructors and accessors in QWheelEvent
now have proper deprecation macros. What is left is intended to be
compatible with planned changes in Qt 6.
Change-Id: I26250dc90922b60a6ed20d7f65f38019da3e139e
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
QLinkedList is still used in several tests. Add exceptions for
these subdirs.
Change-Id: I50ccd2a0892129d4a47aa4e2400211690da9a82d
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This reverts commit a9246c7132.
The QWidget machinery is way to fragile to reset the winId under the
feet of QWidget like that. We would potentially need to include all
the logic in QWidget::destroy. This also ties into the flow between
QtGui and QtWidgets during window closing, which is still unresolved.
Change-Id: I168048a63c89796398eb5331a80ce3e5c8d9a208
Fixes: QTBUG-76588
Task-number: QTBUG-69289
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
- Unexport the value class, export only out-of-line public member functions
to give us more leeway in changing code later (otherwise, we'd be bound
by BC with MSVC debug builds, which call even inline methods from the DLL.
- Don't use QSharedPointer as the d_ptr. It's twice the size of a pointer.
Use a naked pointer-to-const. Derive Private from QSharedData. This
requires some changes in QColorSpace, and, as usual, an out-of-line copy
ctor.
- Add member-swap(), Q_DECLARE_SHARED().
- Drop noexcept from the dtor. It implicitly is, adding it explicitly looks
weird.
- Pass QRgb and QRgba64 by value, not by cref. They're trivially-copyable,
so passed in registers if passed by value. Passing by cref forces them
onto the stack.
Change-Id: I669643d219ede6b7d07f15afbf8728e16150b3b2
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
It is an undocumented and unused method with an obscure name.
Change-Id: Ife27bf836447865cd305c8c7fc9c438759b439cb
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Conflicts:
configure.pri
Also required s/solid\.color/solidColor/ in a couple of places in:
src/gui/painting/qpaintengine_raster.cpp
Change-Id: I29937f63e9779deb6dac7ae77e2948d06ebc0319
A switch statement was comparing enum values of a different enum.
Change-Id: I578f79b15b1007afaa64cd3a2a80d6a75d3bed77
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
The mapping is completely static and the key is the index, so just use
a const char array. The only twist here is that to avoid relocations,
we use an array of const char[4] instead of const char*[].
Change-Id: I001b4db833f14e000676125f6f1be4484d996e0b
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
The QHash was mapping equivalent values of different enums to each other.
The enums have the same enumerators, though, so if we take care to keep
the two in sync in the future, we can just static_cast them into each
other via int.
Change-Id: Ie67978604f8c3b9477419bc6029bbb869061e938
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
There's like three pages of this when compiling the test :)
Change-Id: I923f2c4f5eff7c709977026666cc5b2a2cbfaa72
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
... irrespective from the users current locale.
Fixes: QTBUG-76938
Change-Id: I78810a75ecf9e9f1067363ce56656124b6ddcefd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The Clang parser in QDoc fails to parse the .mm source files if their
include files are not found. Add a dummy 'AppKit.h' file under the
/doc directory for this purpose, and add its include path to
qtwidgets.qdocconf.
Task-number: QTBUG-77009
Change-Id: Iaa984cb8f860367cbb7aa95808d26fb69d7da349
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
The icon provided was ignored, even though NSUserNotification provides
the option to specify a contentImage.
The message popping up will show that image on the right side of the
notification; it will not repace the application icon on the left side.
[ChangeLog][Widgets][QSystemTrayIcon] On macOS, show the icon passed
into showMessage in the notification popup
Change-Id: I8ecda7f893006e74a4f35f37ddc07063ebfe4e83
Fixes: QTBUG-76916
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>