Commit Graph

20542 Commits

Author SHA1 Message Date
Aki Koskinen
a3b88a0025 Improved documentation for QStyledItemDelegate::eventFilter
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>
2014-09-15 15:58:06 +02:00
Oswald Buddenhagen
1da57ecd06 fix bogus library paths in ANGLE prl files
Task-number: QTBUG-41204
Change-Id: I3ddcba23467e7df3a4449c4960972f37810ed323
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
2014-09-15 15:58:03 +02:00
Joerg Bornemann
f5b53c8e3e add missing DefaultLanguage property for WinRT projects
Task-number: QTBUG-37628
Change-Id: I7cce0641b8958fe1d97ace21cb5392e32a067649
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Oliver Wolff <oliver.wolff@digia.com>
2014-09-15 13:32:08 +02:00
Robin Burchell
1c4786389d QDateTime: Micro-optimize by using QString::fromLatin1 instead of QString::fromUtf8.
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>
2014-09-15 12:33:08 +02:00
Robin Burchell
5857809cc5 QDate: Micro-optimize for fromStringIso benchmark.
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>
2014-09-15 12:32:52 +02:00
Tim Blechmann
739f98aa09 cocoa: fix namespace manging for QNSView
Change-Id: I83035b45cabd938a9fdfa3a5d12de2c1793b30b3
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
2014-09-15 10:29:38 +02:00
Tim Blechmann
1126701f8c cocoa: don't override NSApplication-sendEvent if configured as AA_MacPluginApplication
Change-Id: I48cebbcb814ee8e97583c3165e7cb668077cfbad
Task-number: QTBUG-40409
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
2014-09-15 10:29:25 +02:00
Alexander Volkov
256df2484c Make the default value of QTreeView::indentation() be style dependent
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>
2014-09-15 10:05:25 +02:00
Samuel Gaist
897346604e QTextDocument: code cleanup
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>
2014-09-15 09:36:16 +02:00
Samuel Gaist
eb5dc9ed1c QTextDocument: Correct parameter documentation
Change-Id: Ie91aa2731732e4a6a1abdc2fc7ae00876c5d76e2
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-09-15 09:36:05 +02:00
Samuel Gaist
d3a5321e57 QTextDocument: doc and function parameter name cleanup
Change-Id: Idecdf66da0d00cbede6ca5b742d10cf536f366d2
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2014-09-15 09:35:51 +02:00
Samuel Gaist
4066a6a893 Add QRegularExpression support to QTextDocument
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>
2014-09-15 09:35:47 +02:00
Lars Knoll
0c748fb7b1 Fix 64 bit issues in QIODevicePrivateLinearBuffer
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>
2014-09-15 08:08:42 +02:00
Laszlo Agocs
0f92875891 Use default surface format in QOffscreenSurface
Change-Id: I3b2f790089e6d1bcfe92f2f732489c08afa766cd
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
2014-09-14 12:17:27 +02:00
Jake Petroules
4e8720d413 Use new, supported APIs in OS X 10.10 and iOS 8.0 to get the OS version.
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>
2014-09-12 22:01:58 +02:00
Dong-Heon Jung
992baedb8b QNetworkDiskCache: fix expiration calculation heuristic with Last-Modified time
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>
2014-09-12 17:51:48 +02:00
Mitch Curtis
f1093e06b2 Fix typos in Widgets Tutorial.
Change-Id: Id4a0bef3b00f3869582e76ee45f230120189a268
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2014-09-12 15:27:45 +02:00
Allan Sandfeld Jensen
fac71528cc Read and use WheelScrollLines configuration on KDE
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>
2014-09-12 11:46:59 +02:00
Tim Blechmann
c8d2514347 QGuiApplication: clear font database on cleanup
Change-Id: If196c5e93b7ed68c6a0f6be7414f9efc8195f168
Task-number: QTBUG-40865
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
2014-09-12 11:14:57 +02:00
Lars Knoll
2de8fb5a6c Force a full layout on the frame if it's vertical geometry changes
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>
2014-09-12 10:53:07 +02:00
Marc Mutz
2ad5d62f11 Micro-optimize qt_section_chunk ctor
Use C++11 move semantics, and the ctor-init-list.

Change-Id: I1a5faa83ef552e8d98ce994edf967770a73cab0e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2014-09-12 10:00:30 +02:00
Marc Mutz
b53bf377a9 tst_QString: also test section(QChar) overload
Change-Id: I5d631cdd33501ac10e3e4184518d3c70b20984d7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2014-09-12 10:00:22 +02:00
Marc Mutz
50b34f2a5a QPainter: use qEnvironmentVariableIsEmpty()
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>
2014-09-12 10:00:16 +02:00
Marc Mutz
0a5a41d9a4 QImageReader: use qEnvironmentVariableIsEmpty()
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>
2014-09-12 10:00:10 +02:00
Marc Mutz
d2ba9d0962 QIcon: use qEnvironmentVariableIsEmpty()
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>
2014-09-12 10:00:05 +02:00
Marc Mutz
e8aa70c2d6 QFileSelector: use qEnvironmentVariableIsEmpty()
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>
2014-09-12 09:59:59 +02:00
Marc Mutz
aac6cda804 QWheelEvent: make magic number 120 a symbolic constant
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>
2014-09-12 09:59:18 +02:00
Marc Mutz
f826039e09 QGraphicsView: use qEnvironmentVariableIntValue()
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>
2014-09-12 09:59:11 +02:00
Marc Mutz
099f188bc8 xcb: use qEnvironmentVariableIntValue()
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>
2014-09-12 09:59:06 +02:00
Marc Mutz
dcb48c6dc6 WinRT: use qEnvironmentVariableIntValue()
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>
2014-09-12 09:59:01 +02:00
Marc Mutz
1dce3b7d11 QNX: use qEnvironmentVariableIntValue()
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>
2014-09-12 09:58:56 +02:00
Marc Mutz
0a94712ad5 QMinimalIntegration: use qEnvironmentVariableIntValue()
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>
2014-09-12 09:58:51 +02:00
Marc Mutz
b3b29c2592 QKmsScreen: use qEnvironmentVariableIntValue()
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>
2014-09-12 09:58:45 +02:00
Marc Mutz
9b62d37894 eglfs: use qEnvironmentVariableIntValue()
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>
2014-09-12 09:58:40 +02:00
Marc Mutz
4aba06aa47 Android: use qEnvironmentVariableIntValue()
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>
2014-09-12 09:58:34 +02:00
Marc Mutz
6bc9e44433 QEvDevTouch: use qEnvironmentVariableIntValue()
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>
2014-09-12 09:58:28 +02:00
Marc Mutz
6d3e9be1d2 QFbVtHandler: use qEnvironmentVariableIntValue()
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>
2014-09-12 09:58:22 +02:00
Marc Mutz
f88c5415ff eglconvenience: use qEnvironmentVariableIntValue()
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>
2014-09-12 09:58:15 +02:00
Marc Mutz
9f0d5b3b6c QPainter: use qEnvironmentVariableIntValue()
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>
2014-09-12 09:58:06 +02:00
Marc Mutz
a24566a338 QHash: remove unnecessary #ifdef
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>
2014-09-12 09:57:59 +02:00
Marc Mutz
d04c2fbc1d QPainter: drop a pointless check
There's no need to check for nullptr before invoking delete.

Change-Id: Ied751f76f15f390bf86bbba53c14a3e450aa81e8
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
2014-09-12 09:57:52 +02:00
Marc Mutz
44f65a0650 QPainter: use qDeleteAll()
Change-Id: I167e4d7a57e92eb5ea7c39b04246ac2f44c91de0
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
2014-09-12 09:57:43 +02:00
Marc Mutz
b1a8d48e37 QLibrary: simplify qt_debug_component()
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>
2014-09-12 09:57:34 +02:00
Marc Mutz
699df74197 QLibrary: use qEnvironmentVariableIntValue()
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>
2014-09-12 09:57:26 +02:00
Marc Mutz
bb56586e32 Add qEnvironmentVariableIntValue()
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>
2014-09-12 09:57:16 +02:00
Giuseppe D'Angelo
6be26d9051 QRegularExpression: more QStringRef tests
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>
2014-09-12 08:33:12 +02:00
David Faure
de4cad945d QAbstractItemView: add iconSizeChanged signal.
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>
2014-09-12 02:07:48 +02:00
David Faure
31c6d9f04b QTextStream: add fast path for writing char and QChar.
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>
2014-09-12 02:07:36 +02:00
Andreas Hartmetz
33e7093a84 Set WINDOWPLACEMENT::length as required by the documentation.
Found this while debugging something else in Dr. Memory.

Change-Id: Id295ddf4e07088684ecf91e3c2e0a156bf6054cb
Reviewed-by: Andrew Knight <andrew.knight@digia.com>
2014-09-11 23:14:25 +02:00
Allan Sandfeld Jensen
294e65f809 QVariant::compare shouldn't return match when QVariant::cmp does not
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>
2014-09-11 23:05:35 +02:00