Commit Graph

43894 Commits

Author SHA1 Message Date
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
Christian Ehrlicher
089d54f06f Sync behavior and documentation of QFoo::setItemDelegate()
QComboBox::setItemDelegate() does delete the old delegate which is in
constrast to all other setItemDelegate() functions which is quite
confusing. Sync in by *not* deleting the delegate in
QComboBox::setItemDelegate() and adjust the documentation to explicitly
state that the ownership is *not* passed to the affected classes.

[ChangeLog][QtWidgets][QComboBox] QComobBox::setItemDelegates no longer
deletes the previous delegate set.

Fixes: QTBUG-72483
Change-Id: I89c8e53903e7c9924a980c57b83ce40f5866e6ae
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2020-01-24 18:50:34 +01:00
Simon Hausmann
b5193881e5 Make QMatrix4x4::projectedRotate public
The function is used by QGraphicsRotation, which is in widgets.
QGraphicsRotation is marked as a friend, so that it can access the
private method. QtQuick needs access to the same method, so internally
it declares a "fake" QGraphicsRotation class, just so that it can
private access. This breaks now that QtQuick needs to do QT += opengl,
which implies widgets and thus ends up including the header file that
also declares QGraphicsRotation.

So instead of these hacks, let's make the function public, but remain
\internal in terms of docs.

Change-Id: I671f68c9d7ab0aac985e0b583f63f3ee962567dc
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2020-01-24 15:20:54 +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
Leander Beernaert
cce8ada814 Support for QML Type Registrar
Change-Id: Ifc1f44cf40b22c20ab768333ba9d5ce58a5f7250
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-01-24 12:29:30 +00:00
Leander Beernaert
48c82e90af Post Merge Fixes
Change-Id: I1e06c01b76b119c3f23b6e6ecbaae8df719b70ce
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-01-24 12:29:18 +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
Leander Beernaert
502d3d6744 Merge remote-tracking branch 'origin/dev' into merge-dev
Change-Id: I31b761cfd5ea01373c60d02a5da8c33398d34739
2020-01-24 13:17:33 +01:00
Johan Klokkhammer Helsing
2344e5cc31 Move QOpenGLTexture and related classes from QtGui to QtOpenGL
Task-number: QTBUG-74409
Change-Id: Ied825dd7cb92365505a4aa43fd67488024160341
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2020-01-24 08:57:38 +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
Eskil Abrahamsen Blomfeldt
dd17456a8a Deprecate QFont::ForceIntegerMetrics and QFont::OpenGLCompatible
The ForceIntegerMetrics flag was added in Qt 4.7 specifically because
of WebKit, which was rounding text metrics and getting mismatches
with the underlying font engine whenever it supported fractional
advances. For backwards compatibility with how the CoreText engine
worked before this, we added a flag to allow rounding all metrics.

Rounding advances gives very broken rendering and is hopefully not
used by anyone anymore, so lets remove this flag in Qt 6.

As for OpenGLCompatible, this flag is not used anywhere. I am
not exactly sure what this flag did, but all fonts are
"OpenGL-compatible" at this point.

[ChangeLog][QtGui][QFont] Deprecated QFont::ForceIntegerMetrics
and QFont::OpenGLCompatible, with the intention of removing them
in Qt 6.0.0.

Change-Id: I0a492c153348023f00d561bab8ab4b5104c6c7c4
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-01-23 07:37:23 +01:00
Laszlo Agocs
eecd502ff3 Regenerate qsb files for auto and manual tests
They are now version 4, which is hopefully the final format,
relying on nothing but QDataStream.

Except for the qshader autotest which tests all the 1..4 versions
and so needs appropriate test data.

Also unifies the batch file naming.

Change-Id: Iec478be86d14dbec7ffb9d5f9b62c14fca5d7c9e
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2020-01-22 22:47:04 +01:00
Laszlo Agocs
e0e7c42a19 Introduce VK_KHR_display support for i.MX8 devices
The eglfs_viv backend has Vulkan support now. While the support code is
common (lives in api/vulkan), we will not expose this for any other integration
yet, without the appropriate testing.

While putting this to eglfs seems unintuitive at first, it turns out that
for Vivante in particular this is very useful, since we can rely on the existing
framebuffer device infrastructure to solve certain problems (like the lack of
vsync)

The VK_KHR_display implementation of Vivante currently exhibits all the known issues
of the old, fbdev-style EGL plumbing (presumably since it lives on top of that):

- No vsync. This can be fixed by setting QT_QPA_EGLFS_FORCEVSYNC.

- May need a manual call to fbset to set the correct resolution before
launching the Qt app.

- And of course it lacks all the multi-screen features provided by drm.

- Plus, it seems the swapchain only supports a min/max buffer count of 1. This
needs special handling in QRhi since until now we assumed that there was always
at least 2 buffers available.

[ChangeLog][Platform Specific Changes][Linux] Vulkan is now supported by eglfs
(eglfs_viv backend) on i.MX8 devices with the Vivante graphics stack. This is done
via VK_KHR_display so no windowing system is required.

Task-number: QTBUG-78754
Change-Id: I7530aa026d4b904b9de83f9bdbdc4897ae770e71
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2020-01-22 22:46:51 +01:00
Andy Shaw
0b28f1e3ba Fix QLocale::system() and uiLanguages() for the mobile platforms
On iOS, it was no longer using the Cocoa specific code needed to get
the locale and uiLanguages information so this functionality is brought
back as it was accidently lost.

In addition, this has a side-effect of fixing a problem with Android
versions below API 24 where it has no UiLanguages functionality so it
gets the information based on the system locale as a fallback.

Fixes: QTBUG-81307
Fixes: QTBUG-81357
Change-Id: I1709675b5bd5e9cedefb99eaec28279f20a347a4
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2020-01-22 22:16:50 +01:00
Tor Arne Vestbø
d0e9e5a36e macOS: Work around CoreFoundation failing to resolve bundle resources
When a framework is loaded from a Samba share CoreFoundation will fail
to resolve its Resources directory, and hence its Info.plist, which
means we can't look up the bundle by id.

Until this has been fixed in CoreFoundation and/or the macOS Samba
implementation we work around it by manually looking for QtCore.

This fixes our particular use-case of finding QtCore so we can resolve
the relocatable prefix, but there's still a potential issue if any other
code tries to use CF for bundle lookups. We don't seem to have any of
those in Qt itself, but this should be kept in mind if we see similar
issues in the future.

Change-Id: I8fd471e44f6afe33a7459ce550f0fcec9acfefb4
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-01-22 17:58:33 +01:00
Tor Arne Vestbø
92918e567a Flatten version-specific blacklisting on macOS to all macOS versions
We don't know which versions these blacklistings actually apply on
unless we actually get macOS 10.14 and 10.15 into the CI and running
tests, so let's start with that, and then granularize the blacklists
after that.

Task-number: QTBUG-75786
Change-Id: Id79642afa50cb20efa2cd209286b6933918d3a4a
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-01-22 17:58:31 +01:00
Tor Arne Vestbø
db81129240 macOS: Remove doc references to the Carbon framework
Change-Id: I4d496acfc3d810d6334baba99cd697168bef0b75
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2020-01-22 17:26:23 +01:00
Tor Arne Vestbø
c31c5d08d8 Blacklist tstPauseAnimation::noTimerUpdates on macOS
Task-number: QTBUG-75786
Change-Id: I89d81a9d0f5f301f325044dee2395d441c0d5970
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-01-22 17:26:23 +01:00