Added the notion that enter and return keys are not handled
if editor is of type QTextEdit or QPlainTextEdit.
Change-Id: I9d5cb529bf154c687fab1949fccf37e9da096c85
Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
Reviewed-by: Jerome Pasion <jerome.pasion@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>
Add a new PM_TreeViewIndentaion enum value to QStyle and get
the corresponding pixel metric in QTreeView.
[ChangeLog][QtWidgets][QTreeView] Indentation is now style-dependent by default.
[ChangeLog][QtWidgets][QTreeView] Added resetIndentation().
Change-Id: Ifad7987b8f3c6cd32987b89d95390f33043d8f19
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Adam Majer <adamm@zombino.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>
The API was using int, not qint64 leading to implicit
truncation of numbers in a few places
Task-number: QTBUG-40974
Change-Id: I13aedc84557a19b6f74fe6825764e7b5827f27b0
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@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>
Heuristic with last-modified time in Qt has some problems.
1) Remove redundant expirationDate.isInvalid() check
expirationDate.isInvalid is already checked. So I removed.
2) Add dateHeader.isInvalid() check
The dateHeader is used in expiration calculation.
I add invalid check for the dateHeader.
*. The dateHeader is the origin server's Date
3) Change diff time calculation.
The expirationDate is calculated with time diff.
Previous calculation is
// The lastModified is earlier than the currentDateTime.
// The diff has negative value.
int diff = currentDateTime.secsTo(lastModified);
// The expirationDate is earlier than lastModified
// , currentDateTime and dateHeader.
expirationDate = lastModified.addSecs(diff / 10);
*. currentDateTime: current time
*. lastModified: last modified date in server
It means that files are not cached with the heuristic.
I changed diff calculation.
int diff = lastModified.secsTo(dateHeader);
freshness_lifetime = diff / 10; // RFC 2616 13.2.4
4) httpRequest.headerField setting
If current_age is larger than 1 day, the cache MUST attach Warning 113.
*. The current_age is value of age in header
or elapsed time from dateHeader in Qt source code.
Previous code does not check current_age is larger than 1 day correctly.
// dt = 1970-01-01T00:00:00 + current_age
dt.setTime_t(current_age);
// currentDateTime is much bigger than 1970-01-01T00:00:00
if (dt.daysTo(currentDateTime) > 1)
Task-number: QTBUG-40836
Change-Id: I4b00c3b287e6fafeea6b02681533fe75a198247e
Reviewed-by: Jung Dong-Heon <dongheon.jung@lge.com>
Reviewed-by: Peter Hartmann <phartmann@blackberry.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>
When the frame's vertical geometry changes because top/bottom
margins, border or padding changes we need to do a full relayout
of the frame to position it correctly.
Task-number: QTBUG-2975
Change-Id: Ia0f063cc2057b6d7a469977d258ec1608feff9bf
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.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>
Found this while debugging something else in Dr. Memory.
Change-Id: Id295ddf4e07088684ecf91e3c2e0a156bf6054cb
Reviewed-by: Andrew Knight <andrew.knight@digia.com>
If the types doesn't match in QVariant::compare we do a comparison based
on QString, this may end up indicating a full match, though the we don't
match according to cmp. In this case it would be better if we preserved
the non-matching to avoid breaking ordering.
[ChangeLog][QtCore][QVariant] Fixed ordered comparison between QVariants
that do not match but produce identical toString output.
Task-number: QTBUG-40363
Change-Id: I84a8eca11e8875dba9948bde2906ae7c5aa35704
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>