Commit Graph

24407 Commits

Author SHA1 Message Date
Marc Mutz
0abd207052 QZip*: don't hold QZipReader::FileInfo in QList
FileInfo is larger than a void*, so holding them in a QList 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.

Change-Id: I772177c5ac544a5fecce2368f628148308ef260f
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-07-19 10:35:41 +00:00
Marc Mutz
78bba7b002 Clean up QZipReader::FileInfo
- don't define special member functions if the compiler-generated
  ones are just fine (inhibits move semantics)
- implement all remaining methods inline
- unexport
- remove unused (and, to add insult to injury, never init'ed)
  d-pointer. This is private API. No need for a d-pointer,
  much less an unused one.

Change-Id: I6979cb5103a361c0313c252d3bf7073a3c47addd
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2015-07-19 10:35:26 +00:00
Marc Mutz
74a658599f QArrayDataPointer: make move semantics consistent with other containers
That is:
- nothrow default constructor
- nothrow move constructor
- nothrow move assignment operator
- nothrow swap
- as a generic container, destroy lhs contents immediately
  on move-assignment.

Change-Id: I6ec2b9451d3a0ddb63a97ea84504bc7f87d8d34d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-07-19 10:33:59 +00:00
Marc Mutz
5c44232122 QSet/QQueue/QStack: use compiler-generated special member functions
They do the right thing (except move special member functions
on MSVC, but that's MSVC's problem).

Change-Id: I699e1be83c0568821f8c6b84394a2713bb22e8e7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-07-19 10:33:55 +00:00
Marc Mutz
46c5b86612 QSharedPointer: add move construction, assignment from compatible shared pointers
Change-Id: I772c568055c9bed6eb627ad35dba300925fc0fde
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-07-19 10:33:50 +00:00
Marc Mutz
a1ef018d9c QDBusVariant: add ctor taking QVariant&&
Change-Id: Ia25c4bd6294955b0e8ea5ecc0c62719423542e84
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-07-19 10:33:43 +00:00
Marc Mutz
27ba0b8f88 Containers: destroy previous state on move-assignment immediately
[ChangeLog][QtCore] All generic containers (with the exception of
QVarLengthArray, but including QSharedPointer) destroy the
previous state as part of a move-assignment now. Previously, they
would dump it into the right-hand-side object. Note that this is
only true for the generic containers. Other implicitly-shared
types, as well as the non-generic containers QString, QByteArray,
etc. still just swap the contents with the right-hand-side object
when move-assigned into, and, for performance reasons, this will
not change in the forseeable future.

Change-Id: I1f1c684e85400b77bd2e7fba65bde2dce6c1bdde
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-07-19 10:33:39 +00:00
Marc Mutz
8ab2d86d05 QSharedPointer: mark some internal API nothrow
Change-Id: I871c86406b2c25df9a7834a997caf8a792d353a0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-07-19 10:33:34 +00:00
Marc Mutz
d945345af1 QList: mark const variants of begin()/end() noexcept
Plus some other trivial functions.

Drive-by change: 0 -> Q_NULLPTR (public header)

Change-Id: Ic3fca2950e4c5143eb90bd119da113fe64e48032
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-07-19 10:33:28 +00:00
Marc Mutz
94c24fad59 QDBusConnection: declare as shared-come-Qt6
Requires adding member-swap and (at least in my copy) move operations.

Change-Id: I1b638a81e4a41f467e69e352806524039e7b9f27
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-07-19 10:33:23 +00:00
Marc Mutz
f79dee6844 Add missing Q_DECLARE_OPERATORS_FOR_FLAGS(QDBusConnection::ConnectionCapabilities)
Change-Id: I659ccc00129d20bbae08b277a291d81c6ede80be
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-07-19 10:33:18 +00:00
Marc Mutz
c27d4981e9 Fix nullptr literal 0s which would look odd as nullptr
These all invoke the QFlags<>(Zero *) ctor, which is designed to
accept a 0, but no other int. But in doing so, it requires passing
a nullptr literal, and 0 is not a nullptr literal accepted under
-Wzero-as-null-pointer-constant or similar warnings.

Fix by using the QFlags::QFlags() ctor instead.

Task-number: QTBUG-45291
Change-Id: I73f9c9f4de11eeb1ba04ace6c7121d17510ea29f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-07-19 10:33:12 +00:00
Marc Mutz
efeab107bf QtPrintSupport: Use Q_NULLPTR instead of 0 in all public headers
This is in preparation of adding -Wzero-as-null-pointer-constant (or similar)
to the headers check.

Task-number: QTBUG-45291
Change-Id: I6f591a42a8e8ea471d27666eb1cbc77b572b3e0d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-07-19 10:32:58 +00:00
Marc Mutz
a767014167 QtGui: Use Q_NULLPTR instead of 0 in all public headers
This is in preparation of adding -Wzero-as-null-pointer-constant (or similar)
to the headers check.

Task-number: QTBUG-45291
Change-Id: I72ab40b21a9499b53a639564fa45884de17b6c98
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-07-19 10:32:55 +00:00
Marc Mutz
08f6b38ec7 QtNetwork: Use Q_NULLPTR instead of 0 in all public headers
This is in preparation of adding -Wzero-as-null-pointer-constant (or similar)
to the headers check.

Task-number: QTBUG-45291
Change-Id: I9a05d375d2d9d3ed56079ad024c89a08a290619b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-07-19 10:32:50 +00:00
Marc Mutz
7c8b0c098a QFileSystemModel: reserve() a QList
Change-Id: I136c24382a869ef92446dbe79bfd6a64273e55c6
Reviewed-by: Sérgio Martins <sergio.martins@kdab.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
2015-07-19 10:00:55 +00:00
Friedemann Kleint
57ae1b15b6 Testlib: Remove overload qCompare(bool, int, ...).
It was added for NokiaX86 / RVCT compilers and may
produce unexpected results with g++, where it matches
for qCompare(int, enum).

Task-number: QTBUG-47260
Change-Id: Ia29b9ae289c6df579a923aef6eb67e46db0b1120
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Reviewed-by: Jason McDonald <macadder1@gmail.com>
2015-07-19 08:19:31 +00:00
Marc Mutz
15a5035671 QDBusMessage: declare as shared-come-Qt6
Requires adding member-swap and (at least in my copy) move assignment.

Since the type does not contain a d == nullptr state,
a move constructor isn't yet possible.

Change-Id: Iad6939fa30f214591eab1fdf30a2cf1423ffb32a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-07-18 13:33:04 +00:00
Marc Mutz
84769bbbce QDBusError: declare as shared-come-Qt6
Requires adding member-swap and (at least in my copy) move operations.

Change-Id: I4284484b1f520eb2d9036b993a5b5b70aaea0af9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-07-18 13:32:59 +00:00
Marc Mutz
188a8a7f1d QDBusArgument: declare as shared-come-Qt6
Requires adding member-swap and (at least in my copy) move operations.

Change-Id: I0b32c387809c972203c94677616fe0a52143ec3b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-07-18 13:32:53 +00:00
Marc Mutz
9ed9787b7e QItemSelection: declare as shared-come-Qt6
Change-Id: I07fe36777f8e64c4551243b5dfc3273f1783e954
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-07-18 13:32:48 +00:00
Marc Mutz
b172e8e785 Mark QPixmapCache::Key as shared for Qt 6.
Change-Id: I37819cfd8a56d364336640146dbead2e1a454787
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-07-18 13:32:43 +00:00
Marc Mutz
648a496e5e QFileSystemModel: avoid sibling() calls
...by allowing to pass the column to the Private::index() overloads.

Because Private::index() always returns an index in column 0,
callers that needed a different column used QModelIndex::sibling()
to adjust the column of the returned index. But that calls
QAIM::sibling(), which calls both QFSM::index() and ::parent().

Simply allowing to pass the column number instead of hard-coding
0 avoids that heavy detour.

Change-Id: I8895b3d102d576ba291333cf61075b7263f96b9d
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: David Faure <david.faure@kdab.com>
2015-07-18 13:32:31 +00:00
Friedemann Kleint
ce7fb157f0 Tests: Do not rely on qCompare(bool, int,...).
The overload was added for NokiaX86 and RVCT and is bound for
removal.

Task-number: QTBUG-47260
Change-Id: Ic67cee8769847956e16cd0470ebcd663a9e98a40
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-07-18 10:36:17 +00:00
Alex Trotsenko
524ae251bb QIODevice: remove superfluous member
In current implementation, d->firstRead doesn't provide any
performance improvement.

Change-Id: I5d6e765a7d49cb546998b2c3e908e3c5600e70b1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-07-18 09:05:55 +00:00
Marc Mutz
075769ca83 Introduce Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6
... with classical semantics, meaning movable-come-Qt6,
and complex-until-then.

Whether or not we want a new flag for movable-except-
in-QList is an orthogonal question, and should not hold
back the slew of commits that introduce use of this
macro.

Change-Id: I3a6be08c314fcd7f3315af138625c38196debda5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-07-18 06:20:34 +00:00
Marc Mutz
cdd2f8eb34 QtCore: Use Q_NULLPTR instead of 0 in smart pointer headers
This is in preparation of adding -Wzero-as-null-pointer-constant (or similar)
to the headers check.

Not caught by the headersclean check, because they are in template code.

Task-number: QTBUG-45291
Change-Id: I7294404225a19a1c58f91e6e47a9d650179ea83c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-07-18 06:20:23 +00:00
Marc Mutz
0aa5092576 QByteArray: document {const_,}{reverse_,}iterator
The reverse_ ones were missing, and the non-reverse ones
were marked \internal. But why should they not be documented?

Change-Id: I5ffbfc1def8dcac3f4a771883152ffbcca3d745d
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-07-18 06:20:17 +00:00
Marc Mutz
d660c4c8bf QDBusObjectPath: add ctor taking QString&&
The new constructor cannot be marked nothrow, because it calls
non-nothrow doCheck();

Change-Id: I4e5b33c58125091644573ed84e715c7fa946ae09
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-07-18 06:20:10 +00:00
Marc Mutz
1251273232 QDBusSignature: add ctor taking QString&&
The new constructor cannot be marked nothrow, because it calls
non-nothrow doCheck();

Change-Id: I732fac7a07d46a3ff3be0e4e56de72dd19090737
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-07-18 06:20:05 +00:00
Marc Mutz
3a961702f0 Mark some QCUPSSupport enums as primitive
They are held in QVariants. No need to allocate
them on the heap.

Change-Id: I7829acbed94fd5b37079df670b0aa2d09613c73c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-07-18 06:20:01 +00:00
Marc Mutz
98eef668e6 Mark QDBusSlotCache{,::Data} shared
The compiler-generated move operations are ok.

Change-Id: Iec0fed49d52ace5ca7dae2c7ee53d717a283f15a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-07-18 06:19:54 +00:00
Thiago Macieira
53ee7444d8 forkfd: use wait4 to get the process status instead of waitid
wait4 gives us the struct rusage contents for us, which may contain
interesting data for other users of forkfd (not Qt, though).

Change-Id: Iee8cbc07c4434ce9b560ffff13cb4aa28e18e790
Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
2015-07-18 02:25:23 +00:00
Thiago Macieira
10c529b08d Add a way for auxiliary threads to handle events without CoreApp
Long-lived threads started by Qt itself can now receive events even if
QCoreApplication hasn't been created. This is required in all threads we
start that will handle events, unless we're sure that the thread will
exit before the global application object begins destruction.

Otherwise, those threads will have race conditions dealing with the
event delivery system trying to call the QCoreApplication::notify()
virtual while the object is being destroyed.

Change-Id: I27eaacb532114dd188c4ffff13d4ad2a4bb443e6
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2015-07-18 02:24:59 +00:00
Thiago Macieira
9d98584a83 Make the event delivery go through some more static functions
This commit makes QCoreApplicationPrivate::checkReceiverThread,
notify_helper, and sendThroughObjectEventFilters be static functions,
since they only deal with global data or the parameters only.

Making notifyInternal would have been binary incompatible (it's called
from inline functions QCoreApplication::sendSpontaneousEvent and
QCoreApplication::sendEvent), so instead add a new static
notifyInternal2 and mark the older function deprecated and to be removed
in Qt 6.

Change-Id: I27eaacb532114dd188c4ffff13d59fe3b0661489
Reviewed-by: Albert Astals Cid <albert.astals@canonical.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2015-07-18 02:24:45 +00:00
Jake Petroules
01f800ae6f Add a macro to disable use of potentially dangerous QProcess APIs.
Change-Id: Id1ac19b1f4077ec2ea6f998883653e58ff77a8b6
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2015-07-17 21:14:28 +00:00
Marc Mutz
70d84f26bd QStyleSheetStyle: don't hold ButtonInfo in QList
ButtonInfo is larger than a void*, so holding them in a QList 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 holding it in QVector. Also reserve() the vector, even though we
can't tell the size exectly. It's a short-lived vector.

When appending, add an optimistic qMove().

I would have liked to use std::vector instead, but QRenderRule, thus
ButtonInfo, isn't nothrow-move-constructible, because of missing
move constructors on QBrush and QFont, among others.

Change-Id: I89164f4ed5745498093102f022a7ef32186e8045
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2015-07-17 18:22:16 +00:00
Giuseppe D'Angelo
7c46a96972 Remove a silly note from QFileDialog::getOpenFileNames documentation
I can't possibly understand the meaning of the note, especially
given the snippet. (However ,it has been there since Qt 3,
so perhaps it refers to some weird QValueList behavior?)

Change-Id: I952e9a7cb687b94cfccb927eb359b635804f4ade
Reviewed-by: Martin Smith <martin.smith@digia.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2015-07-17 18:22:09 +00:00
Thiago Macieira
ff44440651 Make CONFIG += c++11 by default not disable GNU extensions
Prefer -std=gnu++11 unless strict_c++11 is defined. You can enable
strict C++11/C++14 mode by using
   CONFIG += strict_c++

That is enabled for Qt's own code, so we we don't accidentally use GNU
extensions in portable code.

There's no support for strict C++98 mode (that is, the -ansi option).

[ChangeLog][qmake] By default, GNU extensions are now enabled with
Clang, GCC and ICC even in C++11 and C++14 modes. To disable the GNU
extensions, add to your .pro file: CONFIG += strict_c++.

Change-Id: Ib056b47dde3341ef9a52ffff13ef14de2169bef5
Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2015-07-17 17:36:27 +00:00
Thiago Macieira
85ff351266 Revamp the CLOEXEC support in Qt
The pipe2/dup3/accept4 functions and SOCK_CLOEXEC are quite old nowadays
on Linux. They were introduced on Linux 2.6.28 and glibc 2.10, all from
2008. They were also picked up by uClibc in 2011 and FreeBSD as of
version 10.0. So we no longer need the runtime detection of whether the
feature is available.

Instead, if the libc has support for it, use it unconditionally and fail
at runtime if the syscall isn't implemented.

Change-Id: Ib056b47dde3341ef9a52ffff13efcc39ef8dff7d
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2015-07-17 17:36:19 +00:00
Thiago Macieira
61e621def3 Remove unnecessary check from qt_safe_pipe: condition can never happen
FD_CLOEXEC is implicit for us, so no caller will need to set O_CLOEXEC.

Change-Id: Ib056b47dde3341ef9a52ffff13efcb635dea95f0
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2015-07-17 17:36:14 +00:00
Thiago Macieira
7331b15525 Add QTemporaryDir::errorString()
[ChangeLog][QtCore][QTemporaryDir] Added errorString() method that
returns the string explaining why creating the temporary directory
failed.

Change-Id: Ib306f8f647014b399b87ffff13f0a1f3c89e0a2c
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2015-07-17 17:36:07 +00:00
Thiago Macieira
5af7f7ec46 Make the -pkg-config and -force-pkg-config options be the same
There's really no difference between them, other than -force-pkg-config
skipping the check if the tool is even available and printing a warning.

Change-Id: I04cb83c6649ef73866a84032ea46093c4a00ce00
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2015-07-17 17:36:03 +00:00
Simon Hausmann
dcc301abfa Merge "Merge remote-tracking branch 'origin/5.5' into HEAD" into refs/staging/dev 2015-07-17 14:43:34 +00:00
Simon Hausmann
b2603b7665 Merge remote-tracking branch 'origin/5.5' into HEAD
Conflicts:
	src/plugins/platforms/windows/qwindowsopengltester.cpp

Change-Id: Ia7abeba9395ccf84e2fa81b91a5725a86dedb9fe
2015-07-17 16:35:42 +02:00
David Faure
5443da6c27 QFileDialog: add setSupportedSchemes and pass it along to the QPA.
This also finishes the implementation of the static methods which
were being passed a supportedSchemes argument but weren't using it.
Now they can pass it along to the QFileDialog instance, which then
passes it to the helper used by the QPA implementation of the file
dialog. The default implementation only supports local files and
can therefore ignore this, but other implementations can use this
argument to restrict the protocols allowed to the user.

[ChangeLog][Widgets][QFileDialog] Add supportedSchemes property.

Change-Id: I5235f70e785da1c06866a8355ef98f571890c4a2
Reviewed-by: Kevin Ottens <kevin.ottens@kdab.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
2015-07-17 14:29:47 +00:00
David Faure
4e4b16dc17 Doc: fix punctuation and missing word in QFileDialog docu.
Change-Id: I7388eda21bcea755db07c8b9603ec4e5f521c2fd
Reviewed-by: Kevin Ottens <kevin.ottens@kdab.com>
2015-07-17 14:29:43 +00:00
David Faure
31a1b3df1d QtConcurrent example: remove unneeded explicit template type
I show this code during trainings and this explicit template type
just makes the line of code more complex than it has to be.

Change-Id: I294c65f48967e54c67d9c3b8e1de96c3c2495a5b
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2015-07-17 14:29:42 +00:00
Friedemann Kleint
4b8ba3c91a Fix sub test float of tests/auto/testlib/selftests/tst_selftests for MSVC 2015.
From MSVC 2015 onwards, MSVC formats floats using printf("%g") like
g++, so the fiddling of the expected output needs to restricted
accordingly.

Change-Id: I6e7f78e5e90f70886a8b2ef37c0fb9bf82b5e1a3
Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
2015-07-17 14:15:19 +00:00
Friedemann Kleint
2fe56e37ed Polish the examples/widgets/mainwindows example.
- Introduce Qt 5 signals & slot syntax.
- Replace QSignalMapper used for the corner/area
  actions by a by a functor.
- Improve command line parsing.
- Reorder class declarations.
- Remove commented-out code.
- Use QDialogButtonBox in dialogs.
- Fix minor issues in code, use multi-argument version
  of QString::arg(), QDir::toNativeSeparators() to
  present file paths to the user, static method
  invocations.

Change-Id: I865c56639c74135b59740797e9a9dfbfca2e72b6
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2015-07-17 14:15:11 +00:00