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>
Strings do not have to be overly specific to test parser function.
Change-Id: I345dfec7fb4b8004661f6757cfd53b428ad87b6b
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
1. Keep 'separator' a QLatin1String.
- saves at least two memory allocations
- necessitates carrying the \n previously prepended to it
around explicitly
2. Start adding to 'textToCopy' with op+=
- saves one allocation, costs one -> ±0
- preallocates more capacity than if we started with
assignment
3. Collapse three unconditional op+= into one
- more efficient usage of QStringBuilder
4. Don't collect button texts in a separate variable, but
append to 'textToCopy' directly.
- saves at least one memory allocation, probably more
since the growth increments of 'textToCopy' should
be larger (due to more content) than those of a new
variable.
Also replace index-based iteration over the buttons with
C++11 range-for over a const QList. Avoids the detach that
happened previously, due to use of op[] instead of at(),
but frankly, I was just too lazy to separate this change.
Change-Id: I27a46a6a163c16d773124f140e085325b17ce5d1
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Change the QWindowsInputContext::composition if it is called
with lParam has flags GCS_RESULTSTR and GCS_DELTASTART,
it doesn't call endContextComposition.
Task-number: QTBUG-49955
Change-Id: I2035c4b3c1e947c5757d7532150798963fc39012
Reviewed-by: Tasuku Suzuki <stasuku@gmail.com>
Reviewed-by: Takumi ASAKI <takumi.asaki@gmail.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Andy Shaw <andy.shaw@theqtcompany.com>
Reviewed-by: Liang Qi <liang.qi@theqtcompany.com>
In tests with many data sets and init()/cleanup() functions, a significant
time is spent looking up the methods "init"/"cleanup"and the test methods
in qInvokeTestMethodDataEntry().
Introduce a class TestMethods that aggregates the optional methods and the
test methods as a std::vector<QMetaMethod>. Its method list can be populated
either by inspecting the QMetaObject or from the command line.
The class is instantiated on the stack.
Previously, 2 data structures existed for storing the methods to execute
obtained from the command line (array of class TestFunction and an exported
StringList testFunctions for QML).
Remove the custom TestFunction and use only the (QML) testFunctions list
for populating the new class.
Speeds up tst_QChar::normalization() from 340ms to 300ms on an average
Linux machine.
Task-number: QTBUG-38890
Change-Id: I80b488e7249ce031b6d6c8442e53aa87bd2edd42
Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
The item to look up isn't modified, so take by pointer-to-const.
Can't change the API, so overload and mark the old function
for removal in Qt 6.
Change-Id: I4671c6b079687ec9d81b1ac0e6745887ef7077cd
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Add QWindowsNativeInterface::nativeResourceForCursor() and
implement for Windows (returning the HCURSOR) and XCB (returning
the xcb_cursor).
Task-number: QTBUG-49386
Change-Id: I963869f6e8741449822ecbe6489f9c42a786c7a6
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Store nativeWorkingDirectory in a variable on the stack to prevent
accessing the buffer of a temporary string.
Fix breakage introduced by 068baa9bb6.
Change-Id: I8cf9ffe39c97afc9383c33cafaeffb1245b3e2b9
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
This is used throughout Qt and resolves to
operator op(QChar, QChar)
This test makes sure we don't break those
use-cases as we fix missing relational
operators as found by tst_QStringBinOps.
In the other direction, 0 op QChar is
ambiguous, due to op(const char*, QString)
etc, so only test the uint op QChar case.
Change-Id: Ifae7fb65bf3269583898cfea3fc6c95547c75122
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Equality and inequality were already marked nothrow, but
less/greater than (or equal) were not.
Fixed.
Change-Id: I3f7a3388b31fcaa2535353f357b5bd1fc86f261d
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Without this, the symbol list is frequently reallocated. The value
is a guestimate. It corresponds to a block of memory with the size
262144 * 3 * 8 byte = ca. 6.3 megabytes
on a 64 bit machine. Looking at the final size of the symbol list,
this seems to fit the common case nicely.
Change-Id: Ib546a1ea479f2c6d8ab57be783cdf630f9b54f77
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
MSVC doesn't define float versions for _isnan/_isfinite, so the double
versions need to be used. This is already done in the surrounding
functions, but not in these two.
Change-Id: Ic183358dc1790279e18d00a08b7279e76c02af60
Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
NSColors can be quite complex and store patterns, gradients, dynamic
system colors that change based on global state (!), etc. QBrush is a
better equivalent to it than QColor.
Change-Id: I4b66a1ab85342bbb9efcf78011965ec74e5fc738
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@theqtcompany.com>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
Starting with Qt 5.7 we removed support for API < 16 (Android v4.1)
[ChangeLog][Android] Support for Android API < 16 was removed.
Change-Id: I8bf396a9d70ab0996965e0c9f629800aa1fa6a45
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
For example:
../../include/QtGui/5.7.0/QtGui/private/../../../../../../../../qt5-dev/qtbase/src/gui/painting/qpaintengine_blitter_p.h:67:18: warning: 'end' overrides a
member function but is not marked 'override' [-Winconsistent-missing-override]
Change-Id: I2845d8e4b5a7e11c57ac1933a6d152df1ef5d07f
Reviewed-by: Jake Petroules <jake.petroules@theqtcompany.com>
[ChangeLog][QtCore][QProcess] Added method
setCreateProcessArgumentsModifier to QProcess on Windows to enable
users to intercept and modify CreateProcess parameters.
With such a modifier, calling code can decide whether to inherit
handles, modify the STARTUPINFO struct, and pass its own
combination of process flags to CreateProcess.
Task-number: QTBUG-390
Task-number: QTBUG-6917
Task-number: QTBUG-9350
Task-number: QTBUG-24619
Change-Id: I14757dbbacfebb1c89f52402d36fba0ba9c45f3a
Reviewed-by: Björn Breitmeyer <bjoern.breitmeyer@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
We need to pass the correct connection and we need a specialization for
reply pointers. Also, there is not much of a point in first creating
a QString from a QByteArray, only to retrieve a QByteArray again.
Change-Id: Ia1bb5655f6229638e3bd2339acadeffc80561b9e
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
Move some code (like registrations of meta types) from init() to
initTestCase() in the process.
Change-Id: I57db5156647cfadab554fbed853b2e68b2815f3b
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
When a QLineEdit is readonly there's a discrepancy between key press
events and shortcut override events. For instance, presses Ctrl+C
copies the text unless there's also a shortcut for the same key sequence.
In this case, the shortcut override event is not handled, and no text
is copied. Fix it by splitting the handling of shortcut override
events between "read only" access (copy, select, etc.), which still
makes sense on a read only line edit, and write access (paste, ...)
which doesn't.
[ChangeLog][Important Behavior Changes][QLineEdit] QLineEdit will
now accept certain shortcut override events even if it is read only.
Change-Id: Ie5b048259b99a1eff0581129e3ad97f27a88fe86
Task-number: QTBUG-21217
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
The documentation says that we scroll one pixel, but changing the
behavior in 934f062203 to do that
was not well received.
People were relying on the undocumented behavior - and the new behavior
was considered to be a regression. (Nobody called setSingleStep since
Qt in many cases provide a reasonable singleStep - which implied that their
programs scrolled with 1 pixel which was quite slow). Furthermore getting
the old behavior (auto set of single step) was nearly impossible.
However the revert (done in 0e69230d02)
gets us back to QScrollbar::setSingleStep not working in pixel scroll mode
(even without it being documented - but we should also have a working API
rather than documenting that it is not working)
The previous approach was directly prevented Qt from changing
single step (on e.g resize) at all. This patch only prevents Qt from
changing when a user explicitly has called the function
QScrollBar::setSingleStep (in pixel scroll mode).
That is we expect that calls to setSingleStep means that the user actually
wants to set the singleStep and doesn't want Qt to control that value.
Furthermore it is possible to switch back to the automatically adjusted
singlestep with QScrollBar::setSingleStep(-1).
[ChangeLog][QtWidgets][QAbstractItemView] QTBUG-7232 - In ItemViews
when scrollMode is set to scrollPerPixel, it is now possible to
change the single step. Qt will automatically adjust the single step
until setSingleStep is called. When setSingleStep is called it will
however respect the set and stop doing automatic changes of the value.
Calling setSingleStep(-1) will switch mode back to automatic adjust.
Task-number: QTBUG-7232
Change-Id: Ibfe0caa9751d3bcc11bfc6e0654a3d1ac35ac8ae
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
The pixman drawhelpers are implemented using GAS syntax, which the
Clang assembler doesn't handle, nor do they work on 64-bit ARM, so
we disable them selectively. They are only used for 16-bit surfaces
anyways, so it not a big deal on iOS.
Change-Id: I78417fabd7f671f9c5d94b6e5fa5ce10d3fc1d27
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
d79ae90466 accidentally removed the check
on the driver pointer before dereferencing it. This causes a segfault
when deleting a result object after its driver has already been deleted.
This situation can arise when a database is removed, explicitly or
probably also upon unloading the driver plugin, while related
results still exist. The problem affected
qttools/tests/auto/qhelpcontentmode.
Task-number: QTBUG-49836
Change-Id: I8ce8f8a5e27d787309ac2ff644b388e333d76435
Reviewed-by: Mark Brand <mabrand@mabrand.nl>
... because it's useful for non-primitive types.
Except for index-based loops, these were the only two
remaining instances in QtBase.
Change-Id: I0fafa502d78a70f98b4a90f4d3c7fdfbb401a90f
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
The code for _q_clipboardChanged comes from some ancient time
(Qt 3's QLineEdit::clipboardChanged, subsequently refactored in Qt 4
and Qt 5). The best part: it has always been a slot doing absolutely
nothing. Get rid of it.
Change-Id: Icc2c71920377d069529bb7ed7c40c15f46fbb455
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Like on some BSD systems, the member of the ifreq
structure is called ifr_index and not ifr_ifindex
on Haiku OS.
Change-Id: I273de0c703b1c89dbac537c68e52db219d2da50e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Since the commit 9f83e75d3fbfc01a5ca8d87b4c33ca1ad848387d we can build
the release packages with Q_ASSERTs still enabled. As this feature was
targeted to embedded platforms it would be nice to enable Q_CHECK_PTR
macro as well.
Change-Id: I2d549d92b7196935665d927e6aaed3e9f31593b1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
[ChangeLog][QtCore][State Machine] Added constructor overload that
takes a pointer-to-member for the QSignalTransition.
Change-Id: I80ac6e16d0edf7d2ab09882b6f6db4cbd73364e1
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
... and simplify it:
De-duplicate ++c by moving it from every case into the
switch statement, undoing it only in the default case.
Introduce a small helper function can_consume() for dealing
with the two-letter length modifiers.
Also return the result from each case instead of storing
it in a temp variable.
Change-Id: I28a527920aabba067ebb2152a67995c8f2ec7ae7
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Otherwise, the window may up outside the display area when centering
on a secondary screen and the primary screen has a different scale factor.
Task-number: QTBUG-49803
Change-Id: I91ec7c5348722a90012f80a247e662e96bcbb391
Reviewed-by: Alessandro Portale <alessandro.portale@theqtcompany.com>
Add two- and three-column layouts for the 'All C++ Classes'
list. Also affects the layout of 'All QML Types' page.
Task-number: QTBUG-49376
Change-Id: I80953c0955dbc37db5aa4c60eb9ea8e3023a77f2
Reviewed-by: Martin Smith <martin.smith@theqtcompany.com>
IFileSavePicker::put_DefaultFileExtension() fails when the '.'
is missing, causing the QtWidgets-based dialog to show up (Windows 10).
Change-Id: Ifcb870431b792ffa8e4a608dec999225e8383fa9
Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
Make it possible to pass arguments to the messages by
introducing variadic macro versions of RETURN_[]_IF_FAILED.
Change-Id: Iec27adb33d9d3211fdc299f07777fcdf33f08a93
Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>