The test produces compiler warnings in release builds:
tst_qgraphicswidget.cpp: In member function 'void tst_QGraphicsWidget::setTabOrderAndReparent()':
tst_qgraphicswidget.cpp:1521:89: warning: 'w2' may be used uninitialized in this function [-Wmaybe-uninitialized]
tst_qgraphicswidget.cpp:1536:88: warning: 'w1' may be used uninitialized in this function [-Wmaybe-uninitialized]
Use arrays instead of the variables w1,2... and rewrite the helper
function compareFocusChain() to work on iterators allowing to
remove some temporary lists. Also return error messages in a
QByteArray ready for the Q[TRY_]VERIFY2 macros.
Change-Id: I43466921af59521d1faf00b75fe943508418abb3
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Iterate over the original list instead.
Change-Id: I7be154c0e19074033df6f6e01f68d21a8904d2ee
Reviewed-by: Andreas Aardal Hanssen <andreas@hanssen.name>
QTouchEvent::touchPoints() returns a const-&, but the old
code took a copy, over which it then iterated, modifying
the touch points, causing (necessary) detaches of both the
list and the touch points.
Befriend QTouchEvent and modify the list in-place, avoiding
all detaches in the likely case that QTouchPoint contains the
only copy of the touch point list.
This is all the more important as the function is called once
for every item-under-mouse in sendTouchBeginEvent().
Port to C++11 range-for as a drive-by.
Change-Id: I2f74d19845711d97e3566886123b5d18d55db74c
Reviewed-by: Andreas Aardal Hanssen <andreas@hanssen.name>
Helps pinning the vtable to a single TU, which can
prevent false negative RTTI (incl. dynamic_cast and
catch()).
But mostly because it's rather pointless to have dtors
of polymophic function inline. Most of the time, the
code will be called through the vtable indirection,
anyway (which also means that an out-of-line copy of
the code needs to exist in any case). The inline
method will only be used when the compiler can prove
the dynamic type of an object.
Saves ~1.5KiB in text size on optimized GCC 4.9 Linux
AMD64 builds.
Change-Id: Ic4ce96da559252c8abc29d880530c84035db2306
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The QMap<QByteArray, QString> was only used to hold key/value pairs
until they were serialized into a QString at the end of the function.
Serialize into QString directly instead, dropping the temporary QMap.
The problem is that we'd like to keep the line formatting central
while at the same time harnessing the power of QStringBuilder.
This is possible with a templated function with an input/output
parameter:
format_attr(QString &result, const char *key, T &&value)
format_attr(result, text-foo, str + str2 + str3);
Or with return type deduction:
formatted(const char *key, T &&value) -> decltype((expr)) { return expr; }
result += formatted(text-foo, str + str2 + str3);
I don't like out parameters, and we can't rely on auto return
type deduction, yet, so I opted for a miniature expression
template solution that can only match the expression
attr[key] = value;
where 'key' is a const char* and 'value' can be anything that
QStringBuilder supports. This allows to keep the syntax of a map
while at the same time serializing to QString immediately.
The only behavioral difference to the old code is that the
attributes are no longer sorted, but order doesn't matter.
Saves more than 10KiB in text size on optimized GCC 4.9 Linux
AMD64 builds.
Change-Id: I7b3bec0466ef24156c693adaa95f0316007e0bfe
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
This is private implementation, so there's no BC issue here.
The collections ported here also do not benefit from CoW,
because they are never copied.
Adapt to STL API and replace foreach with C++11 range-for
loops, because the former deep-copies STL containers.
Also replace index-based for loops with C++11 range-for,
to evade the int/size_t problem on MSVC.
Saves a bit more than 1KiB in text size on optimized GCC 4.9
Linux AMD64 builds, not all of which can be attributed to the
ports to range-for.
Change-Id: I240030180bd1b2ca40c002b03ab72319a99a87c3
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Drive-by changes:
- use auto for iterators
- add Q_UNLIKELY for conditions leading to a qWarning etc
Change-Id: Iff8f36d67c96674d354a501b26640f73c15ce58d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Sérgio Martins <iamsergio@gmail.com>
This is the signature the functions have in C++11. For the std
containers, this is just convenience, but for Qt containers
with their implicit sharing problem, the combination of erase()
with constFind() can delay a detach until absolutely necessary.
[ChangeLog][QtCore][QHash/QSet] Added erase(const_iterator).
Change-Id: I2fc841c664cd7515b0f56fd7210fcd17c37f9014
Reviewed-by: David Faure <david.faure@kdab.com>
Clang's integrated assembler does not accept this assembler syntax, so
tell it to only run the preprocessor, and pipe everything through the
system assembler.
Change-Id: I6bd884473e634837b47480546a1d1d8d62e7a2b6
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
By making the destructor (usually the first non-inline, non-pure,
virtual function, and therefore the trigger for most compilers to
emit the vtable and type_info structures for the class in that TU)
out-of-line, vtables and, more importantly, type_info structures for
the class are pinned to a single TU. This prevents false negative
dynamic_cast and catch evaluation.
Since QGraphicsItemPrivate is already exported, users of this class
are unaffected by the change, and since it's private API, we don't
need to avoid adding code to the out-of-line destructor until Qt 6.
Also saves ~2.5KiB in text size on optimized GCC 4.9 Linux AMD64
builds.
Task-number: QTBUG-45582
Change-Id: Ibb404a43d5464e8e280ccebd5f95719852f5a986
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
It's a virtual function call, followed by another out-of-line
function, so the compiler cannot hoist the expression out of
the loop itself.
But we can, so do it.
Change-Id: Icffa6fa9a667d566b0829a18fea7128625e85920
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Vibrates the device or plays an alert sound on devices
that do not support vibration.
The other implementations of beep() have been moved to
QPlatformIntegration as a proper API instead of having
them as invokables in QPlatformNativeInterface.
Change-Id: Ic597dbef04b46d49862b070e78ddfc0d763829a2
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Reviewed-by: Kai Uwe Broulik <kde@privat.broulik.de>
Use the new reverse_iterator support in QList to
avoid building a QList with prepend()ing, using
append() instead.
Change-Id: Ia1f6d0ecc08a824f11d93a6fd4077b11b1b0f786
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Use the new reverse_iterator support in QList to
avoid building a QList with prepend()ing, using
append() instead.
Change-Id: I6b9d9b1a9941cf2e6cc39ad2d9097fdc629c24bc
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
There's no point in checking isEmpty() to prevent a for loop from
executing, esp. if the checking involves copying the container
and calling an out-of-line function to get said copy.
Just fall through the for loop.
Change-Id: If6c689ff4bcd685bc645b4fb3f2c15ce5d5945af
Reviewed-by: Sérgio Martins <iamsergio@gmail.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
- Do not save geometry when going from maximized->fullscreen
- Use SW_SHOWNA instead SW_SHOWNOACTIVATE as otherwise the
maximized geometry is restored.
- Add a test for Windows.
Task-number: QTBUG-49709
Change-Id: Ic81e7398ee90d499a50b02192a45cb09276a2105
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
When keys are pressed and the application becomes inactive before
they are released, the stored state becomes inconsistent.
Task-number: QTBUG-49930
Change-Id: Ide86b1d9052df060f30f7c02b81a4f2ae15d28e7
Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
Windows automatically disables DWM for opengl windows that have the
exact dimensions of the primary screen. This causes numerous issues,
such as menus and popups not showing up, and alt+tab misbehavior.
Adding a one pixel border via WS_BORDER solves all of these issues.
This is done by a QWindowsWindowFunctions to make it opt-in as turning
it on can cause an unwanted change in the look of the window so it is
up to the user to decide if they want this.
[ChangeLog][Platform Specific Changes][Windows] Add a function to
QWindowsWindowFunctions to enable working around a limitation with
showing other top level windows when showing a fullscreen OpenGL based
window.
Task-number: QTBUG-41309
Task-number: QTBUG-41883
Task-number: QTBUG-42410
Change-Id: I8c5c785f5024737cd034b2b703671632a8102700
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Use the macro we have that does exactly what we want without the boiler
plate code.
Change-Id: I25c67a71f83f91f50128c8a54033ee53ad28e88a
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
In certain cases we were still showing a cursor in a TextInput even
though the keyboard was hidden programmatically.
Change-Id: I48ebb6b8bc0382236b1ea5835e68eae48ece2b4f
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
If the focus object changed programmatically for example to the next
input field in a window, we want to keep the keyboard open. This
strangely only worked if the inputs had different IM hints because this
made the keyboard appear again.
Change-Id: I52e66bb7d2ff97ae7084173769d9b5c2d0c549b5
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
The edit menu will also close if the user taps outside it, not only
when selecting a menu item. But we never caught this case, which left
QMenu to belive that it was still open.
Change-Id: Iae071b4fc5fdc44d7d05b4dd767042907e337957
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
[UITextInput textInRange] is sparsely documented, but it turns out that
unconfirmed marked text should be seen as a part of the text document. This
is different from Qt IM (ImSurroundingText), which handles marked text on
the side. The reason we can assume this is that the range we are given
as argument to textInRange exceeds the documents length when having
marked text appended to the end, suggesting that it tries to read / verify
the current marked text. In addition, keyboards like Japanese-Kana will not
update and function correctly unless marked text is included.
Note that the docs seems to imply that you cannot have marked text and text
selection at the same time, unless the selection is contained within the
marked text (using the dedicated selectedRange argument to setMarkedText).
If this turns out to be incorrect, we might need to adjust the methods
dealing with selection to also include marked text as well.
Task-number: QTBUG-49946
Change-Id: Ifedd792ec66db435806f57fca157e1abbbf121a8
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
Delay the exit call until Java part finishes the execution.
We must be sure all the threads are stopped (hanged), when we
call exit, otherwise java thread will try to use static vars
that are freed by the qt thread.
We also need to call exit from Qt thread, otherwise Qt will complain
about it.
Change-Id: Ia1e7a4d7d56c39d38313f040aab618ec5a68dfb6
Reviewed-by: Christian Stromme <christian.stromme@theqtcompany.com>
Implement the reading of the QT_QPA_EGLFS_PHYSICAL_WIDTH and
QT_QPA_EGLFS_PHYSICAL_HEIGHT as documented.
Change-Id: I862a03e9d05dcd15fb6a245c93ebd3e028de0c47
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
Adds NEON version of interpolate_4_pixels used by smooth upscaling, and
bilinear sampling.
The SSE2 version is reordered to match the NEON version so they have
the same order of operations and a faster version that loads directly
into vector registers.
Testing is extended so we have a test of smoothness that can catch more
possible mistakes.
Change-Id: I0de4aecf5cb79468e7c8f19f421aa24b2955547c
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
Now that more of the raster operations are NEON-optimized this should
be acceptable. The switch enables antialiased drawing, and makes iOS
in line with other platforms in having QBackingStore backed by a QImage.
The use of QImage also allows us to remove code from the backingstore
implementation that was only needed to support the composeAndFlush
code path.
The common parts of a raster backingstore implementation have been
factored out into QRasterBackingStore in platformsupport, which can
be shared with more platforms in the future.
[ChangeLog][iOS] QBackingStore now uses the raster paint engine
instead of the OpenGL paint engine, enabling improved antialiased
drawing. In case of performance regressions, the old code path
can be enabled by setting the window's surface type to
QSurface::OpenGLSurface.
Task-number: QTBUG-35271
Change-Id: Ia300b9a5edf8dc0b4bfb99d84ed3c23a8523c267
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
Quite obviously faster (doesn't need to populate a QList first,
just to iterate over it).
Also saves 1.5KiB text on optimized GCC 4.9 Linux AMD64 builds.
Change-Id: If4c7af80165a6027d39359bac22df30e7ca09815
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Saves ~0.5KiB in text size on optimized Linux AMD64 GCC 4.9 builds.
Change-Id: Iba2c02eed44f1ee3521bc49fe7afae9c2e916fdc
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Depending on the number of popped arguments, repeated
pop_front()s could turn quadratic even with QList.
Change-Id: I1f29af4a61f0f8e13253807d2f208c7911e71378
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
This needs to be handled a bit carefully, because Qt containers
will detach upon being iteratoed over using range-for.
In the cases of this patch, that cannot happen, because all
containers are marked as const (either by this patch or before).
Separate patches will deal with other situations.
Apart from being more readable, range-for loops are also the
most efficient for loop.
This patch shaves almost 2K of text size off an optimized Linux
AMD64 GCC 4.9 build.
Change-Id: I53810c7b25420b4fd449d20c90c07503c5e76a66
Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
This needs to be handled a bit carefully, because Qt containers
will detach upon being iterated over using range-for.
In the cases of this patch, that cannot happen, because all
containers are marked as const (either by this patch or before).
Separate patches will deal with other situations.
Range-for loops are much more efficient than foreach loops.
This patch shaves almost 3K of text size off an optimized Linux
AMD64 GCC 4.9 build.
Change-Id: I7b1d41db4d9b5db8b515cb75686dc5135177da68
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
the variable is later re-used by qtPrepareTool(), so the tools used to
build the tool would get excess variables passed.
Change-Id: Ib1bdd2211b4a8615e2be9ba0310822f373f5efb0
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>