Just iterate over the container instead, saving one
iteration and the creation of a temporary QList.
Change-Id: I564e3e83cb247a12c413fc5a9dc17299ae089e30
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Don't perform lookup twice. Just cache iterator
or position.
Change-Id: I454fd292614dee62167ff248fc3ddec0f79435b0
Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Three hashes are handled similarly; so extract the loops over them as
methods hasUsedConfiguration() and cleanUpConfigurations() to avoid
duplicate loop code.
Change-Id: I1040724c4fc98caa48913fac339c03e60b04bae2
Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
These are already held in QVectors.
Public API types need to wait until Qt 6, for BC reasons. Even
though Q_RELOCATABLE_TYPE deals with most of them, we lack a way
to mark a type as primitive, but still isStatic - for QList.
Change-Id: I91392b01ae6f94cc847007636e12d4e64c43b2bc
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
Change-Id: I5f8d72742cc4199bfa73df6037b851c58632ff86
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com>
For the remote X case the backing store previously always reuploaded
image data for every expose event. Instead of doing that create a remote
X pixmap and only flush repainted regions. For regular expose just copy
from the pixmap.
Additionally, atomically update the window by setting a clip mask and
flushing the entire region at once instead of doing it rect by rect.
Change-Id: I26bb1834b159e309c7ad93287dd297769f7e2633
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
It has a variant accepting QL1S directly, so
no need to go via a QString.
Change-Id: Ia8f1198ef2af7027bc9f7c2e1dad3a5f78a12eb4
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com>
Marking them shared (which implies movable) now
would make QLists of these BiC.
Change-Id: If5638e8d9f43e0ad549aedf08934de31e1e189f1
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
Extract a loop repeated four times in the code into a
separate function. Port to use C++11 range-for loops
and not create temporary QLists.
Saves 2.4KiB in text size on optimized GCC 5.3 Linux
AMD64 builds.
Change-Id: I7eb78ffaac33627b595e35cafb6ce0769fb760a8
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Use new QUtf8::convertToUnicode(QChar*, const char*, int)
overload instead of QString::fromUtf8(). The QUtf8 overload
allocates no memory, and is therefore marked as nothrow.
Using this function in convertFromAscii() allows to mark
this function nothrow, too.
All functions of QAbstractConcatenable can now be marked as
nothrow.
Since QUtf8::convertToUnicode() does not deal with lengths
of -1, insert a strlen() call when the len == -1 ASCII fast
path fails due to non-ASCII chars.
Saves 1.1KiB in text size on optimized GCC 5.3 Linux AMD64
builds of QtCore (other libraries are compiled without
exceptions, so this change should not have an effect on
those).
Change-Id: I7333e35844033831eae2a04203d13d9792c5d460
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Change-Id: I6864e227fceb133903979ac8f7a7434fc3e280bf
Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com>
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
The function resolving changes remove the special treatment for ES 3.0+
contexts, meaning that now all functions get resolved in the same way
irrespective of the current context.
For blitFramebuffer and renderbufferStorageMultisample this presented an
issue with ANGLE. There these functions are available both as an ANGLE
extension and as standard ES 3.0 functions. The latter are not functional
however in 2.0 contexts. We expect multisampled FBOs to work in 2.0
contexts too by prefering the ANGLE extension with 2.0 contexts.
Change-Id: I0a4b70e6d39c84d4b1f61f8fd0655d7326419a2a
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Always try both e/wglGetProcAddress and ::GetProcAddress to
resolve the methods. Like this QOpengGLContext::getProcAddress is
able to return any OpenGL entry point, and we can both simplify
the code we have in the QPA backend as well as get rid of windows
specific code paths in Qt Gui.
Task-number: QTBUG-39531
Change-Id: I1ddf1b0974f69b56b219a619655b723eb0134b14
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
When "importing" the size hints into the cells, make sure that
the cells minimum sizes are ceiled up to the closest integer.
Change-Id: Id00177468e8b1e12bc1231c7351b2136f94f7300
Task-number: QTBUG-41216
Reviewed-by: Paul Olav Tvete <paul.tvete@theqtcompany.com>
Saves some code, is easier to maintain and will allow for some
more nice refactoring.
Change-Id: Ica7ae8e9d36acbe6586e488bc6aff114336c65bb
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
Verify that the temporary directory could be created. Check whether
the gtk-update-icon-cache binary exists before running and skip cleanly.
Check successful execution. Fixes Windows warnings:
SKIP : tst_QIcon::fromThemeCache() gtk-update-icon-cache not run
.\tst_qicon.cpp(707) : failure location
QWARN : tst_QIcon::fromThemeCache() QTemporaryDir: Unable to remove "D:\\temp\\tst_qicon-DSSn9G" most likely due to the presence of read-only
files.
Change-Id: Ibc8f883121e62b30d71586bc64b42eb6c480925f
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Calling qMin often prevents effective vectorization, and it is only
necessary when converting from formats with mixed color-channel widths.
Change-Id: I2a0f3f3fb528d45be1fd025758f9d915ee1736c0
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
Inherit the type-classification from the underlying type,
but, for BC reasons, force isStatic = true, so QList does
not change its memory layout in an incompatible way.
Change-Id: I11003cdd24968f903fbd86aa2f5c17287e057c1f
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Change-Id: Ifcad547caf2d2a7ad7aa1ccb4fbed08810905cee
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
Remove the different flags when trying to resolve opengl
functions. Rather we simply try hard to find a matching method
by resolving over possible suffixes when we can't find the standard
name.
Change-Id: Ic73085faec3bd406f5214ed4219eb7b796651d8d
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
Similar to the parent commit, this reduces binary size significantly.
Change-Id: Idd6753ec5e04ec84d93bf6f86b5c71550b90ae9b
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
Use a similar mechanism as in QOpenGLVersionFunctions and resolve
the methods in a loop. This requires some macro magic but significantly
reduces the size of the generated code.
Change-Id: If5f5e5551af0d1aed4b4ce7ce82932d8988dab59
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
The old Resolver class to resolve GL symbols is not
being used any longer, get rid of it.
Change-Id: I835860eb1c42aea05458ca32cf652659500312da
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
Since the backends can now resolve all possible GL
functions, there's no need for the special handling
for GLES that this class did anymore.
Change-Id: Ib48aecc9a892f3c883d76ffc82217f346dbb3adc
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
This is required to simplify our code in the opengl classes
and makes it possible to remove OS dependent code paths in
Qt Gui.
Change-Id: Ice09440840c86b2d6ac8d3955d273846695338d4
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
Remove the wrapper methods resolving themselves at first run
also here and instead resolve all GL entry points when the
QOpenGLExtraFunctions object gets constructured.
Keep the gles3helper for now until all backends are fixed
to be able to resolve these methods directly.
Change-Id: I194bd4465605f57d27c79808a016592c101ac04c
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
Saves another 20-30k for QtGui
Change-Id: I2a6980713ab1c45144c70ba9835c6e85f736279b
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Add an getProcAddress(const char *) overload to QOpenGLContext,
and refactor the QPA interface to take a const char *. Like this
we can avoid lots of mallocs when resoving GL methods.
Change-Id: Ic45b985fbaa0da8d32ba3e3b485351173352ca6f
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
We already have these symbols resolved in QOpenGLFunctions,
so simply use those.
Change-Id: I6047181dbe47be9b0a83656af454d0ca1f3df6eb
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Directly resolve the GL symbols in the constructor instead
of wrapping them in another method that resolves on
first call.
Simplifies the code and reduces the the size of QtGui
by around 50k.
Change-Id: If1fc575d0113d3d9b48ad1918429254c827e42c7
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
They are private classes and only called from non inline code in
Qt, so the change is safe.
Reduces the size of QtGui by another 10k.
Change-Id: I67e0592089b9ac89d3f2ab4456024ad7c5a55eca
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Use some macro magic to declare the opengl symbols and use that
to call getProcAddress in a loop instead of doing it individually
for each method.
Cuts the amount of generated object code down from 300 to around 50k.
Change-Id: I386d278fde41a1a30827c6232e79f9156090f8b0
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Saves around 200k in QtGui.so.
Change-Id: I1a020445093a5612ed64ca98bf51435580478cda
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
These four methods do not need to be separate, the compiler can figure
generate the optimal version from the template arguments.
Change-Id: I45b30a9c2f2ce4da46c47f2e6e1fbd7561213c4a
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
Using shuffle and align storing our quint24 format can be done much
faster. This in particular improves conversions to RGB888.
Change-Id: I179748706a33a43fd6f60f5c40287317418c8867
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
The fonts directory is removed in 5.7. Avoid creating a broken
symlink.
Change-Id: I95d1970737f54810006c084436411fc95743f72d
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
This issue is reproducible on OS X when using a Magic Mouse
or a combination of Magic Trackpad and regular mouse. In these
cases it's possible to start a scrolling gesture on one widget
and move the mouse cursor over another widget.
Although we send the wheel event phase information, we never
made any use of it. This means that a widget would start
scrolling even though it never received a ScrollBegin event.
In this patch, we make sure the scrolling cycle is respected
and that once a widget starts scrolling, it'll be recieving
all the wheel events until a ScrollEnd event reaches the
application.
For those input devices not supporting a proper phase cycle,
we introduce a new (undocumented) phase value, NoScrollPhase.
If the wheel event phase is NoScrollPhase, then we ignore
the current scroll widget and proceed as usual. This value
is the default for wheel events. It's up to the platform
plugin to set the proper phase value according to the data
received from the OS.
Finally, we fix a few of QWheelEvent constructors to properly
initialize the phase and source properties.
Task-number: QTBUG-50199
Change-Id: I3773729a9c757e2d2fcc5100dcd79f0ed26cb808
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
... by replacing them with C++11 ramge-for loops.
In one case, I took the liberty to remove a useless
if(isEmpty()) check around a for loop. Now that we
don't use Q_FOREACH anymore, we don't incur the copy
for empty containers anymore. Left the indention of
the loop level to avoid code churn.
Saves 1.8KiB in text size on optimized GCC 5.3 Linux
AMD64 builds.
Change-Id: I1b1fb34847f6a631f0d580fd5261c7f5fed8475c
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
This is what std::vector implementations usually do,
because it minimizes memory fragmentation and useless
allocations since no user will call clear() unless
she intends to append new data afterwards.
Fix calls to resize(0) that show how existing code
tried to work around the issue.
Adjust test. Port from QVERIFY(==) to QCOMPARE as a
drive-by.
[ChangeLog][QtCore][QVector] clear() now preserves
capacity. To shed capacity, call squeeze() or swap
with a default-constructed QVector object, see the
documentation for an example.
Change-Id: I9cebe611a97e027a89e821e64408a4741b31f1f6
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
... by replacing them with C++11 range-for loops.
This is the simplest of the patch series: Q_FOREACH took a
copy, so we do, too. Except we don't, since we're just
catching the return value that comes out of the function
(RVO). We can't feed the rvalues into range-for, because
they are non-const and would thus detach.
Saves 2.2KiB in test size on optimized GCC 5.3 Linux AMD64
builds.
Change-Id: I914aa20fe65577b2e32ea7ea89d51a8d003a57ba
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Q_FOREACH over a QVarLengthArray or std containers
is a particularly bad idea (because of the deep
copy that Q_FOREACH then performs).
Use C++11 range-for (without qAsConst(), because
neither QVLA nor std containers are CoW).
Saves 5.7KiB in text size on optimized GCC 5.3
Linux AMD64 builds.
Change-Id: I4c1fb0b488bb08726912528b559840a45c1397df
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
`ar' tool from latest binutils shows warning:
ar error: `u' modifier ignored since `D' is the default (see `U')
Warning message includes word "error" so QtCreator processes it as
error in UI.
`ar' command-line option `u' might be dropped safely because it is
unnecessary. Option `c' is added to suppress extra `ar' warnings.
Other build systems are also affected. For example, automake:
https://bugzilla.redhat.com/1155273
Change-Id: Ia378b720503d93b0c0c12ae7a5f38f4d7c32eee5
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Given the flakyness of cursor positioning, loosen the check to only verify
that the cursor is outside the window. The hint is only active on Windows
depending on a system setting.
Task-number: QTBUG-51516
Change-Id: I474d251cc41e68f182baf8dba84eaf38d914d7ee
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
The algorithm used was:
- If possible, just declare the container const
- Otherwise, for first()/last(), use constFirst()/constLast()
and for front()/back(), to not destroy the use of the STL
API subset, use qAsConst()
Did some caching of function returns here and there, and
converted one 0 to nullptr as a drive-by.
Also saves almost 4KiB in text size on optimized GCC 4.9
Linux AMD64 builds.
Change-Id: I04b7bfd68dc85c22de247cb65a310e1cbbca1e8c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>