Now all Qt sequential containers consistently provide reverse iterators.
The associative ones, by way of not returning std::pair from op*, can't
just use std::reverse_iterator. They would miss .key() and .value() methods.
So that has to wait for 5.7.
The reverse versions of the new key_iterators can also just use
std::reverse_iterator, but I'm afraid that after bikeshedding over
keyRBegin() vs. rKeyBegin() vs. reverseKeyBegin() vs. rkbegin()
vs. krbegin() (<-- of course, what else?), it would anyway be too
late for 5.6, so defer, too.
[ChangeLog][QtCore][QLinkedList/QSet] Added rbegin(), crbegin(), rend(), crend(),
and reverse_iterator and const_reverse_iterator typedefs.
Task-number: QTBUG-25919
Change-Id: I58316fffade469e9a42c61d7aa1455ae3443fd94
Reviewed-by: Sérgio Martins <sergio.martins@kdab.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
A QAbstractSocket can be close()'d at any time, independently of its
current connection state. being closed means that we cannot use it to
read or write data, but internally it might still have some data to
send or receive, for example to an http server. We can even get a
connected() signal after close()'ing the socket.
We need to catch this condition and mark any pending data not yet
written to the socket for resending.
Task-number: QTBUG-48326
Change-Id: I6f61c35f2c567f2a138f8cfe9ade7fd1ec039be6
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Previously, only QXmlTestLogger had timers to take elapsed times
and log them. Move those into class QTestLog for access by
the loggers and output the times in the crash dump to make it
easier to spot hangs/recursion crashes.
Produces:
QFATAL : foo() Received signal 11
Function time: 22ms Total time: 23ms
A crash occurred in ...
Function time: 24ms Total time: 26ms
Task-number: QTBUG-47370
Change-Id: Ia530a63104087daffc9a15f68c15d93378b9407e
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
This is a continuation of the work started in commit
694d300355.
Attach reference ('&') and pointer ('*') qualifiers to the
parameter name, as per Qt coding style.
Previously, function signatures were documented like this:
QString & QString::append(const QString & str)
After this change, they will appear like this:
QString &QString::append(const QString &str)
Change-Id: Ie103fc2929635bc32145e50469c600f9f378f97c
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
Reviewed-by: Martin Smith <martin.smith@digia.com>
QDoc wrote \target and \keyword information into the index file
properly, but did not read them back in.
This was because the code for handling enum and function elements
read their own child elements (without handling targets), and
marked the remaining children to be skipped.
This commit fixes the issue by refactoring the code for inserting
targets into a new function and calling it from relevant places.
Change-Id: I85d7b26ce54620daec35b19e447d1a065515b863
Task-number: QTBUG-48687
Reviewed-by: Martin Smith <martin.smith@digia.com>
The message box buttons need to be added inside the XAML thread.
Otherwise QWinRTMessageDialogHelper::onCompleted will not be triggered.
To successfully emit the clicked signal across different threads do not
exit the eventloop.
Change-Id: Ie884bdfe0dc64132559755083dae50c2aa43d80b
Task-number: QTBUG-48209
Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
Don't use gst_is_initialized(). It was added in 0.10.31, but we don't
actually require that version.
Change-Id: If5d662e18511cf636861bf93eeccc1f5b69e26f1
Reviewed-by: Christian Stromme <christian.stromme@theqtcompany.com>
After calling connectToHost(), the socket enters HostLookup state. At this
stage, the socket engine was not created yet, and writing to the socket
should result in either data buffering or an error. So, add a check for
d->socketEngine to prevent a crash on unbuffered sockets.
Task-number: QTBUG-48356
Change-Id: I15ea9ce7de97ce6d7e13e358eca5350745b556bb
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Richard J. Moore <rich@kde.org>
On OS X we don't treat popup windows as worthy of being activated and
focus windows (key windows). Instead we keep track of the active popup
windows and forward events to them manually.
The forwarding logic is split between QPA, which handles mouse, and
QWidgetWindow and QQuickWindowPrivate, which handles key events.
This commit adds the logic for key events to QPA, which is the right
platform layer for this kind of workarounds. The widget code is left
as is for now, and the QQuickWindowPrivate code can be removed in
a follow up.
Task-number: QTBUG-39415
Change-Id: Iee411fcba9fc81ddcc3a7bc82591184675a6d7a2
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
If QTimer::singleShot() is used with a functor callback and a context
object with different thread affinity than the caller, a crash can
occur. If the context object's thread is scheduled before
connecting to QCoreApplication::aboutToQuit(), the timer has a change
to fire and QSingleShotTimer::timerEvent() will delete the
QSingleShotTimer object making the this pointer used in the
connection invalid. This can occur relatively often if an interval
of 0 is used.
Making the moveToThread() call the last thing in the constructor
ensures that the constructor gets to run to completion before the
timer has a chance to fire.
Task-number: QTBUG-48700
Change-Id: Iab73d02933635821b8d1ca1ff3d53e92eca85834
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
In case of a lock failure, we potentially pollute the errno value
before printing it. Also, switch to qt_error_string, as strerror
is not reentrant.
Change-Id: I952aac14204637155726bcefc0ed8a21d7fcd501
Reviewed-by: David Faure <david.faure@kdab.com>
Apart from removing some unwanted allocations, also reduces
text size by ~800B on Linux AMD64 GCC 4.9 release builds.
Change-Id: Ibcd1d8264f54f2b165b69bee8aa50ff7f4ad3a10
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Calculation was working as long as one didn't use per pixel scrolling.
Task-number: QTBUG-48579
Change-Id: Ie02e28b008c5c81ed45d7dd17fed96148c23b598
Reviewed-by: Thorbjørn Lindeijer <bjorn@lindeijer.nl>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: David Faure <david.faure@kdab.com>
If QT_NO_CURSOR is defined then changeCursor() is not implemented in
QPlatformCursor which means that it isn't really being overridden in the
offscreen plugin. Therefore the same define is checked for to prevent a
compiler from having a problem with it.
Change-Id: Id7c104292354cb7462b3161602fc8d382a6dd390
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Use the fromUnicode(QChar *, int size) overload instead.
Saves 0.5KiB text size on Linux GCC 4.9 AMD64 release builds.
Change-Id: I1a1081e09bff4c2116288b8c2616e1bb7ee2bb42
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
This is prone to ambiguities, even though we currently don't run
into them.
Use QChar::isNull() instead.
Change-Id: I71843878b3f4f8a5deae2ef57a6f6628461be216
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
- Remove class DragLabel in draggabletext and add a static creation
function instead since it only has a constructor setting some
properties.
- Use QRegularExpression instead of QRegExp
- Use new connection syntax.
- Ensure compilation with
DEFINES += QT_NO_CAST_TO_ASCII QT_NO_CAST_FROM_ASCII
demonstrating use of QLatin1String vs QStringLiteral.
- Streamline code.
Change-Id: I2e2ddeb40837dba379990836c77fb72ad7263e2d
Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
Recreate QShapedPixmapWindow when the cursor goes to
another X screen.
Change-Id: Ifd4c4281971b23abc45a9f6c0509832a45c31521
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
[ChangeLog][QtCore][QMetaProperty] write() now resets the property if an
empty QVariant is given, or set a default constructed object if the
property is not resettable
Change-Id: I9f9b57114e740f03ec4db6f223c1e8280a3d5209
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Suffix rules are the old-fashioned way of defining implicit rules for make.
We don't need them as we generate explicit rules for all sources we build.
[ChangeLog][qmake] Makefile output no longer contains implicit
suffix rules, as all sources are built using explicit rules.
Change-Id: I4ecfa5b80c8ae33aea8730836f3baf99dd4951dd
Task-number: QTBUG-30813
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Instead of lumping both Objective-C (.m) and Objective-C++ (.mm) sources
into the same pile, passing them on to the same compiler as for C++ (CXX),
with the C++ flags (CXXFLAGS), we follow Apple's lead and treat them as
variants of the C and C++ languages separately, so that Objective-C
sources are built with CC and with CFLAGS, and Objective-C++ sources
with CXX, and CXXFLAGS.
This lets us remove a lot of duplicated flags and definitions from the
QMAKE_OBJECTIVE_CFLAGS variable, which in 99% of the cases just matched
the C++ equivalent. The remaining Objective-C/C++ flags are added to
CFLAGS/CXXFLAGS, as the compiler will just ignore them when running in
C/C++ mode. This matches Xcode, which also doesn't have a separate build
setting for Objective-C/C++ flags.
The Makefile qmake generator has been rewritten to support Objective-C/C++
fully, by not assuming that we're just iterating over the C and C++
extensions when dealing with compilation rules, precompiled headers, etc.
There's some duplicated logic in this code, as inherent by qmake's already
duplicated code paths, but this can be cleaned up when C++11 support is
mandatory and we can use lambda functions.
Task-number: QTBUG-36575
Change-Id: I4f06576d5f49e939333a2e03d965da54119e5e31
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
Core Foundation Framework forwards notifications about socket activity
through a callback function which called from the run loop.
The default behavior of Core Foundation is to automatically re-enable the
read callback after each notification, and we explicitly enabled the same
behavior for the write callback.
With this behavior, if the client did multiple recv() calls in response to
the first notification in a series of read notifications, the client would
still get the QSocketNotifier notifications for the data that was already
read.
To get rid of these extra notifications, we disable automatically re-enabling
the callbacks, and then manually enable them on each run loop pass.
Task-number: QTBUG-48556
Change-Id: I0b060222b787f45600be0cb7da85d04aef415e57
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
if t >= QMetaType::User, we would not return false nor call convert.
We would then pass a pointer to whatever is in the QVariant to the
qt_metacall that is expecting a pointer to an object of a different type.
Since we have custom converters, we can call QVarent::convert even for
custom types anyway.
[ChangeLog][QtCore] Fixed crash when setting a QVariant of a different
type to a property of a custom type. Attempt to do a conversion instead.
Task-number: QTBUG-40644
Change-Id: Ib6fbd7e7ddcf25c5ee247ea04177e079f6d7de35
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
The list with taken indexes (selected items) was created in reverse
order but then retrieved from beginning. This was causing unexpected
rotation of the moved items.
Task-number: QTBUG-45320
Change-Id: I858d9af7b838bbd2618442c176dac0648b3512c4
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
arg(const QString &a, int fieldWidth, QChar fillChar) was being called
and that's not what we want.
Found with clazy static analyzer
Change-Id: Ia5051bb2f979af496038c66580d199262b6cfa8b
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
Fixes the following warning [-Wnonnull]:
warning: null passed to a callee that requires a non-null argument
Change-Id: I52f7dc338afdcfe0cd605281d1bf59025abb5ac6
Reviewed-by: Jake Petroules <jake.petroules@theqtcompany.com>
Also re-enable and update the tst_showWithoutActivating test.
Change-Id: Ic7fa9b1bf7637e4661c593aaeabb3220cd4204ff
Task-number: QTBUG-46098
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Make all containers (excepting QVarLengthArray)
- nothrow default-constructible
- nothrow move-constructible
- nothrow move-assignable
- nothrow swappable
[ChangeLog][QtCore] All containers (with the exception of QVarLengthArray,
but including QSharedPointer) are now nothrow_default_constructible,
nothrow_move_constructible, nothrow_move_assignable, and nothrow-swappable.
Change-Id: I12138d262f9f7f600f0e1218137da208c12e7c0a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
There was a copy ctor, a move ctor was missing.
Change-Id: If09a4d4c74682169759eff43b298f6c77702c169
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
QVersionNumber is now public API.
Change-Id: I5b21b6ce5f1651158b6f29bc6f06e5d4e133bed8
Reviewed-by: Keith Gardner <kreios4004@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
OldPersistentIndexes store selected items during sort operation. They
were wrongly taken from static list of indexes. This change takes them
from parent (QTableWidget) who maintains the list of selected segments.
Task-number: QTBUG-48408
Change-Id: Ie1bc4071a275dd76d113d883ab30ccd4cb1fa625
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Commit 7f5b94b47 moved shortcut handling into QGuiApplication (for all
platforms except OS X), due to crashes on Android where the events are
delivered from another thread.
Now that we have synchronous event delivery (also across threads) from
QPA, this is no longer needed, and we can move the code back to QPA,
where the platform has more control over when and how shortcut events
are delivered in relation to normal key events.
Handling shortcuts is as before a two step process. We first send a
QKeyEvent::ShortcutOverride event to the active window, which allows
clients (widgets e.g.) to signal that they want to handle the shortcut
themselves. If the override event is accepted, we treat it as the
shortcut not being handled as a regular shortcut, and send the event
as a key press instead, allowing the widget to handle the shortcut.
If nothing accepted the shortcut override event we pass it along to
the global shortcut map, which will treat the event as handled if
an exact or partial match is found.
The QShortcutMap::tryShortcutEvent() and nextState() implementation
has been simplified to not use the events accepted state for its
internal operation, which removes the need for saving the state
of the incoming event.
The QKeyEvent::ShortcutOverride event was also always sent with
the accepted state set to false, by calling ignore() on it before
sending it. This is now explicit by having shortcut override
events being ignored by default in their constructor, and the
documentation has been updated accordingly.
Change-Id: I9afa29dbc00bef09fd22ee6bf09661b06340d715
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
Reviewed-by: Christian Stromme <christian.stromme@theqtcompany.com>
QT_POINTER_SIZE is determined by the configure test ptrsize,
which has been observed to fail due to unrelated build issues.
Add a check to verify the correct size.
Task-number: QTBUG-48525
Change-Id: I4fcb9761b54370b39c0d3e1e0a6d0aa3c0223f40
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Instead of blindly leading each parameter name with a space, check
if the data type name is empty first. This prevents extra spaces
from appearing in QML method signatures, which can be documented
with parameter names only, without data types.
Change-Id: I726f8c29839430186fcae4ac19d00404233395e0
Task-number: QTWEBSITE-691
Reviewed-by: Martin Smith <martin.smith@digia.com>