Commit Graph

20042 Commits

Author SHA1 Message Date
Timur Pocheptsov
5ec108eb7a Cocoa integration - handle didResignKey correctly
When we receive didResignKey notification, before setting active window to
null we check that [NSApp keyWindow] is nil, but it's not. At the same moment,
[NSApp keyWindow] == windowNotification.object - so it's indeed the window that
resigned the key status, it's just NSApp keyWindow that is not nil yet.

Change-Id: Iedc85d806c7d583a2054dc4d7168af13c9c7a4e0
Task-number: QTBUG-49925
Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
2016-02-24 09:05:44 +00:00
Timur Pocheptsov
2613317512 QCocoaFileDialog - disclose accessory view
Since 10.11 accessory view is hidden by default (making file filters invisible).
Setting accessoryViewDisclosed = YES solves this problem.

Change-Id: I140347b850645df613f6e818fab1c3d35ec0a473
Task-number: QTBUG-50086
Reviewed-by: Jake Petroules <jake.petroules@theqtcompany.com>
2016-02-23 14:53:42 +00:00
Dan Cape
57a1224eb3 PlaceHolderText doesn't appear in RTL
Since placeholderText was using the layoutDirection from the control,
it was always getting LTR since there was no text added yet to the
control. By calling the isRightToLeft function on the placeholderText,
we can determine if it is RTL or not and apply that when drawing the
placeholderText. A change was also made to use the proper elide mode
depending on if it is LTR or RTL.

Task-number: QTBUG-36499
Change-Id: Ic4c9cb9b41d9180185ed35492518152c1122839f
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
2016-02-23 14:38:59 +00:00
Marc Mutz
20af1ad7ef QInputMethodEvent::Attribute: add ctor that doesn't take a QVariant
Many callers passed QVariant() as the last ctor argument.
Micro-optimize by providing an overload that default-
constructs the variant in-place.

Change-Id: I9aab40c6e5a025c9a502c706e4cc7b10879ac418
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Takao Fujiwara <takao.fujiwara1@gmail.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-02-20 13:35:55 +00:00
James McDonnell
d87242968f Move __cpp_constexpr check inside Q_COMPILER_CONSTEXPR check
Q_COMPILER_CONSTEXPR can be undefined (or not defined at all) to
indicate that constexpr should not be used regardless of the compiler's
ability to support it.  This is done for QNX because some C library
floating point functions used in the Dinkumware C++ library aren't
constexpr functions; i.e., the library doesn't have proper constexpr
support even though the compiler does.

Change-Id: I16918bbceac1e20b67c6ddbda28df3d9758bab83
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-02-20 00:12:58 +00:00
Marc Mutz
1da975cdc5 QLatin1String: add at()/op[]/mid()/right()/left()
QLatin1String can be used as a string-view-like type.
When attempting to do so in uic, mid() and at() were
found to be missing. Added the others for completeness.

Use the new functions in uic, for which they were
originally conceived.

[ChangeLog][QtCore][QLatin1String] Added at(),
operator[](), mid(), right(), left().

Change-Id: I4cfe3e9ed1157dedee754b2012d9678fe72b161e
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-02-19 18:16:38 +00:00
Marc Mutz
342acf66fe uic: optimize string handling in WriteInitialization::acceptWidget()
Instead of building QStringLists out of statically-known
US-ASCII strings, use C arrays of QLatin1String instead.

QLatin1String is constexpr, so these tables, while causing
relocations, do not require runtime initialization.

Using QStringBuilder, these QLatin1Strings are almost a
drop-in replacement for the QStrings used before.

Effects on optimized GCC 5.3 Linux AMD64 builds:

  $ size bin/uic-*
     text    data     bss     dec     hex filename
   567104   31776      56  598936   92398 bin/uic-00-before
   565829   31944      24  597797   91f25 bin/uic-01-after

Change-Id: I469c62b0e8966731d7ac2fa092f4b4cd8ddb79f1
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-02-19 18:11:55 +00:00
Simon Hausmann
bcc965ef4b Merge remote-tracking branch 'origin/5.7' into dev
Change-Id: I7bee7df50af3d607a349b68103cd2c67791281fb
2016-02-19 12:02:49 +01:00
Jake Petroules
d40aca0840 Factor out usage of a private symbol by the iOS platform plugin.
This fixes a link error due to symbol visibility when the iOS
platform plugin is built as a shared library.

Change-Id: I0b454c5c5033c6b598cede11ce5e3a85e5704c4a
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
2016-02-19 04:14:29 +00:00
Friedemann Kleint
9b49b375e3 Windows QPA: Fix warnings as shown by Qt Creator's Clang based code model.
Fix warnings in file qwindowswindow.cpp. Remaining part of a refactoring
done in the 5.6 branch.

Task-number: QTBUG-50804
Change-Id: I4d7b423e0802ac39109c30c0de615664d3ee9216
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
2016-02-18 22:53:49 +00:00
Peter Kümmel
d562c7761e Fix typos in qOverload documentation
Change-Id: I92f99623f659543934c52961307b0b53c8520948
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-02-17 22:41:32 +00:00
Marc Mutz
aae362e2fe QDirModel: replace an inefficient QList with QVector
SavedPersistent is larger than a void*, so holding it in QLists
is needlessly inefficient. Worse, the code could come to depend
on the fragile property of (inefficient) QLists that references
to elements therein never are invalidated.

Fix by marking it movable and holding it in a QVector instead.

Take advantage of rvalue-enabled QVector::push_back(); optimize
element construction by using aggregate initialization.

Change-Id: I4fd88879aa13e6536d59d164b3c33fbc2fead77f
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-02-17 19:45:02 +00:00
Oswald Buddenhagen
86c5a337e3 Merge "Merge dev into 5.7" into refs/staging/5.7 2016-02-17 19:57:54 +00:00
Oswald Buddenhagen
6620045fca Merge dev into 5.7
Change-Id: I5c60b4d9fd8355ddd49a01e21861f36afbbf889b
2016-02-17 18:26:22 +01:00
Marc Mutz
47ca3f7813 bearer plugins: fix uses of inefficient QLists
These types are larger than a void*, so holding them in QLists
is needlessly inefficient. Worse, the code could come to depend
on the fragile property of (inefficient) QLists that references
to elements therein never are invalidated.

Fix by marking them movable, and holding in a QVector instead.

Change-Id: I78774fc78d787241aaadc4f819b6d229e6200f46
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-02-17 16:52:15 +00:00
Marc Mutz
24a96e2a3e QtPrintSupport: convert some index-based into C++11 range-for loops
Also reserve a QList in QPrinter::supportedPaperSources().

Change-Id: I94d24b81d7adcad2b28d36efdbef5a8726412f1a
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-02-17 16:18:08 +00:00
Marc Mutz
7ca90e985c QSslSocket (OpenSSL): replace QList<QPair> by QVector<Struct>
A QList<QPair<int,int>> is one of the most dangerous ones, because
it fundamentally changes memory layout, and therefore performance
and invariants, when going from 32-bit platforms (array list) to
64-bit (vector-like).

Port to QVector instead, which has a consistent design across all
platforms.

Also port from QPair to a simple struct { code, depth }, because
member names such as 'first' and 'second' have no semantic value
and make code using them very hard to understand.

Change-Id: I86c95d78dbb2e82ec222d6eae8ba11568e3ff0af
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-02-17 16:17:58 +00:00
Marc Mutz
8049e9b3b9 QSslSocket (OpenSSL): use QMutexLocker
... instead of naked QMutex::(un)lock().

Change-Id: I9927e60286231bfc254d99cc88c39301b31df336
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-02-17 16:17:53 +00:00
Marc Mutz
6f7a5b0ecf QtSql: eradicate remaining Q_FOREACH loops
Change-Id: I86afe7104d506b840130517ae8066588fab2d745
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Reviewed-by: Mark Brand <mabrand@mabrand.nl>
2016-02-17 16:17:50 +00:00
Marc Mutz
88e043a8bd QOCIDriver: optimize string handling in tables()
- Instead of a QStringList, use a const char 2D array
  to hold the system user names. Don't remove the
  current user from that list, skip it duing processing.
- Extract Method make_where_clause, optimize it and
  cache its result. Instead of creating a QStringList
  and join()ing it at the end (sometimes twice), append
  to the result QString directly. Reserve the max size
  of the result string, which is statically known.
- Keep the query select statements in QLatin1String.
  They are only used in QStringBuilder expressions.

Change-Id: I0593d2812da671a541d49a6136f3ff3d784c63d5
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-02-17 16:17:46 +00:00
Marc Mutz
de8229f370 mimetypes: Declare some types as shared
It's private API, so we can.

As a consequence, had to add nothrow member-swap and, in
QMimeGlobPattern, remove the user-defined empty destructor
to un-inhibit the (nothrow) move special member functions.

Change-Id: If5bb72db3c823c7b0e372f9bec99c7242d11839b
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-02-17 16:17:43 +00:00
Marc Mutz
773458ad63 Remove QMimeMagicRule's pimpl
It didn't make the class implicitly shared, but required an
additional heap allocation on construction and copy, as it
used 'only' QScopedPointer. As it's private API the pimpl
is also not needed for BC reasons.

So inline the data members, and some trivial accessors.

As a by-product of removing the copy special member functions,
we gain nothrow move special member functions.

Interestingly, the memory layout of a QList<QMimeMagicRule>
(replacing which is the topic of a future patch) doesn't
change due to this change, because the type that formerly
fit QList very well now is too large. But copying the type
outside QList now no longer allocates memory.

Saves more than 2.5KiB in text size on optimized GCC 5.3
Linux AMD64 builds.

Change-Id: Ie3588cb5693227da6f1bfa196db924e075a750b3
Reviewed-by: David Faure <david.faure@kdab.com>
2016-02-17 16:17:37 +00:00
Marc Mutz
30b0c346ec QShortcutMap: re-use an existing bool variable
... instead of re-evaluating its expression. More readable.

Change-Id: I18c6ab3bbc4c5a14328f9910fab991f6cad5549d
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
2016-02-17 16:17:32 +00:00
Marc Mutz
4262f31330 QDaemonThread: replace a function pointer with a lambda
Saves around 0.5KiB in text size on optimized GCC 5.3
Linux AMD 64 builds.

Change-Id: Iaf2664e670a96136031bac67e4012d4f7324eb47
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-02-17 16:17:29 +00:00
Marc Mutz
66e2643072 QDialogButtonBox: replace a QList copy + pop_front() with mid(1)
Simplifies the code and is also more efficient, because
it copies less data.

Change-Id: I9ad0c372fb4fa6f5818d9d6cb7b7cf35935f8565
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
2016-02-17 16:17:25 +00:00
BogDan Vatra
efcf1dec49 Say hello to Android Services
This changeset enables running a QCoreApplication from within an Android
Service. The Android Application running can now have a QtActivity or a
QtService, but having both in the same process is not supported.

This patch was based on Cory Slep's patch

[ChangeLog][Android] Qt can now be used to easily create Android Services.

Task-number: QTBUG-37221
Change-Id: I0fd693daaa85b991940ffe9cc41c483022677199
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
2016-02-17 14:29:58 +00:00
Tor Arne Vestbø
4a7ccf74ff Disable XCTest support in QtTestLib
In recent Xcode versions it doesn't work as expected, and caused build
failures in downstream modules, so we disable it until the cause can
be investigated further.

Change-Id: Ie54c7256a10d73610ec7e481b9d665b75e396365
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
2016-02-17 13:12:56 +00:00
Stephen Kelly
bfeb2fdd79 QStandardItemModel: Reset the flags on clear()
Pass modeltest after clear().  Otherwise it fails because more flags
than Qt::ItemIsDropEnabled get returned for the QModelIndex().

Change-Id: I8f11515cc7dc9383f528f785312ffb77b3c2699d
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-02-17 11:39:13 +00:00
Anton Kudryavtsev
a44d7862c8 QDate: mark getDate() as const.
This method does not modify the object.
Can't change the API, so overload and mark the old function
for removal in Qt 6.

Change-Id: I4aee2bc19209646adc21388375aedd20a09129d0
Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-02-17 11:19:52 +00:00
Friedemann Kleint
56ad625f78 Add attribute Qt::AA_DontUseNativeDialogs.
The attribute can be set to suppress native dialogs for example
for testing purposes.

Task-number: QTBUG-51074
Change-Id: I35611e07e00b7a060f22b49d6ab6f3b8627f8aca
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
2016-02-17 10:20:28 +00:00
Anton Kudryavtsev
9baf824e4d QDateTimeParser: de-duplicate calls and cache results
Change-Id: I2e95456146b6ce646e244e962082f2967bcaed42
Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-02-16 21:38:05 +00:00
Eric Lemanissier
21d19f760c Improve sql allocated cache reuse
This change avoids unnecessary allocation of QSqlCachedResult cache.

Change-Id: Ief592ab05b50f5e328490c504af088ec74d1938f
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Mark Brand <mabrand@mabrand.nl>
2016-02-16 21:22:19 +00:00
J-P Nurmi
273114582a Add QStyleHints::setTabFocusBehavior() for testing purposes
So far we've been dependent on the focus behavior setting in OS X
system preferences. This change allows us to start testing both
behaviors on any platform.

Change-Id: I9ce004f8b9479f8e722a387b795de16edb166a07
Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
Reviewed-by: Liang Qi <liang.qi@theqtcompany.com>
2016-02-16 21:12:49 +00:00
Milian Wolff
bd35260415 Microoptimize QObject::activate.
This patch removes temporary variables that are not used in all cases.
This reduces the instruction count per iteration for the corresponding
benchmark by 1 or 2.

Before:

********* Start testing of QObjectBenchmark *********
Config: Using QtTest library 5.7.0, Qt 5.7.0 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 5.3.0)
PASS   : QObjectBenchmark::initTestCase()
PASS   : QObjectBenchmark::signal_slot_benchmark(simple function)
RESULT : QObjectBenchmark::signal_slot_benchmark():"simple function":
     21.0065466 instructions per iteration (total: 210,065,466, iterations: 10000000)
PASS   : QObjectBenchmark::signal_slot_benchmark(single signal/slot)
RESULT : QObjectBenchmark::signal_slot_benchmark():"single signal/slot":
     405.0829559 instructions per iteration (total: 4,050,829,559, iterations: 10000000)
PASS   : QObjectBenchmark::signal_slot_benchmark(multi signal/slot)
RESULT : QObjectBenchmark::signal_slot_benchmark():"multi signal/slot":
     405.0812465 instructions per iteration (total: 4,050,812,465, iterations: 10000000)
PASS   : QObjectBenchmark::signal_slot_benchmark(unconnected signal)
RESULT : QObjectBenchmark::signal_slot_benchmark():"unconnected signal":
     104.0147348 instructions per iteration (total: 1,040,147,349, iterations: 10000000)
PASS   : QObjectBenchmark::signal_slot_benchmark(single signal/ptr)
RESULT : QObjectBenchmark::signal_slot_benchmark():"single signal/ptr":
     369.1021099 instructions per iteration (total: 3,691,021,100, iterations: 10000000)
PASS   : QObjectBenchmark::signal_slot_benchmark(functor)
RESULT : QObjectBenchmark::signal_slot_benchmark():"functor":
     370.0982862 instructions per iteration (total: 3,700,982,862, iterations: 10000000)
PASS   : QObjectBenchmark::cleanupTestCase()
Totals: 8 passed, 0 failed, 0 skipped, 0 blacklisted, 6036ms
********* Finished testing of QObjectBenchmark *********

After:

********* Start testing of QObjectBenchmark *********
Config: Using QtTest library 5.7.0, Qt 5.7.0 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 5.3.0)
PASS   : QObjectBenchmark::initTestCase()
PASS   : QObjectBenchmark::signal_slot_benchmark(simple function)
RESULT : QObjectBenchmark::signal_slot_benchmark():"simple function":
     21.0061664 instructions per iteration (total: 210,061,664, iterations: 10000000)
PASS   : QObjectBenchmark::signal_slot_benchmark(single signal/slot)
RESULT : QObjectBenchmark::signal_slot_benchmark():"single signal/slot":
     403.0829161 instructions per iteration (total: 4,030,829,162, iterations: 10000000)
PASS   : QObjectBenchmark::signal_slot_benchmark(multi signal/slot)
RESULT : QObjectBenchmark::signal_slot_benchmark():"multi signal/slot":
     403.0836305 instructions per iteration (total: 4,030,836,305, iterations: 10000000)
PASS   : QObjectBenchmark::signal_slot_benchmark(unconnected signal)
RESULT : QObjectBenchmark::signal_slot_benchmark():"unconnected signal":
     104.0150038 instructions per iteration (total: 1,040,150,039, iterations: 10000000)
PASS   : QObjectBenchmark::signal_slot_benchmark(single signal/ptr)
RESULT : QObjectBenchmark::signal_slot_benchmark():"single signal/ptr":
     368.0981987 instructions per iteration (total: 3,680,981,988, iterations: 10000000)
PASS   : QObjectBenchmark::signal_slot_benchmark(functor)
RESULT : QObjectBenchmark::signal_slot_benchmark():"functor":
     369.1179429 instructions per iteration (total: 3,691,179,429, iterations: 10000000)
PASS   : QObjectBenchmark::cleanupTestCase()
Totals: 8 passed, 0 failed, 0 skipped, 0 blacklisted, 5975ms
********* Finished testing of QObjectBenchmark *********

Change-Id: Iba3bffbca5b58109816c8b1a7dea0796b18c8785
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-02-16 18:00:16 +00:00
Milian Wolff
e1538b39bb Share code between const and non-const QMetaObject::cast variants.
Change-Id: I7aad8e5060bb17ebc04fdb137dad3b6d167895a8
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-02-16 17:59:55 +00:00
Marc Mutz
a93ff2c248 Reduce allocations in QSQLiteDriver::open()'s connection options parsing
- Use splitRef() instead of split(), avoiding small temporary
  QStrings.
- Don't remove all spaces before splitting, trim strings at
  the QStringRef level later, where needed. This will reject
  nonsense strings like QSQL_ LITE _BUSY_ TI MEOUT= 1 2 3 that
  were previously (wrongly) accepted.
- Use C++11 range-for loop.

Change-Id: I875c4cf47b7a283ba55783f70c903bb9947e1cd7
Reviewed-by: Mark Brand <mabrand@mabrand.nl>
2016-02-15 23:12:54 +00:00
David Faure
bbc830ce3e QIcon::fromTheme(): add support for absolute paths.
This allows methods that return an icon name, to sometimes also
return an icon full path (e.g. because the icon was dynamically generated
and stored into a local cache on disk)

Change-Id: Ib01c3955f4b64236463846241d9814b2d0686634
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-02-15 13:53:54 +00:00
BogDan Vatra
1a358a052e Fix crash when using .NoActionBar theme.
m_activity.getActionBar() returns null when a .NoActionBar theme is
declared in AndroidManifest.xml file

Change-Id: I671891d03913209c3f9f34a6f4dd8894c20de5c2
Reviewed-by: Christian Stromme <christian.stromme@theqtcompany.com>
2016-02-15 13:04:48 +00:00
Anton Kudryavtsev
0668d08b87 QHttpNetworkConnectionPrivate: de-duplicate calls in if-else chains
... and loops.

Every QNetworkConfiguration::bearerType() call produces lock/unlock of mutex.
Fix: cache result.

Every QHttpNetworkRequest::contentLength() call contains internal loop.
Fix: cache result.

Also cache results of QNonContiguousByteDevice::size() and
QHostAddress::protocol().

Change-Id: I01124648b1972f480905433d9b3551c2246e1bde
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-02-15 12:40:08 +00:00
Peter Kümmel
ab8cc8387f Add qOverload to select overloaded functions
[ChangeLog][QtCore][Global] qOverload added to select
overloaded functions.

Change-Id: I7c9b1b054e6631eca0b5594db59e1202ef552c33
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-02-15 12:33:24 +00:00
Sean Harmer
b725f4e144 Cache results of multiple render target support
Change-Id: I9e706690d4d2ddaae6c84b0e24de7698704e862d
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
2016-02-14 18:13:42 +00:00
Sean Harmer
48ca7f6220 Provide optimised version of QOpenGLFramebufferObject::blitFramebuffer
Profiling shows that the call to glGetIntegerv() in this function that
queries for the currently bound framebuffer is very expensive. It's
the top hit on the CPU when profiling a Qt3D application using a
Scene3D Qt Quick 2 item. The reason it is so expensive is that this
call forces the OpenGL driver to propagate the OpenGL state through
all of the queued commands in order to answer the query. It may
also induce a pipeline stall depending upon the driver implementation.

As this function gets called on the hot path every frame whenever using
a Scene3D item and may also be called in plain Qt Quick when using
ShaderEffect items; the layer property of QQuickItem; or when updating
the Qt Quick glyph cache texture on Core profile contexts, it is very
much worthy of optimization.

This commit adds an overload of the blitFramebuffer() call that allows
the caller to provide a policy that can either:

* keep the existing behavior of restoring the previous framebuffer
  binding,
* restore the default framebuffer, or
* don't restore anything and let the caller be responsible for it.

This will allow consumers such as Qt Quick and Qt 3D to use the
optimised code path. The existing overloads of blitFramebuffer()
retain the current behavior by calling with the policy to restore the
previous framebuffer binding.

Upon making this change, the cost of blitFramebuffer() is massively
reduced. A follow up commit will optimize this further.

Change-Id: I417abb7da916ae5088f6817e4eff8ea02c8c5803
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
2016-02-14 18:13:38 +00:00
Sérgio Martins
e41e034669 Use QVector instead of QList for sizeof(T) > sizeof(void*)
caught with static analyzer which only warns for trivial cases:
- Container must be local
- Container isn't passed to any function, assigned to another
container or assigned to.

Change-Id: I3f3aa73c128a56f067fa8745990977445a495ac4
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-02-14 16:39:54 +00:00
Sérgio Martins
6139fbeb5f Introduce QHash::equal_range()
Similar to QMap::equal_range().
Will allow to easily fix inefficient code such as:

    foreach (auto value, hash.values(key)) { ... }

[ChangeLog][QtCore][QHash] Added QHash::equal_range()

Change-Id: I6e19e25de632e897ad83d3141d9d07f0313f7200
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-02-14 06:43:52 +00:00
Marc Mutz
26dca142a7 QtWidgets: use new QRect::transposed()
Change-Id: Idfed0ae6b80e301fd32206b2e6d68054460b76de
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-02-13 18:18:53 +00:00
Marc Mutz
8ce34c2e81 QRect(F): add transposed()
I didn't add a transpose(), because r = r.transposed() is
perfectly capable of filling that role, and just as
efficient. Existing API mistakes are no excuse to create
more of them.

[ChangeLog][QtCore][QRect/QRectF] Added transposed().

Change-Id: Ic38721e9028496fc9b50f4d4cef2e7a60532eed8
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-02-13 18:18:48 +00:00
Marc Mutz
afc7da09ec QRegion: add move ctor
After this change, this was the distribution of calls in
QtGui and QtWidgets when the patch was developed for 5.4:

      QtGui  QtWidgets
move  23     63
copy  23     36

Change-Id: If3f536e52fc242c585e7fa0662049c0657efcc9c
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-02-13 18:18:32 +00:00
Andre Somers
0df5c366e5 Use QFlags::setFlag where prudent in qtbase
QFlags::setFlag is most useful to replace explicit constructs like

if (condition) {
   someFlags |= TheConditionFlag;
} else {
   someFlags &= ~TheConditionFlag;
}

with

someFlags.setFlag(TheConditionFlag, condition);

Change-Id: Ie4586681c83e0af812d5bbf14965aad51941a960
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-02-12 19:32:05 +00:00
Paolo Angelelli
c5d4972577 Fix for deferredDelete() bug when calling the glib loop directly
This patch makes sure that all events posted using Qt on top of the
GLib event loop have the loopLevel counter incremented.
This is done since Qt depends on the fact that all deleteLater() calls
are issued within the scope of some signal handler (in other words,
triggered by the chain sendEvent() -> notifyInternal2()).
There is a side effect though: in the conditions affected by this
patch, that is deleteLater()s issued within a glib event handler for
example, manually calling processEvents() or sendPostedEvents() with
or without the QEvent::DeferredDelete flag has the same effect, and
deferred deleted events are always processed.
While this is not a currently working feature which the patch breaks,
this side effect seems to be difficult to avoid without separating
sendPostedEvents() and processEvents() into a public and a private
method, in order to detect when they are manually called.
Such change could perhaps be done for Qt6.
An autotest for QTBUG-36434 is also included.
Autotesting for QTBUG-32859 seems to be more challenging in this
respect, due to its dependency on GLib.

Task-number: QTBUG-18434
Task-number: QTBUG-32859
Task-number: QTBUG-36434
Change-Id: Ib89175aa27c9e38bca68ae254d182b2cd21cf7e9
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-02-12 19:06:11 +00:00
Marc Mutz
7f48655fb8 QTextFrame::iterator: restore nothrow move special members
The user-defined copy assignment and copy constructors
inhibit the move special member functions.

We cannot do something about it in Qt 5, because the
class is exported (which it shouldn't be), and because
making it trivially-copyable might change how it is
passed to functions by value, so we need to supply all
the missing member functions manually.

Change-Id: Ic710b449f6abd386449fa6df71e8bc9bd0f98d2b
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-02-12 18:29:54 +00:00