Translation is an expensive thing, and probably quite uncommon - so don't
penalise any common cases by checking for it until we're quite sure they have
failed.
In addition, we avoid repeated string construction when translating (caching the
result) and avoid repeated case-insensitive comparison by toLowering the string
data.
This change either speeds up most runtime cases that were unfairly penalised
(such as "light") by 50-70% or doesn't impact the runtime speed at all (or,
results were within the margin-of-error).
Of course, calling with translated content will be a bit slower now, but the
slowness of the translations should more than dwarf the real change there.
Change-Id: If24685dfd553e4aed07fbf07678b2585e22b0a3a
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
This data is clearly not (and will never be) utf8 data, so using fromLatin1
avoids the (slightly more expensive) utf8 mangling.
I didn't see any significant impact on benchmarks, but I also wasn't
specifically collecting data when making this change.
Change-Id: I45190d40b2caccf15b1f9a1ae5b7dcd08cbd541f
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
By using QStringRef instead of QString, we avoid a data copy. This takes the
QDateTime::fromStringIso benchmark from 0.79ms to 0.53ms for me.
Change-Id: Ibb36067491ffc275ce3b667cb0e04941aa9457f0
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Improve code readability using by-pointer rather than
by reference out argument.
Change-Id: Icf2d609f1b63feac7b1674b357fe64473bfa8f3f
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Change-Id: Ie91aa2731732e4a6a1abdc2fc7ae00876c5d76e2
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Currently QTextDocuement only provides find using QRegExp. This patch
aims to add support for QRegularExpression.
[ChangeLog][QtGui][QTextDocument] Support for searching with a
QRegularExpression in a document has been added.
Change-Id: I6dba10545b83995d093407038a821fe54db3d261
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Gestalt is deprecated so we can't use it long term. At the same time,
the new API is cross platform, so we'll no longer have to parse strings
in -[UIDevice systemVersion] either.
Change-Id: Ic81797174c1a3d50b47b9b209205a6a506cc75ef
Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
Qt supports changing the default lines a scroll wheel click scroll, but
wasn't trying to read the system settings. The patch adds support for
platform themes to set the default.
Change-Id: I53fdcec7984941d1d1285d927d70460356613f81
Reviewed-by: Kevin Ottens <kevin.ottens@kdab.com>
Reviewed-by: David Faure <david.faure@kdab.com>
Use C++11 move semantics, and the ctor-init-list.
Change-Id: I1a5faa83ef552e8d98ce994edf967770a73cab0e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
It doesn't allocate memory, so cannot throw and is a lot faster
than qgetenv().
Change-Id: I1ac14bb3d262201071025a885633886934f2d74c
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
It doesn't allocate memory, so cannot throw and is a lot faster
than qgetenv().
Change-Id: I92805767b55adce478a4bf8eb1cbafaa544f96aa
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
It doesn't allocate memory, so cannot throw and is a lot faster
than qgetenv().
Change-Id: I427aa5bf5b8d76aabdd5ce5950e9e6762f79b8d8
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
It doesn't allocate memory, so cannot throw and is a lot faster
than qgetenv().
Change-Id: Ib303f00ce45816677ffca0580cc6b91a14a0e5be
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
The documentation states that 120 is the value users of
the event should use to determine one full step of the
wheel. Provide that number as a symbolic constant.
Change-Id: I0da0cdd8328a476538080b7276d02863906ea53f
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
It doesn't allocate memory, so cannot throw and is a lot faster
than qgetenv().
Change-Id: I774ae9011b855f746b5e3fdf25995d81ec60b82a
Reviewed-by: Andreas Aardal Hanssen <andreas@hanssen.name>
It doesn't allocate memory, so cannot throw and is a lot faster
than qgetenv().
Change-Id: Ie625d79352fa166e45939ef8f0a5e0cc32f8e801
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
It doesn't allocate memory, so cannot throw and is a lot faster
than qgetenv().
Change-Id: I73d548ad4e25424fc41722961f527e63632a7b56
Reviewed-by: Andrew Knight <andrew.knight@digia.com>
Reviewed-by: Oliver Wolff <oliver.wolff@digia.com>
It doesn't allocate memory, so cannot throw and is a lot faster
than qgetenv().
Change-Id: I211d6de32da06bf465c4f721f39d73289206745f
Reviewed-by: Alan Alpert <aalpert@blackberry.com>
It doesn't allocate memory, so cannot throw and is a lot faster
than qgetenv().
Change-Id: Idaad6ec1d92d9aa58d61e2d98e136f108be2bb4c
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
It doesn't allocate memory, so cannot throw and is a lot faster
than qgetenv().
Change-Id: Iaaba62396de2d70f611bfa2ba5badb070087fa24
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
It doesn't allocate memory, so cannot throw and is a lot faster
than qgetenv().
Change-Id: I4c43809954ed720de95b3056c13bf520577e3280
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
It doesn't allocate memory, so cannot throw and is a lot faster
than qgetenv().
Change-Id: I6d79852613228658f9093a272edf9b434e60286c
Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
It doesn't allocate memory, so cannot throw and is a lot faster
than qgetenv().
Change-Id: I64de0b2644c50469a35fdba9ecde167862975b79
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
It doesn't allocate memory, so cannot throw and is a lot faster
than qgetenv().
Change-Id: I18c00da9504dd3744e6fbb23ea9b9fb7c6d669c9
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
It doesn't allocate memory, so cannot throw and is a lot faster
than qgetenv().
Change-Id: Id50609c1f3511287d99e24b03e48c0a254893194
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
It doesn't allocate memory, so cannot throw and is a lot faster
than qgetenv().
Change-Id: Ie41b95c09f2c6106a6683ba4637513c974555840
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
There's no need to use a macro here, since we can just store
the pointer value in a qulonglong and have the second shift
operation be done unconditionally. For 32-bit platforms, it
will yield 0, and xor'ing it into 'seed' will have no effect.
Change-Id: I3e63bd504e81c84d13935d5503c3707d40d74d6f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
There's no need to check for nullptr before invoking delete.
Change-Id: Ied751f76f15f390bf86bbba53c14a3e450aa81e8
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
Instead of initializing debug_env to -1 (thus forcing the variable
into the data segment), and then overwriting the -1 with a read
from the env-var, dynamically initialize the variable from the
env-var directly, thus allowing the variable back into the bss
segment (which doesn't occupy storage in the executable).
There may have been a reason to do it this way when the old code
could fail due to the memory allocation involved, but now with
qEnvironmentVariableIntValue(), that is no longer a reason.
Change-Id: I9f21b0783ff348f50b574395fc07f2869a14102e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
It doesn't allocate memory, so cannot throw and is a lot faster
than qgetenv().
Change-Id: I8d440619edfbd90045564e1f92676f1e1f87e136
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
A lot of code in Qt uses VAR=1 for enabling or disabling some feature
or other, ignoring qEnvironmentVariableIsSet(), which was added for
that purpose. Other code actually reads numerical values from
environment variables. For both use-cases, provide a non-throwing,
non-memory-allocating way to get the numerical (int) value of an
environment variable, complementing qEnvironmentVariableIs{Set,Empty}().
[ChangeLog][QtCore] Added qEnvironmentVariableIntValue().
Change-Id: I81c85287ea10d355c1bbf8d7807ec9a0e477bce0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
So far we've only tested matching against QStringRefs which were
spanning the entire underlying QString. Instead, use the offset
matching to also perform tests using "proper" substrings.
Change-Id: Ia66e23f738b52997311ed2cf869e595079984292
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
This is useful when writing a generic preview-icon-generator which
should work with different type of views, itemviews and QML views.
A way to be notified of a change of icon size was missing on the itemview side.
[ChangeLog][QtWidgets][QAbstractItemView] Added iconSizeChanged signal.
Change-Id: I19b3049961002ca27d71aefbb6980d1e6f225c79
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Avoids allocating a QString for every char being written out.
The benchmark went from 5.5 ms per iteration to 0.8 ms,
and from 40 million instructions to 6 million.
Found using Milian Wolff's heaptrack tool.
Change-Id: I1784c47b944454bc947a607a22c39d249372ed55
Reviewed-by: Adam Majer <adamm@zombino.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
QIODevice makes readData() call only when its read buffer is empty.
Also data argument points to the user or reserved read buffer area.
So, no need in data transfer from read buffer at this point at all.
Change-Id: Ieb4afdf7eec37fdf288073e4a060e64424f22b9c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
If you configure QOpenGLWidget to use sampling, the 'resolvedFbo' isn't
updated during resizing. This leads to garbled views.
Change-Id: I9f9265520134bcf12436778773507df936c5fbb6
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
According to the XDND standard (http://www.newplanetsoftware.com/xdnd/)
if the proxy window exists then it should be checked for the XdndAware
property rather than the target window directly.
c3f9de6296 introduced the mistake.
In the old code the proxy window was used.
Change-Id: I83b66d4b1f08a1f44d5c1451d0f1735c084bcf09
Spotted-by: Alexander Smirnov
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
In both cases theme.rect calculated right after the
"sub & SC_ScrollBarSlider" test.
Change-Id: I9fa0c4e1327e68b4184674a13e7a4bf362f8deff
Reviewed-by: Adam Majer <adamm@zombino.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
If defined, the value of this variable is prepended to the built shared
library's SONAME identifier.
For more information, see: qmake/doc/src/qmake-manual.qdoc#qmake-soname-prefix
Task-number: QTBUG-31814
Change-Id: I4bceaf0c93162e4fad6bb424af1b82e74d38acdc
Reviewed-by: Jake Petroules <jake.petroules@petroules.com>
QOpenGLWindow already has some notes regarding this. It must be
mentioned in QOpenGLWidget too.
Change-Id: I0af90c9410a1c44cb9dd9ce58aa0371a58c57f65
Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
Make it clear that the class is usable regardless of the OpenGL version
the app is targeting. It may just do nothing.
Change-Id: I50e68a46e36ef1f4694016311af93c6f8719ce4f
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>