A QDockWidgetItem will be leaked if a QDockWidget is dragged out of a
floating tab window, and then plugged back somewhere.
The problem is that QMainWindowLayout::unplug was not returning the
QDockWidgetItem* from the floating tab's layout. When that's the case,
a new QDockWidgetItem is created in QDockWidgetPrivate::startDrag
and will be put into the layout, leaking the old QDockWidgetItem.
Change-Id: Ifb9c1c562cb74383ebff1df0f91ee225c5cdb296
Reviewed-by: Sérgio Martins <sergio.martins@kdab.com>
Replace an array of pairs of pointers with an array of pairs of
arrays. Remove the unused end marker. Add a static_assert to
verify that the size of the array matches the constant all loops
use.
Also extract the common part of the mime-type name and append it when
building a QByteArray from it. This is free, as both the new
QStringBuilder expression as well as the old construction from a const
char * incur one memory allocation each.
Replace one indexed loop with ranged-for.
Results on optimized GCC 6.1.1 Linux AMD64 builds:
text -96B
data -160B
relocs -16
Change-Id: Ic23eb06bacbf70afb6f60e2fb8a140bdd3880aca
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Turn arrays of pointers into arrays of arrays.
Results on optimized GCC 6.1.1 Linux AMD64 builds:
text -264B
data -512B
relocs -43
Change-Id: I0b64615913d50c286596e66675e89758ce1ec2ba
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Remove the dead QByteArray(data, size) fall-back. We've been
requiring lambdas since Qt 5.7.
Change-Id: I4d9023ab4583f2ee80a74a828fba0d95c2fdb0df
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Instead of contains()/value()/remove(), all of which perform a new
lookup, and a new application of qHash(), get an iterator using
find(), deref it, then pass it to erase().
Also add some optimistic std::move().
Change-Id: I27a623dcd974de9c67d11d030e9b98d7598efc93
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Instead of the incomprehensible "names" .first and .second, the code
can now use .index and .path.
Change-Id: I1449ba668f703b9a8b9391b0a0774072c8c6e8aa
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Fix a couple incorrect references to the integer precision classes.
Update snippet to use floating point precision classes.
Task-number: QTBUG-51630
Change-Id: I9b08cfb68937a8e1179ee414d7981956ef7bc106
Reviewed-by: Martin Koller <kollix@aon.at>
Reviewed-by: Michael Brüning <michael.bruning@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
The call to trimmed() makes sense for URLs typed in a browser's location bar,
but its use in every code path made it impossible to open a file with a trailing
space in command-line tools that uses fromUserInput(cwd) to handle command-line
arguments, as recommended. For instance kde-open5 "file.txt " would fail.
Change-Id: Ie61182684521d91f077d3e76f95b7240965ab405
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This allows to test specific filenames without polluting the current dir.
Change-Id: Ieb99019a2e37e30f294d85c5d80af1de1b919019
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
operator=, which was only used for clearing, wasn't clearing the hash.
This led to a mismatch between the vector and the hash (given that the hash
points into the vector).
Spotted by interrupting kmail in gdb, and it was in this code
iterating over a 2000 entries hash (the first vector entries not matching
the hash, this code keep appending new entries for the same formats).
This fixes QTBUG-8862 again, the initial fix having been accidentally
reverted in 467b15a.
Change-Id: Ia34b3d002a0199e1930431a4bbdb2ec981ed4ffc
Task-number: QTBUG-8862
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
This is mostly straight-forward, but some things are worth noting:
1. Yes, this is necessary. The noexcept operator looks for noexcept tagging,
not at the contents of the function to determine whether to return true.
The more conditionally-noexcept functions are used, the more important it
becomes that low-level classes are correctly marked noexcept. In that, it
is like constexpr.
2. In accordance with the rules governing noexcept specifications for the
standard library itself, the set*Stretch() functions are not marked as
noexcept, since they have preconditions and thus a narrow contract.
Narrow-contract functions should not be noexcept. All other functions
have wide contracts (ie. no preconditions).
Change-Id: I853e0fc2d98cf3fcb16402a18ab136cccca24d89
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The default query type for QNetworkProxyQuery is TcpSocket (that's what
our QNetworkProxy::applicationProxy() requests). Unfortunately, this
can result in http_proxy found and QTcpServer::listen() failing
(probably, QUdpSocket is also affected). So now we extract applicationProxy's
logic but modify it to provide the exact query type we need.
Task-number: QTBUG-58706
Task-number: QTBUG-41053
Task-number: QTBUG-58374
Change-Id: I79ce0efb779bbaf08afd78c44cbe92d08730152b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
As recommended in API review: use 'is...STS...Enabled' and 'set...STS..Enabled(bool)'
function names instead of stsEnabled and separate enable/disable functions.
Replace QList with QVector in the public API.
Change-Id: I1526124c830450058967ebc192d27575cc89292d
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Ensure that tablet moves are delivered iff tabletTracking is true.
Task-number: QTBUG-26116
Change-Id: Iaa360e181f0c6484cfbde6fa5365f2f0dc77433a
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
It's only used in the autotests, and it private API, so
downgrade from Q_CORE_EXPORT to Q_AUTOTEST_EXPORT.
Fix a use of QTimeZonePrivate functions unprotected by
QT_BUILD_INTERNAL in tst_qtimezone.cpp.
Change-Id: I70eaea06f8fcf2983aeafb6894c3a5d2a4b272a7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This adds the tabletTracking property in the same way that mouseTracking already
existed: there is a WA_TabletTracking attribute, and a TabletTrackingChange event
to notify when it changes. So for widget applications it's an opt-in feature.
QtQuick applications don't yet make use of tablet events, but when they do
in the future, we don't yet have a mechanism to turn the move events off;
it remains to be seen whether that will be necessary.
[ChangeLog][QtWidget] QWidget now has a tabletTracking property, analogous
to mouseTracking, which will enable TabletMove events while the stylus is
hovering, even if no button is pressed. This allows applications to show
feedback based on the other tablet event properties such as rotation and tilt.
Task-number: QTBUG-26116
Change-Id: Ie96e8acad882b167e967796cdd17f1ad747a2771
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
The main reason for this is to get feedback about the stylus orientation
(angles and rotation) before the user presses it. For example an application
might provide an image of the brush which rotates along with the stylus. As
with mouse events, applications can distinguish hovering by the fact that no
buttons are pressed.
On the xcb platform we need to stop blocking the hover events, and in
QWidgetWindow we need to send the event to the widget being hovered, while
keeping the existing "grab" behavior: after pressing the stylus (or any button
on the stylus or on the tablet), keep sending the events to the same widget
until release.
Task-number: QTBUG-26116
Change-Id: Iaed8b3b94961290dbb29b5fd2ea892fed7221685
Reviewed-by: Dmitry Kazakov <dimula73@gmail.com>
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
This reverts commit 3b38392844.
The change caused test compile failures with MSVC2015 in qqmlsettings;
a variable was not captured in the lambda expression. This appears
to be a compiler bug of MSVC.
Task-number: QTBUG-59096
Change-Id: I3bf5288eb005b2e1661819bb33bc54fb944d0150
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
The QSystemLocale constructor remembers the most-recently-constructed
instance - a dodgy enough proposition at the best of times - and
shares it with much of the rest of QLocale. There is a global static
instance, actually of a derived singleton class, to which it is
usually set on program start-up. However, the constructor deleted the
remembered instance before remembering any new instances; there was no
way this could not lead to bad consequences. So let's not do that.
Change-Id: Ie8f3d655c9d4f75f6ec00a5861d98d6020ecc633
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
In 0ae4b948515af904dba397448839056d9b7965af, we added a work-around
specifically for the Android emulator, causing it to override the
precision qualifiers in shader code, since the emulator would send
the shader code directly to the host OpenGL driver and thus there
was no guarantee that the qualifiers would be supported.
Since then, the original issue with the emulator has been fixed,
so now Qt applications are failing because of the work-around.
[ChangeLog][Android] Removed old work-around which was causing
OpenGL shader compilation to fail on updated Android emulators.
Task-number: QTBUG-44697
Change-Id: I0da879b3a8fbe7cb2d0969cdf45664d0b3499891
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
Sometimes, users need to add compiler flags to QMAKE_CXXFLAGS that
aren't supposed to be passed to the predefs dump. That's especially true
for -include options, as that would change completely what's
defined. Not to mention that -include is a preprocessor option and
shouldn't be in CXXFLAGS in the first place (Automake has CPPFLAGS, but
qmake only has INCLUDEPATH and DEFINES).
[ChangeLog][qmake] Added the ability to suppress the collection of the
compiler predefined macros for moc's use. To disable the collection, use
CONFIG += no_moc_predefs.
Task-number: QTBUG-58857
Change-Id: I4139d5f93dcb4b429ae9fffd14a34d49825d9b85
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
There's nothing wrong with cloning a const QTimeZonePrivate, so make
clone() const.
Also, if you're cloning a QTzTimeZonePrivate, you already know that
you get a QTzTimeZonePrivate back. C++ supports covariant return types
for this reason, so use them.
Change-Id: I60e19e89b1b7bad080c552f1baca314ab0a6295e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
- Don't init m_icu with 0. It's a QSharedDataPointer, which inits to
nullptr anyway.
- The copy ctor didn't do anything out of the ordinary, so = default it.
It's also only used in the implementation of clone(), so make it private.
Removes three #if QT_CONFIG blocks.
We can't use ctor delegation here, because systemTimeZoneId() is a
virtual function.
Change-Id: I2cd06c3349686b6f21c897acb5c12185a36d5b9f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
MSVC 2013 complained:
src/corelib/tools/qbytearraymatcher.h(143) : warning C4351: new behavior: elements of array 'QStaticByteArrayMatcher<6>::m_pattern' will be default initialized
Fix the same way as 9a07ab9234: by suppressing
the warning.
Change-Id: Ic41f7eabe7e39709d76e6062f5891cdcfaa6e1ed
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Unfortunately, that ctor also takes a ControlType argument (defaulted),
and calls the non-constexpr, non-inline function setControlType().
In order to make at least the two-arg version constexpr, I added
a use of the ternary operator to check for type == DefaultType,
making all calls of the ctor that use type == DefaultType
constexpr. For init'ing an aggregate type without ctor in the
ctor-init-list, I needed to require uniform initialization, too.
C++11-style constexpr cannot call void functions, so I needed
to extract the transformation part of setControlType() into a
new function that returns the result instead of storing it directly.
Saves a surprising 2K in QtWidgets text size on GCC 4.9, AMD64 Linux
stripped release builds.
Change-Id: Ib4adf5fd6e54d5345dbfe1c298554278faf13c58
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
This is one of the pillars of my static container checking toolbox,
one of the main checks being that every type put into a Qt container
has been marked up with Q_DECLARE_TYPEINFO.
Obviously, we cannot upstream such a checker and inflict it upon the
world, but we can put some foundations in. This is the most central
one.
Change-Id: I9185facb2f37ba9fcc12c9aae5675eed454d755c
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
A window can resize while dragging, this happens on Windows when dragging
across screens, to a screen with a bigger scale factor. When that occurs
it might lead to the press pos being outside of the window.
Change-Id: Ic61ec7088c8fa81395d43ce665952dbd2eecba39
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
RunLoopModeTracker as one of Qt Cocoa classes was not wrapped
in namespace which limited its use in Objective-C single symbol space.
Change-Id: Ida2c62c6f543a3bf5107f28c78d27435bcb3470d
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
This is still not a great place for it, but this way we can
Q_REQUIRE_CONFIG(library) in qlibrary_p.h and qfactoryloader_p.h is the
only private header that doesn't require library support in plugin.pri.
Change-Id: Ia6c1ac8799822eca1e0cbeca98d1c1b8de74beae
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Make it iterate the addresses available looking for an IPv4 address,
when that's what it needs, instead of just assuming the first entry in
the list (when non-empty) is IPv4.
Based on a suggestion by Dmitry Pankratov.
Task-number: QTBUG-27641
Change-Id: I1920f68ade44a996ea5c2ed691a87ff3e686f35a
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Instead of the incomprehensible "names" .first and .second, the code
can now use .content and .type.
Change-Id: I7fe320ded33a07fb8ff77ac96c17fc5ee1079da3
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
The cancel() function added in 5b11e43e for Qt 5.5 suffers from a
number of problems:
First, if runnable->autoDelete() is true, then the function suffers
from the ABA problem (see documentation written for trytake()).
Second, if runnable->autoDelete() is false, due to cancel() throwing
away crucial information instead of returning it, the caller cannot
know whether the runnable was canceled (and thus has to be deleted),
wasn't found or is currently executing (and thus mustn't be deleted),
or has finished executing (and can be used to extract the result).
Deprecate this dangerous API and replace it with the much more useful
Private::stealRunnable(), promoted to public API and renamed to
tryTake() for consistency with the rest of Qt.
Described the various caveats in the function's documentation.
[ChangeLog][QtCore][QThreadPool] The cancel() function suffers from
several subtle issues and has been replaced with a new tryTake()
function.
Change-Id: I93125935614087efa24b3e3969dd6718aeabaa4f
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
We define QT_STATICPLUGIN for the plugins in this case, so that they
define the factory functions needed to link them directly into the
test.
Change-Id: I0f2de7bf6bec5a6d53ec9ad92536817c1221b7d5
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Since this table was restructured in 7c401397a4 and changed to
being indexed bitwidth and not format, NEON-enabled builds have
been writing to an undefined place after the table.
Discovered by compiler warnings on CI.
Change-Id: I109cd19a8dd703bdafdf13afd3f96ebeaa0e6de5
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
We fully specialize QTypeInfo for most C++ built-in types,
but enums and extended integral types (like GCC's int128_t)
were not covered.
Now that we depend on <type_traits>, we can stop pessimizing
enums and extended integral types in QVector and QVLA by
defaulting QTypeInfo::isComplex to true for such types.
Fix a test that checked that enums were complex types. This should
have been a XFAIL test. Enums are not complex types.
Change-Id: Ibb0fb38cc83e980a428b5573d1db5666593418ae
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
... except in QList.
When dafa3618 introduced isRelocatable and QTypeInfoQuery, the
intention was to decouple the memory layout of QList from the
reallocation optimizations in QVector. This never happened, as
QVector (and QVarLengthArray) continue to use isStatic to this
day.
Fix by porting both QVector and QVLA to QTypeInfoQuery and
isRelocatable.
Change-Id: I6951f2cf21f0cbb24e2dbd38f80f1bd82007d394
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
... but default-initialization instead.
This bug may have rendered the diverse Qt::Uninitialized ctors
we have in Qt containers ineffective.
Change-Id: I5a369fa8527f19b6f8cc1a9f36512f6a0058839a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Instead of setting the mask in toggleFullScreen(), which is only hit
when going to fullscreen via our own API, we do it in the window
notification callbacks, which also includes going to full screen via
the native macOS title bar buttons. This allows making customized
windows without Qt::WindowMaximizeButtonHint full screen with the
full geometry of the screen.
Change-Id: I63c3e4582ea7c4fe8c0008265793c5f656b830b2
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
... as a replacement for QPair<QString, int>, and move some
repsonsibilities into it.
This avoids the repeated use of the magic number INT_MIN to indicate
absence of an offset and does away with the confusing .first and
.second, replacing them instead with proper names, .name and .offset.
Change-Id: I0f6906467b8efa16bed2bf5677f2bbbd534da1ae
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The platform plugins reading this out of the QWindow was a layering
violation, and propagates the notion that a window can shape shift
into representing a new native handle, while none of the platform
plugins support this.
A foreign QWindow is created via the factory function fromWinId(),
at which point we can pass the WId all the way to the platform
plugin as function arguments, where the platform will create a
corresponding platform-window.
The platform window can then answer the question of whether or
not it's representing a foreign window, which determines a few
behavioral changes here and there, as well as supplying the
native window handle back for QWindow::winId();
[ChangeLog][QtGui][QWindow] The "_q_foreignWinId" dynamic property
is no longer set nor read.
[ChangeLog][QtGui][QPA] The function createForeignWindow() has been
added to QPlatormIntegration and is now responsible for creating
foreign windows. The function isForeignWindow() in QPlatformWindow
has been added, and platforms should implement this to return true
for windows created by createForeignWindow().
Task-number: QTBUG-58383
Change-Id: If84142f95172f62b9377eb5d2a4d792cad36010b
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
Pass classname 'exefile' to ShellExecuteEx() for UAC prompt.
This allows running executable files that do not have a .exe extension.
Task-number: QTBUG-59008
Change-Id: I88d669481e893db50edccd7b30259e5366477556
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
now that it works nicely, make use of it for the zlib deps, which are
not transitive when the detected library is built statically.
Change-Id: Iaed87a37b36f714f0b919244cd84809650102ba9
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
these statements are assumed to provide dependencies for the currently
detected library. this implies that their resolved content must be
passed to the linker after the to be detected static library.
Change-Id: Ifaaee2ac71bf176e8a0033765fb979fe119deaba
Reviewed-by: Lars Knoll <lars.knoll@qt.io>