Commit Graph

42609 Commits

Author SHA1 Message Date
Volker Hilsheimer
469c333840 QComboBox: deprecate SizeAdjustPolicy::AdjustToMinimumContentLength
As per ### Qt 6 comment and pre-existing documentation, one of the
other enum values should be used anyway.
Only usage in QtWidgets is in QFileDialog, replace it there with
appropriate alternative.

[ChangeLog][QtWidgets][QComboBox] the SizeAdjustPolicy value
AdjustToMinimumContentLength is deprecated, use AdjustToContents or
AdjustToContentsOnFirstShow instead.

Change-Id: I22deaa31fbb6c09e87c814e120eb7ee27c177ea9
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2020-02-26 23:09:20 +01:00
Volker Hilsheimer
f15aa1fd84 QDockWidget: mark AllDockWidgetFeatures enum value as deprecated
As per ### Qt 6 comment, and the documentation which already suggests
to specify the individual flags instead.

Change-Id: Id236b7b13024a15fc7ad483b9481361b2ac43a02
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2020-02-26 23:09:06 +01:00
Lars Knoll
fd4be84d23 Add an expansion limit for entities
Recursively defined entities can easily exhaust all available
memory. Limit entity expansion to a default of 4096 characters to
avoid DoS attacks when a user loads untrusted content.

Added a setter and getter to allow modifying the expansion limit.

[ChangeLog][QtCore][QXmlStream] QXmlStreamReader does now by default
limit the expansion of entities to 4096 characters. Documents where
a single entity expands to more characters than the limit are not
considered well formed. The limit is there to avoid DoS attacks through
recursively expanding entities when loading untrusted content. The
limit can be changed through the QXmlStreamReader::setEntityExpansionLimit()
method.

Fixes: QTBUG-47417
Change-Id: I94387815d74fcf34783e136387ee57fac5ded0c9
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-02-26 22:08:38 +01:00
Assam Boudjelthia
86f7d44089 Examples: request Android storage permissions when using QStandardPaths
http example uses QStandardPaths, on Android permissions might need to
be explicitly requested to write the downloaded file.

Task-number: QTBUG-80717
Change-Id: Icd377254ad77cac661c5ae37e9081e0463493d8b
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2020-02-26 23:07:48 +02:00
Mårten Nordheim
bf377dd1af Doc: Rename TransferTimeoutPreset to DefaultTransferTimeoutConstant
A couple missed instances.

Amends 0394961f95

Change-Id: I41d47d1476c6688ca8a40b1ca62131891b9dec28
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2020-02-26 21:30:44 +01:00
Alexander Akulich
6d18e4a2b8 Revert "QAbstractSocket: deprecate 'error' member-function"
This reverts commit 94b3dd77f2.

The patch fixes ambiguity between a getter and a signal by changing the
getter name, but we still have to rename the signal to follow the signals
naming convention.

Revert the commit to keep the getter as is and change the signal name instead.

Change-Id: I0dd60cf1ae9d1bd95beeb8ad58661ca4b1fb63b9
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-02-26 23:07:52 +03:00
Christian Ehrlicher
e1920f6593 QShortcut: fix ambiguity with new PMF ctors
The new PMF ctors introduced with a4751f8824
created some ambiguities with existing old-style connects. Fix it by
explitly checking if the given pointers are pointers from QObject
derived classes.

Fixes: QTBUG-82415
Change-Id: I70d51a6d50384fe6b5083fa3b94492ab6ed97086
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2020-02-26 20:50:18 +01:00
Mårten Nordheim
f949f33688 QHash/QSet: Base iterator tag on warning version rather than deprecation
If you have deprecation warning version set to 5.15 and the
"disable deprecated before" set to something lower then it will complain
about usage of operator-- inside std::distance which is used in our
generic collection iterator.

This also required changing over to the QT_DEPRECATED_VERSION_5_15 macro
so that the deprecation warning would also be disabled.

This is a possible work-around - change the iterator tag if it would
trigger a warning.

Fixes: QTBUG-82397
Change-Id: I3e0ecae5edebba2a3560e7c3785bd9d1a6d0076d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-02-26 10:09:44 +01:00
Allan Sandfeld Jensen
23c5fc1d2f Improve argument name for std::function argument
Less \a fun though.

Note using references in this API would just duplicate the API, but
still end up with a copy when creating the QRunnable. By having the
copy apparent directly in the API, we not only save the duplication,
we also hint to the caller to use move if they want to avoid a copy.

Change-Id: If11476d4b38853839c1e87e0339807a1798fc875
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-02-26 06:25:20 +01:00
Shawn Rutledge
165d2f09cd QScreen::virtualSiblingAt(): pass QPoint by value
It's too small to bother with passing by reference.

Change-Id: I793678f5ae352b7f24d2c7e758dc75827c2190df
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-02-26 06:25:04 +01:00
Qt Forward Merge Bot
226533fd85 Merge remote-tracking branch 'origin/5.14' into 5.15
Change-Id: Iad459349ea8b4090d79b4771bfff8f656a8a8189
2020-02-26 01:00:08 +01:00
Friedemann Kleint
3c4078ca02 tst_QSettings: Fix leaking registry key
On Windows, the test was leaking a registry key
HKEY_CURRENT_USER\Software\tst_QSettings_trailingWhitespace
Fix by using .ini-Format in the temporary directory created by the test.

Amends e66a878838.

Task-number: QTBUG-22461
Change-Id: If141a9e72e8faebc3fc46b94dab7b4b728a75292
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-02-25 20:16:20 +01:00
Allan Sandfeld Jensen
462c2745a5 Add replacement message to deprecation of QImage::alphaChannel()
Change-Id: I1d8afecc6da5df6fef72ecc59d14ac455c43d9a6
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-02-25 19:53:27 +01:00
Andre de la Rocha
a434880e62 Rename AA_MSWindowsDisableVirtualKeyboard to AA_DisableNativeVirtualKeyboard
Renaming the attribute to make it platform-independent, since in spite
of currently being supported only on Windows, it may be eventually
supported on other platforms where it may be useful.

Task-number: QTBUG-76088
Change-Id: Id98ccd7a34e1c43b1f2274efce6ab4b4aff24f03
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-02-25 19:53:27 +01:00
Timur Pocheptsov
0394961f95 Rename TransferTimeoutPreset to DefaultTransferTimeoutConstant
Found in API review. Replacing with the suggested name which is more Qt-ish.
And also preventively fix the name to contain its enum's name to follow the
conventions.

Change-Id: I00b510e36ccc831f107ecc3c79943d617726b4fb
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-02-25 19:53:27 +01:00
Volker Hilsheimer
66e0079569 QStyle: deprecate enum values that are marked for removal in Qt 6
Those enum values are not used by widget code. Exception is
PE_PanelItemViewRow, which is used by all item views, and no replacement
is provided. So removing the ### Qt 6 comment from this value.

Change-Id: Id4371bda5c3b14e3565c87ab233ee621d995f081
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2020-02-25 19:53:27 +01:00
Topi Reinio
95aec76e31 Doc: Fix documentation warnings for Qt Core
- QCborError: Classes cannot relate to header files; use \inheaderfile
  instead and link to the class from header file documentation.

- QRecursiveMutex: QDoc doesn't allow shared documentation comments
  for duplicating \fn docs between the base and deriving classes.
  Remove the sharing, the function documentation is available under
  'All Members' doc for QRecursiveMutex.

- QMultiMap: unite() and one overload of insert() were not recognized
  because their definitions in the same header file interfered with
  QDoc - use Q_CLANG_QDOC macro to comment them out, and tag \fn
  comments to ensure that the function documentation is matched.

Change-Id: Ic96869904a72d92453e4ffa6901000147571969b
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2020-02-25 19:53:27 +01:00
Thomas Sondergaard
e59e5643b5 Use QT_DEPRECATED_X instead of Q_DECL_DEPRECATED_X
Allow deprecation warnings to be controlled with
QT_NO_DEPRECATED_WARNINGS.

Fixes: QTBUG-82424
Change-Id: I6df55ee2abaf4c141ac9b0e7661e46ba3706b20e
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-02-25 18:58:18 +01:00
Liang Qi
4403ec3bc1 tests/xcb: fix tst_QWidget::updateWhileMinimized() on mutter/GNOME Shell
Task-number: QTBUG-68862
Change-Id: I6247867ae4ec126ab0549741f2d2d491a7f2e8a0
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2020-02-25 18:58:17 +01:00
Andy Shaw
2c35a61025 Delay the processing of the doc features to the end
By delaying it to the end we can be sure that all the Qt modules have
their INCLUDEPATHs set and as a result we can avoid long command lines
on Windows.

Change-Id: I9068f7bf66fe138aad1a633191677a57dfd08d6e
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-02-25 18:58:17 +01:00
Andy Shaw
ce55667b62 Set the size of the buffer so it is big enough to hold the contents
This will prevent a crash later on when it tries to assign to an index
in a QString that has not been allocated.

Fixes: QTBUG-81950
Change-Id: Ia0b5648a18f15594eeca07d234bedadcfeb266ac
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-02-25 18:58:17 +01:00
Volker Hilsheimer
34a67b3652 Remove misplaced backslash from documentation
A \c{} section is already rendered using monospace, no need to escape
the \nullptr keyword explicitly.

Change-Id: I004a409892809e968c7a73c68a5b3c54a4680425
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2020-02-25 18:58:17 +01:00
Volker Hilsheimer
02e0c30a8a QGraphicsView: Clear the rubber band when dragMode changes
Without this change, and ongoing rubber-band selection will not be
cleared when the dragmode property changes (e.g. because of a key press)
which leaves a rubber-band displayed on the view.

Move the rubber-band-clearing code from mouseReleaseEvent into a private
helper that is then called from setDragMode.

Change-Id: I32c15f7fe4ef2b8002ef5dd58e22f4bb30dd2409
Fixes: QTBUG-65186
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
2020-02-25 05:29:03 +01:00
Friedemann Kleint
a5ea2f7e99 Merge remote-tracking branch 'origin/5.14' into 5.15
Change-Id: Ibe5b4aa249863a54007180f3684dc5ce1b23cb7b
2020-02-24 08:40:45 +01:00
Christian Ehrlicher
875420f1c2 QAbstractItemView: Make sure to update the editor geometries
QAbstractItemView::setIndexWidget() does not trigger a relayouting when
a new widget is set. This results in a wrong editor geometry under some
circumstances. Fix it by triggering a delayed relayout.

Fixes: QTBUG-81763
Change-Id: I75d0e19bd5e56d63effe4990d782d202fb39e3e6
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-02-23 10:48:53 +01:00
Alexander Akulich
291b3cebb9 QAbstractSocket: Use constructor delegation
Change-Id: Ib749ff46dd3c9d44c1a3c6273eadd78fdf0f837e
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2020-02-22 17:20:35 +03:00
Friedemann Kleint
835e18d9ff Fix wrong DPI used by QStyle::pixelMetric()
Pass on the option or the widget in order to ensure usage of the
correct DPI for High DPI scaling.

Task-number: QTBUG-82356
Change-Id: I5df903a83f88adebd143e514e2fead367d39f015
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2020-02-22 10:05:03 +01:00
Timur Pocheptsov
c58ee54a70 tst_qtcpsocket::bind - amend the recent fix
0. The recent patch fixed the case when we can suddenly (meaning from
a particular version of Darwin) bind on a port number 1. Unfortunately,
it's not the case for IPv4 and while fixing one test case, the patch broke
another - so this patch addresses this.
1. Unfortunately, binding on a fixed port 1 on macOS made the test flaky
- we run this 'bind' several times and sometimes OS thinks port is already
bound (because of the previous test case) - closing the connection seems
to fix this problem (thus this patch do this also).
2. As a bonus a proper resource management added (aka RAII) where we would
previously leak a socket in case some QCOMPARE failed.

Fixes: QTBUG-81905
Change-Id: I90c128a332903bb44ab37de4775ca00d390dc162
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2020-02-22 03:36:54 +01:00
Volker Hilsheimer
962a3d8a98 Stabilize QFileSystemModel::dirsBeforeFiles test
Make the test operate in its own temporary directory, so that entries
left behind by other test functions don't impact this test.

Also, call QFileSystemModel::sort explicitly; it would otherwise only
be done once through a single-shot timer, and the test processes events
until the model is populated, which might not process that delayed
sorting. Since dirsBeforeFiles tests the sorting algorithm and not
the sorting logic, best to do this explicitly.

In case of sort failure, print diagnostics.

Done-with: Friedemann Kleint <Friedemann.Kleint@qt.io>
Fixes: QTBUG-75452
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit 4e796e0b0d)
Change-Id: I144b68a17280a38cc7d6daf7ec343eea4453623d
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2020-02-22 02:52:44 +01:00
Volker Hilsheimer
1ce3585305 Detect double timer during single timeout in registerTimer test, and skip
We observe this happening on macOS in the CI system, and it might happen
if a VM doesn't get CPU cycles for long enough time so that two timers
time out. Then event processing will process two timer events, and we
overwrite the timerIdFromEvent with the second event.

Instead, skip the test when this happens.

This is an ammendment to 5c520f4b0a

Fixes: QTBUG-71751
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 67491e2df5)
Change-Id: I30eef8cfc94988e6cad500dd5e6722488c2985be
2020-02-22 02:52:36 +01:00
Volker Hilsheimer
c3951470ca Discover the conditions under which registerTimer is flaky, and skip
On macOS, the registerTimer test case fails frequently, and blocks
valid integrations. With this change we try to detect the condition
and skip the test.

Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 5c520f4b0a)
Change-Id: I97644b5b4654b4c96fbc99858bbf191e6edb5977
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2020-02-22 02:52:24 +01:00
Qt Forward Merge Bot
aa3226bab3 Merge "Merge remote-tracking branch 'origin/5.14' into 5.15" 2020-02-22 01:00:18 +01:00
Qt Forward Merge Bot
65cafea797 Merge remote-tracking branch 'origin/5.14' into 5.15
Change-Id: Iace12004afdfe765a3068dfcf6f1320c1123c539
2020-02-22 01:00:07 +01:00
Giuseppe D'Angelo
4b0fc03077 Update md4c to 0.4.3
Fixes important bugs.

[ChangeLog][Third-Party Code] md4c was updated to 0.4.3.

Change-Id: Ifed7939b7bd67e3f0a7776b4f4b1132d80141033
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2020-02-22 00:38:10 +01:00
Christian Ehrlicher
1559c328d5 QTableWidget: avoid complete redrawing when an item is removed
When an item gets removed from QTableWidget, the dataChanged() signal
is sent out with an invalid index. This triggers a complete repaint
which is not needed since only one cell is changed.
Fix it by retrieving the model index *before* the internal structure is
cleaned for the given item since otherwise index() will no longer find
the item and return an invalid index.

Change-Id: Ia0d82edb6b44118e8a1546904250ca29d9c45140
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-02-21 20:04:21 +01:00
Volker Hilsheimer
3c20b9b973 QGraphicsProxyWidgets: document that using OpenGL comes with limitations
The documentation already states that high-performance scenarios are not
a usecase that mixes well with QGraphicsProxyWidget. However, we can
generally not test or support all combinations of widgets and styles
with an OpenGL viewport.

That Qt's basic framework code has to be graphicsview aware is already
unfortunate enough; adding more special checks all over the place
hurts maintainability, makes the general usecase slower, and poorly
serves use-cases that are beyond of what QGraphicsProxyWidget was
designed for.

Change-Id: Iff43ead292240f7b068dcf9206bb3bee3031b1dc
Fixes: QTBUG-63687
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2020-02-21 20:03:45 +01:00
Topi Reinio
6248bfd9e5 Doc: Remove \pagekeywords command
The command does nothing, it was not implemented by QDoc.

Change-Id: Id1e5fcc02101723e9089df55d9f8949e50c89b3f
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2020-02-21 19:45:10 +01:00
Morten Johan Sørvig
4e1c41a26e QStyle: Use primary screen DPI as default DPI
Change d603ee68 made the default DPI be 96, for cases
where a style option is not provided.

This causes inconsistencies, since there are in fact
several cases where QStyle API is called without a
style option.

Restore historical Qt behavior of using the primary
screen DPI. Single-screen systems should now be consistent,
as before.

Task-number: QTBUG-82356
Change-Id: I849934ca2e5604b9fb2f045ed4f6058f3e0426ff
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-02-21 10:38:58 +01:00
Laszlo Agocs
2940c375e4 rhi: Allow querying the native buffer objects behind a QRhiBuffer
Modeled after QRhiTexture's NativeTexture query.

This becomes valuable in advanced cases of integrating external native
rendering code with Qt Quick(3D), because it allows using (typically
vertex and index) buffers created by Quick(3D) in the custom renderer as
well, without having to duplicate the content by manually creating native
buffers with the same vertex and index data.

Change-Id: I659193345fa1dfe6221b898043f0b75ba649d296
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2020-02-21 09:15:18 +01:00
Laszlo Agocs
79b605d285 rhi: Fix building hellominimalcrossgfxtriangle on macOS
Change-Id: I55fa7d4d122750ca7ab90559026f4f4fcdf11663
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2020-02-21 09:15:10 +01:00
Laszlo Agocs
efba2530f9 rhi: Do not rely on unspecified relation between readbacks and FramesInFlight
Add a new queriable resource limit value MaxAsyncReadbackFrames. Change
the autotest to rely on this instead of relying on the unspecified,
works-by-accident relation between readbacks and FramesInFlight. This
way even if the behavior diverges in some backend in the future, clients
(well written ones, that is), will continue to function correctly.

Also clarify the docs for FramesInFlight, and change d3d and gl to return
the correct value (which is 1 from QRhi perspective; the expanded docs now
explain a bit what this really means and what it does not).

Change-Id: I0486715570a9e6fc5d3dc431694d1712875dfe01
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2020-02-21 09:15:05 +01:00
Mårten Nordheim
fb6acf08bb Replace usage of std::result_of with decltype
It's slated for removal in c++20

Fixes: QTBUG-82240
Change-Id: I7b35c151413b131ca49b2c09b6382efc3fc8ccb6
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2020-02-21 01:31:52 +01:00
Edward Welbourne
336fe172b1 Back out of calendar support in Qt::DateFormat methods
We're deprecating the locale-specific date-formats, which are the only
ones that use the calendar. The QDateTime::toString() variant was new
in 5.15, so we can simply remove it again.  The QDate one was present
in 5.14, so we need to keep it; deprecated it at 5.15 for removal at
Qt 6.

[ChangeLog][QtCore][QDate] QDate::toString(Qt::DateFormat, QCalendar)
no longer takes calendar into account for Qt::TextDate. There was no
matching support in QDateTime and the locale-independent formats are
intended to be standard, rather than customized to the user.

Fixes: QTBUG-82178
Change-Id: I09db8a82ec5a4eab22f197790264fa3a3724e383
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-02-20 14:44:29 +01:00
Shawn Rutledge
aeff4b70c5 Make xcb plugin compile with -no-feature-tabletevent
fixed1616ToReal() is used for touch and scroll events too, not just
tablet.

Task-number: QTBUG-82168
Change-Id: Idcdd6365b5619824b41c1278e5dc5ffb81c400f8
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2020-02-20 12:36:58 +01:00
Volker Hilsheimer
f79efbc867 Un-blacklist QFileSystemModel::dirsBeforeFiles
After 4e796e0b0d we only have blacklisted
passes in the database, and no flaky failures on macOS.

Exception is WinRT, which stays blacklisted.

Change-Id: Ie1c492d20c76d4ba12b3f513ac038f023b864cb1
Reviewed-by: Dimitrios Apostolou <jimis@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-02-20 11:23:44 +01:00
Oliver Wolff
5893f10390 QMultiMap: Work around compiler problem in MSVC 2017
In more complex projects (like MuseScore) it is possible, that MSVC 2017
chokes on the usage of "using typename ...". Just fully specify the
iterators when they are used.

Fixes: QTBUG-82166
Change-Id: I5e7882a0963445fc8529cfcb59d2aae606a2777e
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-02-20 10:58:34 +01:00
Friedemann Kleint
e0225d8bee Merge "Merge remote-tracking branch 'origin/5.14' into 5.15" 2020-02-20 08:36:03 +01:00
Friedemann Kleint
41ecb6abbf Merge remote-tracking branch 'origin/5.14' into 5.15
Change-Id: Ide8768d0d95aaeec943658aea27a03737d7dbf3f
2020-02-20 08:34:46 +01:00
Volker Hilsheimer
1821f5163d Fix font and palette propagation for themed children created at runtime
Widgets have a default palette and font that is influenced by several
factors: theme, style, QApplication-wide overrides, and the parent's.
If an application sets a font or palette on a parent, then widgets
inherit those settings, no matter when they are added to the parent.

The bug is that this is not true for widgets that have an application-
wide override defined by the platform theme. For those, we need to merge
parent palette and font attributes with the theme, and this is currently
not done correctly, as the respective masks are not merged and inherited.

This change fixes this for fonts and palettes. Children are inheriting
their parent's inheritance masks, combined with the mask for the
attributes set explicitly on the parent. This makes the font and palette
resolving code correctly adopt those attributes that are set explicily,
while leaving everything else as per the theme override.

The test verifies that this works for children and grand children added
to a widget that has a palette or font set, both when themed and
unthemed. Children with own entries don't inherit from parent.

The QFont::resetFont test had to be changed, as it was testing the
wrong behavior. If the child would be added to the parent before the
font property was set, then the test would have failed. Since this
change makes sure that children inherit fonts in the same way, no
matter on when they are added to their parent, the test is now
modified to cover both cases, and ensures that they return identical
results.

[ChangeLog][QtWidgets][QWidget] Fonts and palette settings are inherited
by children from their parents even if the children have application-
wide platform theme overrides.

Change-Id: I179a652b735e85bba3fafc30098d08d61684f488
Fixes: QTBUG-82125
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Vitaly Fanaskov <vitaly.fanaskov@qt.io>
2020-02-20 08:04:47 +01:00
Nicolas Guichard
f9086ebd01 QShaderGenerator: Allow more expressions in input nodes
Currently QShaderGenerator will crash when encountering some expressions
in input nodes.

For example, this node prototype would make it crash:
"VERTEX_COLOR": {
  "outputs": ["color", "alpha"],
  "rules": [
    "headerSnippets": ["in vec4 vertexColor;"],
    "substitution": "vec3 $color = vertexColor.rgb;
                     float $alpha = vertexColor.a;"
  ]
}

Change-Id: I37abb8099d376843a4cb13228140467dc1b8f60c
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
2020-02-20 08:00:20 +01:00