openStandardStreamsFileDescriptors and openStandardStreamsBufferedStreams
fail on OS X: lseek somehow works on sequential streams (standard streams)
but QFile has pos() == 0 (since it's sequential).
Change-Id: I6a6161c012a91de189f59c533880fb8fe7a66d37
Task-number: QTBUG-49841
Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@theqtcompany.com>
This patch fixes drag and drop operation on XCB platform when window
will be hidden. The window can be hidden during dnd operation by
switching virtual desktops or by minimizing all windows (show desktop)
using key shortcut.
The ShapedPixmapWindow must grab mouse before dnd operation if mouse is
not grabbed by other window (like in Qt4).
Task-number: QTBUG-46243
Change-Id: I807bc842719a2d0ea0f4dcb733c06c1fd08813e1
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
... instead of rolling your own.
qLoadPlugin() expects the create() method of the Plugin
class to take at least the QString key. Since this plugin
create() method doesn't take one, supply a wrapper.
Change-Id: I690fecd3390cc706a45f40ba06dda2b952ff0d85
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
... instead of rolling your own.
qLoadPlugin() expects the create() method of the Plugin
class to take at least the QString key. Since this plugin
create() method doesn't take one, supply a wrapper.
Change-Id: I5b90b4b87e83f2e8a2e8942b792bb39b87d5f2de
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
If we select XInput events, then when the mouse is clicked, there will
not be a fallback to a core pointer event. But a typical Qt application
doesn't own the root window. If the window manager (such as OpenBox,
Awesome or fvwm) relies on receiving core pointer click events, e.g.
to show a desktop menu, then each time a device is hotplugged while a
Qt application is running, we would select XI2 events and thereby
prevent the window manager from receiving them.
QDesktopWidget's native window is added to m_mapper, even when
it isn't mapped. Then after hotplugging there's a hierarchy event,
and that calls xi2Select for every window in m_mapper. The assumption
with this patch is that the root window does need to be in m_mapper
in case the QDesktopWidget is shown (that was done already in Qt 5.1:
fca94fa5ed), but xi2Select must avoid
selecting XI2 events on it to fix this bug.
Task-number: QTBUG-49952
Change-Id: I5c160e879d93fadfce14120ef2e89a4f71d4f599
Reviewed-by: Uli Schlachter <psychon@znc.in>
Reviewed-by: Paul Olav Tvete <paul.tvete@theqtcompany.com>
Each QGtk2*DialogHelper class owns a QGtk2Dialog. It is possible that
QGtk2Dialog's parent window is destroyed before QGtk2*DialogHelper.
Then the QGtk2Dialog is destroyed, because of the QWindow parent/child
relationship. Before destroying QGtk2*DialogHelper,
QQuickPlatformFileDialog calls QGtk2*DialogHelper::hide, which will
then operate on the already destroyed QGtk2Dialog.
Break the parent/child relationship when QGtk2Dialog's parent is
destroyed.
Change-Id: Ie2bda234f759e7bf4d0642accd82fdc38e0379c2
Task-number: QTBUG-49203
Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
In 50bf54c invoking windeployqt was only required in release mode as
MDILXapCompile was not invoked for debug builds with Visual Studio 2013.
However, Visual Studio 2015 invokes MDILXapCompile for debug and
release. Hence we have to use this workaround unconditionally.
Also we cannot limit this to msvc2015 host specs only, as older projects
still might be loaded with Visual Studio 2015 causing the build to
break.
Task-number: QTBUG-49815
Change-Id: Ia120a392967319b945a9746ad489f2db0eed7156
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
Windows 10 requires apps to handle the PrelaunchActivated property. This
enables a faster startup by launching an app and immediately suspending
it. This happens by the system and at the time the user launches the app
no library loading or initialization is required.
By default we opt-out of this and return early. The reason is that we
cannot know the type of application written in Qt and whether it breaks
the guidelines by using prelaunch. For further details check here:
https://msdn.microsoft.com/en-us/library/windows/apps/mt593297.aspx
Task-number: QTBUG-50292
Change-Id: I4d0b0b95a03f93b99211d042895404a88ea7cb9d
Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
qstrtod() used to accept trailing junk until libdouble-conversion was
introduced and we need this behavior in order to implement EcmaScript's
parseFloat() correctly. The QString and QByteArray methods should not
accept trailing junk, though.
Task-number: QTBUG-50131
Change-Id: Ide922da0d65b2576be2c9f47f6053057eff77994
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
- Use perfect forwarding for the additional argument.
- Provide a variadic template version
- Deprecate qLoadPlugin1() — there's no reason for a different name
— and fix all callers in qtbase.
- Provide non-variadic overloads for up to three additional args
(QPlatformIntegration rolled its own function because it needs
three args).
Change-Id: I72fb2dd9a021de704cbf5e4b6ea31c80447fb3b1
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
The use of QPair made the return type of initializeAnimation()
so complicated, that the original author opted to declare the
pair on one line, then assign to it in the next, to keep below
the line length limit.
She also copied a member of the pair just so as to give it a
descriptive name.
Fix both by introducing a small result struct. It has a nicer
name, compared to the pair, but still port callers to use 'auto'.
The member names are descriptive enough now.
Saves more than 0.5KiB in text size on optimized GCC 4.9 Linux
AMD64 builds, too.
Change-Id: I7ed007ffa0fb16e182e38cd405cfd54da4e363fb
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
Instead of using a "custom wait function" in cases,
where a timeout is needed (like in qhostinfo_winrt.cpp)
we should have the timeout as part of our await
function.
By having one common place to handle this, we can avoid
unnecessary warnings, that might be caused by custom
functions. The current implementation in qhostinfo
for example causes at least 1 "originate error"
exception per call.
Change-Id: I7b6cfdfd861af2b0d271465eecaefe4a93e3109b
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@theqtcompany.com>
By using await instead of using a custom wait function we
get rid of a lot of "function was called at an unexpected
time" warnings and use the default way of waiting for an
asynchronous function to complete.
Change-Id: I6c5bf73ccf68a219b8f3facd3531873d7e8d4c67
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@theqtcompany.com>
That API has been available for WinRT and Windows
Phone for some time now. By using it to get the
machine name and for hostname resolution we can get
rid of some winrt-only code and use qhostinfo_win.cpp
on WinRT and Windows phone as well.
Additionally the required capability was added to
tst_qhostinfo so that this auto test can be run without
any manual editing.
Change-Id: I63fa5521bf8cdb0c919bd5a0100ea977c865622a
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@theqtcompany.com>
Windows Phone 8.1 provides access to the camera button and press/release
events get passed as Key_CameraFocus and Key_Camera. Unfortunately a
release does not provide what has been pressed before, hence this
information needs to be cached when the press happens.
Done-with: Maurice Kalinowski<maurice.kalinowski@theqtcompany.com>
Task-number: QTBUG-39115
Change-Id: I6ce58a1f07a6bf7183b8d99a26e5cd7b0d32d6db
Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
Reviewed-by: Samuel Nevala <samuel.nevala@intopalo.com>
Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
This test seems to be quite broken on OS X: qWaitForWindowExposed returns
too early (while no window is on screen) so gestures can not be dispatched
QApplication::topLevelAt(pt) - returns null.
Use qWait + isExposed combo instead (similar to qWaitForWindowExposed, but
there is no isExposed test before the loop).
Change-Id: I85fbd773ccce0ca92b2dceb1749d67ef767aa0cf
Task-number: QTBUG-49849
Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
_panTimer has a target - for example, widget. 'reset' should stop this timer.
The problem (quite subtle and difficult to reproduce) found in tst_QTouchEvent:
widgets created/destoryed by different tests but we still can have a timer
waiting for event dispatcher to 'processEvents', firing with now-invalid
dangling pointer - 'target'.
Change-Id: Iccaf3368a8ee6a0a2f60e9dcdf5d40fb7392ca21
Task-number: QTBUG-49844
Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
Saves just under 5.5KiB in text size on optimized GCC 4.9 Linux
AMD64 builds.
Change-Id: I6d868a7d2e469cf0564127b0e66cd7b272a0c9cd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
A QStringList is almost as efficient as a QVector<QString>.
More importantly, the QStringList case can share code with
the myriad of other QStringList users, in particular
because std::stack is but the thinnest of wrappers around
its underlying container.
Saves 1400b in text size on optimized GCC 4.9 Linux AMD64
builds.
Change-Id: If37ed55802aa8a529ca772df465990ded0aaba7f
Reviewed-by: David Faure <david.faure@kdab.com>
... by not re-creating the same string in every loop iteration.
Change-Id: If17c5980bec8276b531267b309578dac8901c93e
Reviewed-by: David Faure <david.faure@kdab.com>
Trying to set data for a compressed cubemap texture face fails, because
the code incorrectly tries to bind to a cubemap face target.
This was already fixed for uncompressed textures. Instead of duplicating
the code, moved the texture binding/unbinding code to a RAII class.
Change-Id: I8f1cb7fc661b919200f85c3465d6e6e3c22d0871
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
When using cipher algorithms with forward secrecy an ephemeral key is
used to generate the symmetric session key. Beside the SSL certificate's
key, this ephemeral key is of cryptographic interest.
The ephemeral key is chosen by the server side - currently statically in
the Qt implementation - so it is only of interest on the client side to
check it. Therefore the ephemeral key is the null key if the connection
is set up in server mode or a cipher without forward secrecy is used.
Change-Id: If241247dbb8490a91233ae47f2b38952c6591bf4
Reviewed-by: Markus Goetz (Woboq GmbH) <markus@woboq.com>
QApplication::wheelScrollLines() was always 1 due it being a bool.
Task-number: QTBUG-49561
Change-Id: I83e97da3507c31dfd024db7bf543c4e6a3b4a98b
Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
The #if had a condition that was needlessly hard to understand;
and was widely separated from its #else clause.
Change-Id: I43f4282993f4f2e8c4b5ad07dc2c2e06a6b95aa9
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
There is no need in special OS dependent code now, because the
socket notifiers got the identical behavior on all platforms.
Change-Id: I53ee51cd5eeff328e0b73f7325d2c9e883c5b213
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Markus Goetz (Woboq GmbH) <markus@woboq.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Qt uses QHash as the container for faking environment variables on
Windows Runtime and CE. Environment variable manipulation functions are
protected by mutex. Accessing the QT_HASH_SEED environment variable
inside QHash can lead to situation where qputenv() call leads to
qgetenv() call and that leads to a deadlock. Change the container
from QHash to QVector to avoid deadlock.
Task-number: QTBUG-49529
Change-Id: I550ead4ab12e7abebc044f52339063a44fcf0170
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@theqtcompany.com>
The latter is much faster as it doesn't have to deal with
time zones.
This change is safe because QNetworkHeadersPrivate::fromHttpDate(),
used as the QDateTime source in other, nearby, code paths, also
returns only UTC date-times. So not only is this change faster at
the call site, it also avoids inconsistent-timespec comparisons
down the line.
Credits to Milian Wolff, from whose QtWS15 talk this advice is
taken.
Change-Id: I26d308a2763cc45d28bc96871e651f30b17a6b85
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Saves more than 1KiB in text size on optimized GCC 4.9 Linux
AMD64 builds.
Change-Id: I1a974e903bc8352af800fa26edae0194c1e51705
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The old code asked each thread to stop, and then waited for
that one thread to finish before deleting it and turning
to the next thread in line.
Split the three actions, ie. first ask all threads to stop,
then wait for all threads to finish, and only then delete
all of them.
Apart from being more icache-friendly, this enables more
concurrency, as stopped threads' cleanup work can overlap
with other's, thus reducing the wait() time per thread to
potentially zero.
Did not replicate the inefficient foreach loop, but went
with C++11 range-fors directly.
Change-Id: I53e598e31999a772c0f81ff5885490216e13d492
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Saves more than 4KiB in text size on optimized GCC 4.9 Linux
AMD64 builds.
Change-Id: Ice3fe915622a399d1ed10e0ce364cf54b4b835fe
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Saves a bit over 2.5KiB in text size on optimized GCC 4.9 Linux
AMD64 builds.
Change-Id: I18a635d65a3c20c4bf5ec2cbfa4ed81a8153cab3
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Saves just shy of 4KiB in text size on optimized GCC 4.9 Linux
AMD64 builds, iow: ~0.07% of the total QtCore library size.
Change-Id: I87fdcc8ee25c6bb5dabddb9a694ab4496b1538fa
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Saves just shy of 6KiB in text size on optimized GCC 4.9 Linux
AMD64 builds, iow: ~0.1% of the total QtCore library size.
Change-Id: I087e1e34a64944affb1211e16371e314012c4b2c
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Not many left. Still 344b saved in text size on optimized
GCC 4.9 Linux AMD64 builds.
Change-Id: I51ba49fe065854f84e26d25d7da5e26427ea2c0b
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Saves 327b in text size, but done mainly because such
functions shouldn't be inline in the first place.
Change-Id: Ieea97f13620e4411dc01cb0d390bd668c13cfa7a
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
...to turn mutable lvalues into const lvalues.
Like the proposed std::as_const, it should not apply to
rvalues to avoid lifetime issues in code like
for (auto x : qAsConst(someFunc()))
// dangling
At a more basic level, qAsConst isn't useful for rvalues,
because one can always store them in an lvalue first, with
no loss in performance (the object is created by the
compiler silently anyway). So the correct way to write the
above is:
const auto funcResult = someFunc();
for (auto e : funcResult)
To fail compilation when passing rvalues, I used the
const-&& pattern also employed by std::cref(), and the
proposed std::as_const.
Intended as internal API, but not put into the QtPrivate
namespace to make it simpler to use.
We could wait for std::as_const, but that is far, far
away (just entered the current C++17 draft as of this
writing), and the Qt containers with their tendency to
detach are a problem _now_.
Change-Id: I8824a59d2274de5c5cd642f117212322e4648025
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
It makes tst_QMutex::contendedQMutex with no msleep 8 times faster
Change-Id: Ic300e7618b4467e4e08b30f0213bd23c06d4d90a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>