There are two cases:
In a BlockingQueuedConnection, QMetaCallEvent doesn't allocate memory
and instead passes already existing pointers through. A QSemaphore
is used to serialize data access between threads. So the constructor
taking a QSemaphore can be simplified to only accept an existing arg
array.
In a QueuedConnection, QMetaCallEvent needs to make deep copies of
the arguments, and memory needs to be allocated based on the number
of arguments. The previous code put the burden of memory allocation
on the code generating the event, while the memory was free'd by
~QMetaCallEvent. Instead, make it QMetaCallEvent's responsibility
to allocate and free the memory as needed, and adjust the code
generating QMetaCallEvents.
We can allocate the memory for types and pointers to arguments in a
single block, starting with the space for the array of void*, followed
by the space for the array of integers to avoid byte alignment issues.
By pre-allocating the space that's needed by three arguments, we can
avoid all mallocs for the majority of QMetaCallEvents.
Until this change has propagated through qt5.git, we need to keep the
old API that is still used by QtDeclarative around. Once QtDeclarative
has migrated to the new API, it can be removed.
Change-Id: Id7359ffc14897237ea9672dabae9ef199a821907
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
If a project has DESTDIR and TARGET set to fixed values, then the
target paths conflict when doing debug_and_release builds.
With this change we're detecting this situation and yield a warning.
Fixes: QTBUG-2736
Change-Id: Ib163db3463322792ab9fa5b997285ac9fc9819ab
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
- add conditional noexcept to move special member functions
- use qExchange() in the move ctor implementation (turns a copy into a move)
- separate the default ctor from the ctor that acquires a resource, then
- overload the latter for rvalue payloads
Change-Id: I6816143a94fe6a74cf0d02569b83a752a8da3089
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The conversion from int to uint is deliberate here, so let's cast and
avoid a warning for users compiling with warnings enabled.
Change-Id: I7136d6161ace735be49f8d987338f6d401a5c78a
Fixes: QTBUG-77245
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This adds a manual test for the QTextTable border logic.
Two HTML files are bundled as resources:
table-border-test.html: Contains various test cases for the border
logic.
table-border-test-header.html: Contains a test case for printing a table
with a repeated header.
The test application allows:
- editing
- previewing
- printing
- opening the HTML in the system browser (via temp. file)
It is possible to edit the HTML with "live preview" so new test cases
can easily be implemented.
Change-Id: Ic88488bc8b7dd74d5c03c3363f55840423462325
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
clang-cl will never support C++ standards newer than
C++14 without these flags.
I didn't add them to msvc-based-version.conf because
on Windows, only clang-cl use the same flags with MSVC,
both ICC and MinGW have their own flags. So they are
clang-cl specific flags.
Change-Id: Ia44a5ea4237c77ea5e897fffded32cbc008a4729
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
When I initially added it, it was ony for QCborValue, but I never added
the tests. Turns out there were two bugs:
[ChangeLog][QtCore][QBitArray] Fixed two bugs that caused QBitArrays
created using fromBits() not to compare equal to the equivalent
QBitArray created using other methods if the size was zero or not a
multiple of 4. If the size modulus 8 was 5, 6, or 7, the data was
actually incorrect.
Fixes: QTBUG-77285
Change-Id: Ife213d861bb14c1787e1fffd15b70573d162042c
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
The template for the "This is a generated file" notice made a clumsy
intrusion in the code in which it appeared, so split it out as a
constant of the module and access it by name where it's used.
Change-Id: Ic4dfb8e873078c54410b191654d6c21d082c9016
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Every property name was already monospace, except this one.
Change-Id: I69f4e7cd67e6d4ab2a25b4f1d251ec5a2c925098
Reviewed-by: Nils Jeisecke <nils.jeisecke@saltation.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
This allows to set the width, style and color of each table cell's edge
(left, right, top, bottom).
Setting the table's border-collapse mode will disable explicit cell
spacing. The basic CSS border collision rules are applied (wider border
wins, vertical over horizontal).
Setting the table's border width to a value >= 1 and enabling
borderCollapse will now draw a simple and clean table grid (1px) with an
outer border of the specified width and color.
[ChangeLog][QtGui][QTextDocument] Added CSS style table cell border
formatting with border-collapse mode.
Change-Id: I324d82284802df4c88c13c5b902fec1f4768b67e
Fixes: QTBUG-36152
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
If the host architecture is different from -platform (canadian cross
build with -external-hostbindir) then we cannot use QMAKE_HOST.os to
deduce the executable extension for that platform, because this value
comes from the qmake binary that was pointed to by
-external-hostbindir.
Move the target name deduction mechanism to the actual configure test
.pro files to make sure the right scopes are available, and write the
deduced target name to a text file. That text file is read by
qtConfTest_architecture to get the right binary to analyze.
Fixes: QTBUG-77286
Change-Id: I68b844dd51dbfda6432a4b0dca6331899c82255f
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Look it up when needed instead. Also, simplify our
ownership logic - do not retain/autorelease that
is already owned by a menu (via its itemArray).
Fixes: QTBUG-76523
Change-Id: I60a2ed0d192396baf99eec7b37fa5cc10e5db626
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Simply return a Glyph pointer and not a QImage to avoid allocating and
deleting lots of d pointers for QImage when drawing text. Saves one
new/delete pair per glyph drawn and speeds up text drawing by 10% for
relatively large glyphs (probably more for smaller ones).
The qtext::paintLayoutToPixmap() benchmark shows a 16% improvement
in performance with this change.
Renamed the method to glyphData().
Change-Id: I7a353de521e4f4321c770fb1ac6043d33f6f332c
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
This enables building against the latest SDK, while still opting out
of features that this SDK normally enables, by lowering the SDK version
set in the BUILD_VERSION/VERSION_MIN_MACOSX load command.
Change-Id: Id5f13524740bfbf5eda10a5d0c2e3fda04bf3f52
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
This fixes rendering artifacts for the specific case of the first
unselected vertical (west) tab button in a tab bar. The popup button
gets drawn at the beginning of the tab bar instead of translated to the
actual location of the tab.
Fixes: QTBUG-76385
Change-Id: I17112c56eabacf34e470314d4cc6b263ba632ec1
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
C++11 is a requirement since Qt 5.7. There is no point in highlighting
the condition anymore.
Change-Id: I0f7d6044db2528d3b5264c324cf71156ec833775
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
We were missing attribution for the AGLFN tables.
Task-number: QTBUG-70968
Change-Id: Ib84cbd25c9f7c49611761c9eba16624de5b77dd2
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
When calling QTextDocument::clearUndoRedoStacks() with UndoStack,
there were two bugs: The first was that we were retrieving
the item at "undoState" and deleting this. This is actually the
upper limit of the for loop. If the stack does not contain any
redos, then it would be == undoStack.size() and we would assert.
If there were redos, then we would delete the item at undoState
multiple times (actually undoState times).
In addition, when the loop exited, we first removed the dangling
pointers using remove() and then there was a weird resize() to
the new size minus the old undoState.
This would either assert because we tried to resize to a negative
number, or it would arbitrarily remove items from the stack.
[ChangeLog][QtGui][Text] Fixed a crash bug in
QTextDocument::clearUndoRedoStacks(QTextDocument::UndoStack).
Task-number: QTBUG-69546
Change-Id: I8a93e828ec27970763a2756071fa0b01678d2dcd
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
The platform menu tags in Qt are actually the pointers, so they are
64-bit values when the build is 64 bit. Since menu IDs in Android
are 32-bit ints, we cannot cast back and forth like we do. To fix
this, we add a separate hash of menu IDs to allow mapping between
Java and C++. For easier book-keeping, we add the hashes to the
menu bar and menu classes, so that we can easily recycle old menu
IDs when they are no longer in use.
Note that overriding the tag on the menus by calling setTag() will
not work, since Qt Widgets will later override it again by setting
it back to the menu's pointer.
[ChangeLog][Android] Fixed an issue where menus would not work on
64 bit builds.
Task-number: QTBUG-76036
Change-Id: Icaa1d235d4166331669139251656ea0159e85195
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
The new helper class BorderPaginator encapsulates the existing pagination
logic for drawing correctly clipped borders on all pages a cell appears
on.
This will allow reuse of that logic for drawing CSS-style borders.
Change-Id: I47ed4a8802513aef30d97f14591c7d4716bfdbb8
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
87748cc18e introduces rounding of column
widths to avoid table border render artifacts.
For variable columns we must make sure that the maxWidth (= unwrapped
content width) is not rounded down as this can cause erroneous
wrapping of the content at rendering time.
Fixes: QTBUG-43589
Change-Id: Iee155702a12374116a63050e5025df91f097a8e4
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Except in the auto-generated files.
Required to add a cast operator from QDBusObjectPath to QVariant, as the
variadic call() uses QVariant(arg) instead of QVariant::fromValue(arg).
[ChangeLog][QtDBus][QDBusObjectPath] Added explicit cast operator to QVariant.
Change-Id: I3f3004f7b9300a6340d27488f5b97981cbab3c24
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Don't manage the ref-count yourself, as this requires the code to use
the QAtomic copy ctor, which we want to remove going forward. Using
QSharedData, we can let the compiler write the code for us.
Since 'ref' this way moves to the first spot in the list of effective
members, creating a 4B hole between itself and 'msecs', swap 'status'
and 'msecs' to fill the hole:
offset: 0 8 16 24
| | | |
without v v v v
adj.mnt: |*R*| | msecs | S | U | TZ....
before: | msecs | S | U |*R*| | TZ...
after: |*R*| S | msecs | U | | TZ....
This keeps the padding out of the critical first word, which improves
latency. That said, for accessing the members the old layout surely was
optimal. This layout optimizes copies and pessimizes access to 'msecs'
on 32-bit platforms without the Critical Word First optimization.
Requires adjustments to tst_toolsupport and the qhooks version.
Also default members using NSDMI, consequently drop the manual default
ctor.
Change-Id: I3c48e68694ad29b28a13aa47ea0f283fae52edd7
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Now that all QLinkedList uses are removed from Qt, make sure
QT_NO_LINKED_LIST is set by default for Qt modules, so new
modules don't need to explicitly specify it in their
.qmake.conf.
Modules can still opt out of the QLinkedList ban by adding
DEFINES -= QT_NO_LINKED_LIST
to their .qmake.conf.
Change-Id: I34b7ab1c009795649bb7b4f1e7493556eafadd5a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
For symmetry with QSize and QRect and because there were some users in Qt.
Port those users.
[ChangeLog][QtCore][QPoint/QPointF] Added transposed().
Change-Id: If4f23dbcf7d67983a6b1885e0d1d538115b49e2b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Amends 2e1763d83a.
The new range ctors need deduction guides, since the compiler can't
deduce the value_type from a pair of iterators.
Change-Id: I3ec1e5f91305b317c443b6a70246be416b55bad9
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The three cases - with classic slot, with functor and context object,
and with lambda - are all doing the same work, they just differ in
how they signal the application code about the results.
The detour through an explicitly posted QMetaCallEvent is needed
if we have a functor or lambda; making sure that the temporary
QHostInfoResult object lives in the right thread guarantees that the
event is received in the correct thread, so we can directly call the
functor (as long as the context object is still alive).
Since we guarantee that the QHostInfoResult object lives in the
thread of the receiver, we can simply emit the signal for old-style
signal/slot connections; the regular signal/slot mechanism will do
the work for us.
Change-Id: I584df17df879af01c653e354490c4691dbedd3fa
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Also clarify what this check includes (backends are expected to
register only QRhiResource instances that actually own native
graphics objects - the ones that don't are not included in the
leak checking)
Change-Id: If0f43b302b148f043391fa7fd7bb77cfc8d93b79
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
some assumptions were incorrect: our test server immediately sends
its SETTINGS frame, as a result we have to reply with client preface +
SETTINGS(ACK). So QVERIFY(!prefaceOK) was wrong from the beginning and
was only passing by pure luck.
Change-Id: Ie43f0d4ac41deb0e5339badaae6149a9b2f9d9b3
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Also sanitize the initial WebAssembly hack. Both eglfs and wasm lack the concept
of true raster windows. A QWindow with RasterSurface is rendered with OpenGL
no matter what. The two platforms took two different approaches to work around
the rest of the machinery:
- wasm disabled the QOpenGLContext warning for non-OpenGL QWindows,
- eglfs forced the QWindow surfaceType to OpenGLSurface whenever it was
originally set to RasterSurface.
Now, the latter breaks since c4e9eabc30, leaving
all raster window applications failing on eglfs, because flush in the backingstore
is now checking the surface type and disallows OpenGLSurface windows. (just like
how QOpenGLContext disallows RasterSurface windows)
To solve all this correctly, introduce a new platform capability,
OpenGLOnRasterSurface, and remove the special handling in the platform plugins.
Change-Id: I7785dfb1c955577bbdccdc14ebaaac5babdec57c
Fixes: QTBUG-77100
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
QWidget does not handle QWindow and QPlatformWindow being destroyed
behind its back, and the QWidget state for internalWinId and the
Qt::WA_WState_Created attribute can easily get out of sync with
reality.
To avoid QWidgetBackingStore mistakenly thinking that a widget does
not have a platform window it can operate on we use the QWindow and
QPlatformWindow handles directly, instead of relying on the winId.
This is a stop gap until we can teach QWidget to deal with dynamic
changes to its underlying window handles.
Change-Id: Ib09bea2ad62c42e9667a20ca6b5faf0f957288da
Fixes: QTBUG-74559
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
The Thursday in the same week has the same week-number and determines
the right year to use for the week. So calculate its week-number and
save a whole lot of complications.
Change-Id: I9c28267e6083afdd04a15245e1609c64beb82b37
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
The array of QAtomicPointer<QMutex> can be initialized using relaxed
stores of nullptr, since nullptr is the whole data. But once we store
an actual QMutex pointer in the array, we need to publish the indirect
data thus created. We did this, with testAndSetRelease(); what was
missing was a corresponding acquire fence on load, without which there
is no happens-before relationship between the writes performed by the
QMutex ctor and the reads performed by a subsequent mutex.lock(), say,
on the same data.
Fix by adding acquire fences to all loads. That includes the dtor,
since mutexes may have been created in different threads, and never
been imported into this_thread before the dtor is running.
As a drive-by, return a new'ed QMutex that was successfully installed
directly to the caller, without again going through a load-acquire.
Fixes: QTBUG-59164
Change-Id: Ia25d205b1127c8c4de0979cef997d1a88123c5c3
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 65b8f59e04)
(cherry picked from commit da38f0d691d9d7eacfac5fbcbd47b887bd59bd39)
If this function is called by multiple threads, more than one could
reach the mutex locking and call TlsAlloc(), but only the last one would
save the data. The others would be leaked and, worse, be used by those
other threads.
[ChangeLog][QtCore][QObject] Fixed a resource leak caused by a race
condition if multiple QObjects were created at the same time, for the
first time in an application, from multiple threads (implies threads not
started with QThread).
Fixes: QTBUG-77238
Change-Id: Ife213d861bb14c1787e1fffd15b63a5818bcc807
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Libtool cannot cope with absolute paths in the dependency_libs entry.
We split absolute paths into -L and -l here.
Change-Id: I30bf11e490d1993d2a4d88c114e07bbae12def6d
Fixes: QTBUG-76625
Reviewed-by: Kai Koehne <kai.koehne@qt.io>