Commit Graph

42314 Commits

Author SHA1 Message Date
Volker Hilsheimer
6e1d70ae12 QPushButton: only trigger button when click occurs within the bevel rect
On the mac, the push button's bevel doesn't cover the entire widget
rectangle, but is smaller to leave space for focus frame, shadow, and
in general to meet style guidelines. Without this change, a click
anywhere inside the widget would activate the button.

QAbstractButton::hitButton can be reimplemented to limit the area in
which the button is triggered. However, getting the rectangle also
requires an addition to QStyle, so that we can query
QStyle::subElementRect for the actual area the button's bevel covers.

As a side effect, tests that use QPushButton and assume that it
responds to clicks at position 0,0 have to be fixed so that they
don't fail on mac.

Change-Id: I01b60a763bccf39090aee5b2369af300f922d226
Fixes: QTBUG-81452
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2020-01-28 22:26:26 +01:00
Robert Loehning
94bc57213f configure: Add switch for clang's "source-based" code coverage feature
This adds instrumentation to the binaries. At the end of their
execution, these will then write a file containing information which code
was executed. This can be used for code coverage analysis.

[ChangeLog][QtCore][configure] Add switch "-coverage source-based" to
enable clang's "source-based" code coverage feature. This can be used
for code coverage analysis.

Change-Id: If31c6849aa797ff8820e041e85a492a14e2f1a6b
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-01-28 20:26:15 +00:00
Johan Klokkhammer Helsing
a611c632bb Add QWindow::startSystemMove and startSystemResize
This can be used to create custom client side window decorations.

Refactors the xcb implementation to use edges instead of corners and we now use
the last mouse position for `root_x` and `root_y` in the `_NET_WM_MOVERESIZE`
event. Touch has also been changed, so just pick a point that's currently being
pressed.

The workaround for QTBUG-69716 has now been moved to QSizeGrip, as the comment
in the bug report says that it should ideally be fixed at the widget level.

On Windows, we no longer abort when GetSystemMenu returns false. I assume this
code was added to check whether the window didn't have any decorations and not
resize in that case. However, since the point of this patch is to let windows
without native decorations resize/move, it makes most sense to remove the
check.

Adds a manual test, which calls QWindow::startSystemMove and startSystemResize
on touch and mouse events.

[ChangeLog][QtGui] Added API for starting interactive window resize and move
operations handled by the system.

Fixes: QTBUG-73011
Change-Id: I7e47a0b2cff182af71d3d479d6e3746f08ea30aa
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-01-28 16:52:13 +01:00
Qt Forward Merge Bot
6c3eb39832 Merge "Merge remote-tracking branch 'origin/5.14' into 5.15" 2020-01-28 16:02:04 +01:00
Qt Forward Merge Bot
082faeff9c Merge remote-tracking branch 'origin/5.14' into 5.15
Conflicts:
	src/gui/image/qpnghandler.cpp

Change-Id: I8630f363457bb613d8fb88470a71d95d97cdb301
2020-01-28 08:09:51 +01:00
Joerg Bornemann
fcd3a20059 macOS build: Fix 'direct access in function...' warning
For every executable that uses a static Qt library (e.g. rcc using
libQt5Bootstrap.a) we got a warning: 'direct access in function...to
global weak symbol'.

This was because we've built all libraries with -fvisibility=hidden
-fvisibility-inlines-hidden but not the executables linking against
them. On macOS however, all translation units must have the same
visibility setting.

We're now setting the same visibilty for libs and executables on
darwin.

Fixes: QTBUG-81297
Change-Id: I2668e9385caa7f0ce78bf3727b4e5322bc4a294f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-01-28 07:52:58 +01:00
Christian Ehrlicher
b0c804f345 QComboBox: unify behavior of setModel() and modelReset
When a new model is set, a valid index is selected. When a model is
reset, this is not the case which is slightly inconsistent. Fix it by
using the same logic to find a valid index when the model is reset

Fixes: QTBUG-80998
Change-Id: I6c167511e199a6664343cf1dc3bcd27c65389bfd
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-01-28 06:24:26 +01:00
Christian Ehrlicher
fb7c9dfc06 QButtonGroup: deprecate overloaded signals
Deprecate the overloaded signals
buttonClicked/buttonPressed/buttonReleased/buttonToggled taking an int
to avoid to need to use QOverload<> when connecting the signal. The id
of a button in a button group can be easily fetched with
QButtonGroup::id().

Task-number: QTBUG-80906
Change-Id: Idaaab54bbcb25cba543fc99f305b9f4743ee3ed8
Reviewed-by: Sze Howe Koh <szehowe.koh@gmail.com>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2020-01-28 06:24:25 +01:00
Jarek Kobus
4bb897a384 Deprecate all methods that use QMatrix
Don't use QMatrix in implementation classes anymore.

Task-number: QTBUG-46653
Fixes: QTBUG-81627
Change-Id: I4806c1302e42645dc6a608062c8d9c336ae8629b
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-01-28 04:12:25 +01:00
Friedemann Kleint
be8c257da9 QThread::setPriority() Warn about invalid parameter on all platforms
InheritPriority may not be set, but the warning only occurs on Windows.
Move the warning to the public class.

Change-Id: I51d401300f840e4c1396c2c30182e49ed45d60d2
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Reviewed-by: Christian Tismer <tismer@stackless.com>
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-01-27 14:31:08 +01:00
Sze Howe Koh
e44de91a2c Doc: Clarify usage of Qt::ReturnByValue in QCursor
Change-Id: I6ce2c658dc0e72beb9e7a2497c6dbdbc71d96bc5
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2020-01-27 21:31:08 +08:00
Sze Howe Koh
582311d122 Doc: Replace some usages of 0/zero/null with \nullptr
Change-Id: Ibe7de11fc6fc41477c35e7d653c6a911855deabb
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2020-01-27 21:31:08 +08:00
Venugopal Shivashankar
1ed802e3b8 Doc: Update the stylesheet reference for widgets and richtext
Add the Qt-specific properites to the list.

Fixes: QTBUG-37938
Change-Id: I178de6cd5e17cd282a20ccee9ce8355f540c38a1
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-01-27 11:14:01 +00:00
Mårten Nordheim
a4363030bf QMultiMap: Add unite documentation
I missed copying over the documentation from QMap::unite when
deprecating it.

Amends 4ec6748c6a

Change-Id: I118382c4645bdc679a378e02a462d104b9af9aad
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2020-01-27 08:33:47 +01:00
Christian Ehrlicher
ea4b837fa1 Doc/QtGui: replace some 0 with \nullptr
Replace some 'is 0' or 'are 0' where 0 referes to a nullptr with 'is
\nullptr' and 'are \nullptr'

Change-Id: Ic18d0c8bcf64159b4c8fae8c9499839954a98884
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: Sze Howe Koh <szehowe.koh@gmail.com>
2020-01-26 17:52:03 +01:00
Christian Ehrlicher
2e377f2948 Doc/QtBase: replace some 0 with \nullptr
Replace some 'is 0' or 'are 0' where 0 referes to a nullptr with 'is
\nullptr' and 'are \nullptr'

Change-Id: Ida9af2971924377efe2f49f435d79e109de2bdf4
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: Sze Howe Koh <szehowe.koh@gmail.com>
2020-01-26 17:52:02 +01:00
Christian Ehrlicher
ae9056587a Doc/QtCore: use new signal/slot signature in snippets
Use the new signal/slot syntax in the snippets where possible. Also
change some 0 to nullptr.

Change-Id: Ie3da2721d3cec33704f73f4d39c06a767717b095
Reviewed-by: Sze Howe Koh <szehowe.koh@gmail.com>
2020-01-26 17:52:01 +01:00
Christian Ehrlicher
aec4e05e9e Doc/QtWidgets: replace some 0 with \nullptr
Replace some 'is 0' or 'are 0' where 0 referes to a nullptr with 'is
\nullptr' and 'are \nullptr'

Change-Id: I5ff46185b570bdfc7d20d18a47fd9174771ad8e5
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: Sze Howe Koh <szehowe.koh@gmail.com>
2020-01-26 17:51:59 +01:00
Marc Mutz
f21a6d409e QStringList: use local storage in removeDuplicates()
If available, use a C++17 std::pmr::unordered_set with a monotonic
buffer resource and a 256-byte stack buffer to avoid the per-element
allocations of QSet.

Results on my machine:

 RESULT : tst_QStringList::removeDuplicates():"empty":
-     0.00014 msecs per iteration (total: 74, iterations: 524288)
+     0.000031 msecs per iteration (total: 66, iterations: 2097152)
 RESULT : tst_QStringList::removeDuplicates():"short-dup-0.00":
-     0.00043 msecs per iteration (total: 57, iterations: 131072)
+     0.00013 msecs per iteration (total: 69, iterations: 524288)
 RESULT : tst_QStringList::removeDuplicates():"short-dup-0.50":
-     0.00049 msecs per iteration (total: 65, iterations: 131072)
+     0.00032 msecs per iteration (total: 85, iterations: 262144)
 RESULT : tst_QStringList::removeDuplicates():"short-dup-0.66":
-     0.00057 msecs per iteration (total: 75, iterations: 131072)
+     0.00039 msecs per iteration (total: 52, iterations: 131072)
 RESULT : tst_QStringList::removeDuplicates():"short-dup-0.75":
-     0.00064 msecs per iteration (total: 85, iterations: 131072)
+     0.00048 msecs per iteration (total: 63, iterations: 131072)
 RESULT : tst_QStringList::removeDuplicates():"long-dup-0.00":
-     0.083 msecs per iteration (total: 85, iterations: 1024)
+     0.039 msecs per iteration (total: 80, iterations: 2048)
 RESULT : tst_QStringList::removeDuplicates():"long-dup-0.50":
-     0.11 msecs per iteration (total: 58, iterations: 512)
+     0.078 msecs per iteration (total: 80, iterations: 1024)
 RESULT : tst_QStringList::removeDuplicates():"long-dup-0.66":
-     0.13 msecs per iteration (total: 70, iterations: 512)
+     0.10 msecs per iteration (total: 53, iterations: 512)
 RESULT : tst_QStringList::removeDuplicates():"long-dup-0.75":
-     0.16 msecs per iteration (total: 86, iterations: 512)
+     0.13 msecs per iteration (total: 69, iterations: 512)

When interpreting the data, take into account that each iteration
contains _also_ a deep copy of the QStringList d/t the detach from
'input'.

The pattern is used elsewhere in Qt, so I've put the class that
implements the seen set into a private header file and used in some
other places I found.

Change-Id: I1f71a82008a16d5a3818f91f290ade21d837805e
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2020-01-26 08:11:58 +00:00
Marc Mutz
bf330a8f03 QGestureManager: fix one (of many) inefficient loop(s)
I showed QGestureManager to a colleage and I just couldn't avert my
eyes...

Also remove a pointless container::clear() call (the data member's
dtor will do that implicitly).

Change-Id: Id2b3f471d62e5ea416e875f28ecee73f8614a469
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2020-01-26 08:11:54 +00:00
Friedemann Kleint
859307d7a5 Windows QPA: Provide an experimental palette for dark mode
Provide a simple palette for dark mode, implementing
dark mode support level 2.

Task-number: QTBUG-72028
Change-Id: I6f71870b251ccb7da30c01abb22c224e600f2b27
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2020-01-25 20:33:30 +01:00
Friedemann Kleint
eb26563dd5 Windows QPA: Add setting of dark window borders
Implement dark mode support level 1: change the
window borders to dark and back, tracking the
activation of dark mode.

Task-number: QTBUG-72028
Change-Id: I6e8b31e7ee574f4d90438405f361cd940faee7fd
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2020-01-25 20:33:25 +01:00
Friedemann Kleint
12f085e538 Windows QPA: Add detection of dark mode
Read the dark mode setting and make it accessible
via native interface.
Add a command line option to set the support level.

Task-number: QTBUG-72028
Change-Id: I1e9fe296a6b1bda81512d003183038b866b67545
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2020-01-25 20:33:19 +01:00
Friedemann Kleint
1278995778 Windows QPA: Better disambiguate Window class names
Use a standard prefix for Window class names containing
version, build and namespace which should reduce conflicts.

Task-number: QTBUG-81347
Change-Id: Ia7c20af71d364e362781f791a4e51b77d605c918
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2020-01-25 20:32:58 +01:00
Sze Howe Koh
e79a625381 QCursor: Allow bitmap() and mask() to return by-value
The previous versions of these functions that returned by-pointer are
held over from Qt 1 times. They are inconsistent with the rest of the
Qt API.

[ChangeLog][QtGui][QCursor] QCursor::bitmap() and QCursor::mask()
can now return by-value instead of by-pointer.

Task-number: QTBUG-48701
Change-Id: I3ca4f0c28d5c831727a60309facfb49c74673bb7
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2020-01-26 01:19:55 +08:00
Sze Howe Koh
114ff44f3c QLabel: Allow pixmap() and picture() to return by-value
The previous versions of these functions that returned by-pointer are
held over from Qt 1 times. They are inconsistent with the rest of the
Qt API.

[ChangeLog][QtWidgets][QLabel] QLabel::pixmap() and QLabel::picture()
can now return by-value instead of by-pointer.

Task-number: QTBUG-48701
Change-Id: I23ce319a7b1f757e1f4dec697551bb472e92fabf
Reviewed-by: André Hartmann <aha_1980@gmx.de>
2020-01-26 01:19:38 +08:00
Alexandru Croitor
e9a797799e CMake: Add Qt6 forward compatible CMake API and targets
Create Qt:: versionless targets for libraries and tools. So
Qt::Core will link to Qt5::Core.

Add additional feature properties to targets, with the same name
they have in Qt6: QT_ENABLED_PUBLIC_FEATURES,
QT_DISABLED_PUBLIC_FEATURES, QT_ENABLED_PRIVATE_FEATURES,
QT_DISABLED_PRIVATE_FEATURES, to be forward-compatible with Qt6.
Prefix properties with INTERFACE_ for interface libraries.

Create functions with no major version in their prefix, so qt_foo
instead of qt5_foo.
The non-versioned functions will call the versioned functions,
depending on the value of QT_DEFAULT_MAJOR_VERSION, which can be
set by an application developer before finding the Qt package.

Set QT_DEFAULT_MAJOR_VERSION to 5 if the value has not been defined
in the current scope.

Application developers can set QT_NO_CREATE_VERSIONLESS_FUNCTIONS to
TRUE before calling find_package(Qt5) to suppress creation of the
non-versioned functions.

Application developers can set QT_NO_CREATE_VERSIONLESS_TARGETS to
TRUE before calling find_package(Qt5) to suppress creation of the
non-versioned targets.

Setting these can be useful when both find_package(Qt5) and
find_package(Qt6) are in the same project.
If none of these are set by the user, then the first find_package(Qt5)
will create versionless targets with the major version being "5",
which means the second find_package(Qt6) will not create versionless
targets.

Handle versionless plugin names in qt_import_plugins, so both
Qt::QCocoaIntegrationPlugin and Qt5/6::QCocoaIntegrationPlugin
are recognized by the function.

Allow specifying multiple types in EXCLUDE_BY_TYPE in
qt_import_plugins, to be consitent with the Qt 6 version.

Make sure to set the QT_PLUGIN_CLASS_NAME property to compatible with
Qt 6.

Task-number: QTBUG-74137
Task-number: QTBUG-80477
Change-Id: Ib89d090ea6f7794d7debd64f03f29da963a17ca7
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-01-25 18:10:26 +01:00
Allan Sandfeld Jensen
f3d3c095a6 Register QColorSpace as a QtGui metatype
Helps pass it through QVariant, and needed for QML support.

Change-Id: Id161ff9b8f81ad55a7ee7a7c4c614bdf74bca4a1
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2020-01-25 09:41:11 +01:00
Indiana Kernick
ba1e880fbb QScrollArea: fix off-by-one error in ensureWidgetVisible
If focusRect was 5 pixels past the right side of the viewport, then the
scroll area would need to be scrolled by 5 pixels. The error arises
because of this:

focusRect.right() - d->viewport->width() == 4

focusRect.right() is still inside the rectangle but width is not.
So one has to be added. Likewise for focusRect.bottom() and height.

Change-Id: Ice47a7758d136b2e4bdcbe25a33a015b37f500c1
Fixes: QTBUG-80093
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2020-01-25 17:40:34 +10:30
Andy Shaw
bb42b7d8b2 Make sure the focus is passed on correctly when back-tabbing
When the tested widget has a focus proxy, then we should check if the
current focus widget is not the same as that focus proxy before setting
it to be the widget that gets focus. This ensures that when back-tabbing
from a widget like QDoubleSpinBox that it will not get stuck inside that
widget and will back-tab to the next correct one.

Fixes: QTBUG-81097
Change-Id: I3f689c7715da7f3ce8c3d2f616041528f5778a2f
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-01-25 08:10:32 +01:00
Christian Ehrlicher
5c3b5efd40 QMenu: don't crash when another popup is closed when a popup is closed
When closing a popup (submenu) triggers closing another popup (the menu)
programatically it can happen that QApplicationPrivate::popupWidgets is
destroyed. Therefore we have to check if popupWidgets is still valid
after the focus change event was delivered.

Fixes: QTBUG-81222
Change-Id: Ide3a6897e43f389d396a80d8b158f7c8eb04e3aa
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2020-01-25 08:10:27 +01:00
Christian Ehrlicher
a11267c532 QTextBrowser: deprecate signal highlighted(QString)
Deprecate QTextBrowser::highlighted(QString) to avoid the use of
qOverloadOf<>.

Task-number: QTBUG-80906
Change-Id: I757622c976f7540ecef9225026299ebb0b90d007
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2020-01-25 08:10:25 +01:00
Assam Boudjelthia
236a47ff7a Android: JNI_OnLoad return JNI_VERSION_1_6 instead of JNI_VERSION_1_4
Update instance of old code using JNI_VERSION_1_4 to make the code
consistent.

Change-Id: I779696738caa3b844f4adf33104b4328dba748a5
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2020-01-24 13:14:19 +00:00
Joerg Bornemann
41b919919e Purge the dep_cd_cmd parameter from callExtraCompilerDependCommand
We always pass the same value. The builtins are also using exactly this
"cd command" unconditionally.

This deduplicates the code at the call sites of
callExtraCompilerDependCommand a bit.

Change-Id: I5c412c815d50afdac55e1b45021f37f2545ce8f0
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2020-01-24 13:25:06 +01:00
Joerg Bornemann
16885a6033 De-duplicate the last occurrence of calling a depend_command
Use the central callExtraCompilerDependCommand in the last place where
the code to call an extra compiler's depend_command was duplicated.

Note that this is in the "Bad hack" section. We're making this hack less
bad, but the comment still applies.

Change-Id: Iaa857af20ca46b2d73053d3e264c63124c87a41b
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2020-01-24 13:24:59 +01:00
Friedemann Kleint
3939640965 Fix some qdoc-warnings
src/corelib/tools/qmap.cpp:1199: (qdoc) warning: Can't link to 'QMultiMap::unite()'
src/gui/kernel/qevent.cpp:949: (qdoc) warning: Unknown command '\see'
src/gui/painting/qpaintengine_raster.cpp:344: (qdoc) warning: clang found diagnostics parsing \fn Type QRasterPaintEngine::type() const
    error: unknown type name 'Type'
src/gui/doc/src/qtgui.qdoc:45: (qdoc) warning: Can't link to 'Build with CMake'
examples/widgets/doc/src/gallery.qdoc:28: (qdoc) warning: Cannot find file 'widgets/gallery/gallery.pro' or 'widgets/gallery/gallery.pyproject'
src/widgets/kernel/qwidget.cpp:5950: (qdoc) warning: Can't link to 'setFilePath'
src/widgets/kernel/qshortcut.cpp:542: (qdoc) warning: No such parameter 'context' in QShortcut::QShortcut()

Change-Id: I2395af854efebef719d4762da466f69f7c5aab9e
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2020-01-24 08:13:03 +01:00
Volker Hilsheimer
d31910709c macOS: Decide enabled state of menu items correctly
We use automatic menu enabling, so the only property that should define
whether the item in the menu is enabled or not is QCocoaMenuItem::enabled,
which will then get read from validateMenuItem:, and synced to the native
menu item by AppKit.

Change-Id: I860d05bf4675c9bc2058d2ede44b5ac3551453b6
Fixes: QTBUG-81375
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-01-23 23:36:25 +00:00
Volker Hilsheimer
5b9f6862b1 Mac: disable application menu items during modal session
The default menu items in the application menu are not part of a
traversable menu object hierarchy, so we never find a menubar.
Since that is only the case for those items, we can disable them
during any modal session.

Change-Id: Ie8d8db274176237de664c6e5ebfe5015e13800e4
Fixes: QTBUG-80273
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-01-24 00:36:17 +01:00
Edward Welbourne
08d4caadd7 Prepare callers for QChar-to-QString change in some QLocale returns
The assorted characters making up numbers can potentially need
surrogate pairs for their encoding, so Qt6 shall make the methods
returning them return QString instead of QChar. Prepare callers of
these methods to cope when that happens.

This follows up on commit f91af791cc,
which announced the intent to change the return type.

Task-number: QTBUG-81053
Change-Id: I99896c1d4fc2e24758c6486eaca32fd915b9a673
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-01-23 19:44:09 +01:00
Edward Welbourne
ca85e1246e updateSystemPrivate(): fix handling of empty string as non-null QVariant
QSystemLocale::query() can return an empty string for PositiveSign on
Windows, apparently. In any case, we shouldn't be taking .at(0) of a
QString without checking it's non-empty.

Fixes: QTBUG-81530
Change-Id: I4d496a2650362f225d02998bd7b8be9fd783edb4
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-01-23 19:44:09 +01:00
Giuseppe D'Angelo
e83c4e8138 QXmlStreamReader: fix memory leak
On some inputs a QXmlStreamReaderPrivate may allocate another
QXmlStreamReaderPrivate as its entityResolver. Which, recursively,
may allocate yet another one.

This "chain" of QXmlStreamReaderPrivate objects was managed using
raw pointers, and a leak was possible by resetting one of
these pointers to nullptr without freeing the corresponding object.

Change-Id: I2c6e1f023a2ed68b2b1857db25c53cce7f6bd3e7
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2020-01-23 19:44:09 +01:00
Giuseppe D'Angelo
4d8a515a23 QXmlStreamReader: early return in case of malformed attributes
There's no point at keep raising errors after encountering the
first malformed attribute.

Change-Id: Idb37e577ea96c3bd850b3caf008fe3ecd57dd32e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-01-23 19:44:09 +01:00
Joerg Bornemann
474a5e2f3f Fix handling of the DEFINES_DEBUG/DEFINES_RELEASE variables
Modifications of the CONFIG variable in the project file wasn't taken
into account in the handling of DEFINES_DEBUG and DEFINES_RELEASE,
because it was happening before the evaluation of the project file.

Moved the handling code into default_post.prf where the other *_DEBUG
and *_RELEASE variables are handled.

In practice that means: to avoid the addition of the NDEBUG define one
has to remove NDEBUG from DEFINES_RELEASE.

This amends commit 1456b809.

[ChangeLog][qmake] To remove the NDEBUG define that is added by
default in MSVC mkspecs, write DEFINES_RELEASE -= NDEBUG in your .pro
file.

Fixes: QTBUG-81569
Change-Id: I2ea5628653275a4e48ad002977d34969c0663815
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-01-23 19:44:09 +01:00
Allan Sandfeld Jensen
2d57dc2f33 Allow benign errors when writing PNGs
Otherwise we can end up not writing anything due to recoverable libpng
error reports.

Change-Id: I4d4db42305482babffbe2bcf25535a35b51502a9
Fixes: QTBUG-81604
Reviewed-by: Boudewijn Rempt <boud@valdyas.org>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2020-01-23 18:44:09 +00:00
Fabian Kosmale
cb3152086c Introduce Q_PROPERTY attribute REQUIRED
This is meant to correspond to required properties in QML.

Change-Id: I2645981e13f7423bc86b48370c165b3cfe2aaa62
Task-number: QTBUG-81561
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2020-01-23 16:47:45 +01:00
Samuel Gaist
49f143e19c QSslCertificate: migrate to QRegularExpression
This is part of the migration of qtbase from QRexExp to
QRegularExpression.

If support for regular expression is disabled, fixed string can
still be used.

[ChangeLog][QtCore][QSslCertificate] Add overload of fromPath that does
not make use of QRegExp and deprecate the QRegExp variant.

Task-number: QTBUG-72587
Change-Id: I507d8941cc7d70166da0948375dc421fe5e7d967
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-01-23 16:47:31 +01:00
Olivier Goffart
73d1476fb1 Replace most use of QVariant::type and occurrences of QVariant::Type
I made a clazy automated check that replaced the use of QVariant::Type
by the equivalent in QMetaType.
This has been deprecated since Qt 5.0, but many uses were not yet removed.

In addition, there was some manual changes to fix the compilation errors.

Adapted the Private API of QDateTimeParser and QMimeDataPrivate
and adjust QDateTimeEdit and QSpinBox.

QVariant(QVariant::Invalid) in qstylesheet made no sense.

But note that in QVariant::save, we actually wanted to use the non-user type.

In the SQL module, many changes were actually reverted because the API
still expects QVarient::Type.

Change-Id: I98c368490e4ee465ed3a3b63bda8b8eaa50ea67e
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-01-23 16:46:51 +01:00
Friedemann Kleint
a78d667431 Fix positioning of dynamically populated QToolButton::MenuButtonPopup's in screen corners
The existing code positioning the menu in
QToolButtonPrivate::popupTimerDone() had a clause checking
whether any receivers were connnected to QMenu::aboutToShow()
causing the sizeHint to be -1,-1 in that case (apparently
trying to accommodate menus populated in slots). In that
case, the checking for screen borders would not work, causing
the similar checks in QMenu::popup() to trigger, potentially
positioning the menu over the mouse.

To solve this dilemma, add a parameter taking a std::function
calulating the position of the menu from the sizeHint to
QMenuPrivate::exec()/popup() and invoke that in QMenuPrivate::popup()
after emitting QMenu::aboutToShow() when the sizeHint is known.

Fixes: QTBUG-78966
Change-Id: I180bd2dc7eadcaca6cadca13745ed4a2dd89e412
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-01-23 16:46:51 +01:00
Friedemann Kleint
ef14e775de QMenu: Move exec(), popup() to private class
Task-number: QTBUG-78966
Change-Id: I69257dc52706449a1e0babfc29e5f93f63d9291b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2020-01-23 16:46:51 +01:00
Ulf Hermann
2b78e96d23 QNAM: Avoid compile error if QT_NO_SSL
Change-Id: Iff8a0893cc7aca172c5b3f207a359762b270ed76
Reviewed-by: Jesus Fernandez <jsfdez@gmail.com>
2020-01-23 16:46:51 +01:00