Commit Graph

41966 Commits

Author SHA1 Message Date
Mårten Nordheim
6f5556e7b4 QTextDocument: Change use of QMap::unite to QMap::insert
None of the code I could see handles the map like a multimap.

Change-Id: I9d51da6dafed4317e801703599e83fb038c22a1d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2019-12-12 15:25:44 +01:00
Mårten Nordheim
43837f38b2 Change some uses of QMap::insertMulti to QMultiMap::insert
By casting it, these are situations where we cannot change the type
itself to QMultiMap. For QVariant it's a public define and for dbus
it's the type of an argument to the function.

Change-Id: I0f385dc857fce5de3e8254d18268fd84a6d7707c
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2019-12-12 15:25:41 +01:00
Mårten Nordheim
b79d74e96f moc: change QMap::unite to QMap::insert
Which is the intended behavior.

Change-Id: I0cffc623fc09284f3d95850f840564dca20ed0d4
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2019-12-12 15:25:39 +01:00
Mårten Nordheim
1c98479aa2 QRegExp: change QMap::unite to QMap::insert
Change-Id: I4c682b31da8bfa56c6858a1878f12118568f28bf
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2019-12-12 15:25:35 +01:00
Mårten Nordheim
d98a1ef902 Add QMap::insert(const QMap &map)
As opposed to unite(), this inserts one map into the other
without duplicating elements.

Task-number: QTBUG-35544
Change-Id: Ie8ab350b29148851a3176cef1007e8a4ca82c273
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2019-12-12 15:25:30 +01:00
Lars Knoll
9c124b1b0a Qt 6: Deprecate QHash::insertMulti
[ChangeLog][QtCore][QHash] insertMulti(), unite() and
values(const Key &key) are now deprecated. Please use
QMultiHash instead.

Change-Id: Ic14907fd5fd38d585708e2dcf2c0200d221ebb25
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2019-12-12 15:25:26 +01:00
Lars Knoll
c7e35ffe69 Use a QMultiHash explicitly if insertMulti() is being used
This is a step towards deprecating QHash::insertMulti() and clearly
separating QHash and QMultiHash.

Change-Id: Ic2c7665673ff00d4f2186e94850710b70330f8ba
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2019-12-12 15:25:22 +01:00
Milian Wolff
656d6f2a9b Support Q_GADGET QMetaObject super class hierarchies across templates
This patch fixes the QMetaObject::superClass hierarchy for Q_GADGETs
that inherit from a template which in turn inherits another Q_GADGET.
One common scenario where this is applied is for the CRTP. Without this
patch, moc would stop at the template and then sets the superClass
QMetaObject to a nullptr. For QObjects this works, since there moc knows
that every child must by definition inherit QObject. In order to support
this for Q_GADGETs too, we defer the judgment about the availability
of a staticMetaObject in the base class to compile time through the
existing QtPrivate::MetaObjectForType<Base>::value() helper.

[ChangeLog][QtCore][moc] Moc now correctly sets a non-null
QMetaObject::superClass for Q_GADGETs that inherit from a template which
inherits another Q_GADGET.

Change-Id: I103b5efd74ed24172dffce477ca2ed6d0f374d44
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2019-12-12 13:02:52 +01:00
Laszlo Agocs
83818431e1 rhi: gl: Add support for arrays of float, vec2, vec3 and vec4
This is a thing in Qt Quick: there are some types of image particles
that use uniforms like "float opacitytable[64]".

This should make all views work correctly in the Image Particles example
when running on the OpenGL backend of QRhi. (other backends should work
as expected already)

Change-Id: I64a04fbb98b97d81d257b00b428582e751d46b8e
Fixes: QTBUG-80667
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2019-12-12 12:57:06 +01:00
Mårten Nordheim
5612f24dc5 Add QPasswordDigestor to syncqt
It wasn't generating the "QPasswordDigestor" forward-header because
QPasswordDigestor is a namespace, not a class.

Fixes: QTBUG-80708
Change-Id: Ic6567271e2d2d948c0663017069eb26e2e95662c
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2019-12-12 12:43:56 +01:00
Laszlo Agocs
4639660ded rhi: metal: Skip inactive resources
The Quick3D-on-RHI PoC demonstrates a case which the Metal backend
fails to handle correctly: have an object with a lighting-enabled
material, but remove all lights from the scene.

Under the hood this means having a uniform block in the shader, but
without referencing it in any way in the actual shader code.

This leads to the resource being present (as far as shader reflection
is concerned), but with no native binding point available, meaning the
attempt to retrieve the Metal binding point for it returns -1, and that
is what the QShader carries in the nativeResourceBindingMap.

The backend should be prepared to silently skip the resource, whereas
 currently we end up in an assertion due to attempting to batch the (native)
binding "-1", which is invalid.

Correct this.

Change-Id: I85ee58145f589aca45d46c23e0cdce837d598850
Fixes: QTBUG-80668
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2019-12-12 12:41:20 +01:00
Qt Forward Merge Bot
be270ac82b Merge "Merge remote-tracking branch 'origin/5.14' into 5.15" 2019-12-12 11:39:59 +01:00
Ulf Hermann
23d2312506 Split cborstream feature in two
Reading of Cbor streams is substantially more complicated than writing
as it requires float16 support. When writing Cbor, we can just choose to
always write 32bit floats, even if we could compress the numbers into
16 bits.

We need Cbor writing in the bootstrap library, but we cannot easily add
float16 support.

Furthermore, Cbor reading is required for plugin support, but not Cbor
writing. It might make sense for some users to build a custom Qt with
Cbor writing disabled.

Therefore, provide two features, cborstreamreader and cborstreamwriter,
split up the code in cborstream.{h|cpp} into several files, and enable
Cbor writing in the bootstrap library.

Change-Id: I15450afb0e328a84a22ebca9379cffc4f900a75a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-12-12 10:42:27 +01:00
Christian Ehrlicher
b89f2ebd95 QWaitCondition: un-deprecate wait() functions with ulong arg
The wait() functions with the unsigned long arg were marked for removal
for Qt6 but due to the high usage of this functions and the very small
gain, revert the deprecation.

Change-Id: I9c9b720d279a59d87730f51de0f321b3794aa88e
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-12-12 06:32:46 +01:00
Qt Forward Merge Bot
11d7788c18 Merge remote-tracking branch 'origin/5.14' into 5.15
Change-Id: I69238f23882deebeaad46e4fdcf899ab22cc2b8f
2019-12-12 01:01:04 +01:00
Michael Dippold
3162345670 Support both qrc and qml files for qmlimportscanner
Some projects can be configured to have both qrcFiles and qml-root-path
included in the deployment settings file. The addition to qrc scanning
prevented the qml root directory from being scanned.

Change-Id: Idadb62f5572be45d0083294440bdb29740c2c47e
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2019-12-11 11:14:47 -08:00
Fabian Kosmale
c15d6a155c QVariant: introduce ShouldDeleteVariantData flag
This flag is used in QSequentialIterable and QAssociativeIterable to indicate
that the data pointer in VariantData should be deleted after the variant has
been constructed.

The use case for this is
https://codereview.qt-project.org/c/qt/qtdeclarative/+/284151, where we have
a proxy iterator and cannot easily return a pointer to already owned data, as
it is hard to manage its lifetime in the iterator. In contrast, it is clear
that we can release the memory in the QSequentialIterable functions, as it has
already been copied into the QVariant there.

Change-Id: I2b33497d991cd4f752153e0ebda767b82e4bb851
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2019-12-11 20:12:23 +01:00
Christian Ehrlicher
07838840e8 Doc/SQL: update sql driver creation instructions
Update the instructions on how to build and distribute the mysql and
postgresql drivers on windows.

Change-Id: Ie4d50c1c34820680d7496b9544eb00fcee17f8e7
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2019-12-11 18:11:56 +00:00
Albert Astals Cid
b3c0e9afa0 Deprecate qrand/qsrand
They have been marked as deprecated in the documentation for a while

Change-Id: Ia2b0b6dbd4c525e3e9c4bc835eee2c9da5a938cb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-12-11 14:21:15 +01:00
Volker Hilsheimer
3e9895f3de Support checkable QComboBox items with styles using a popup dropdown
The dropdown of a combobox is rendered using menu items when the style
request it to do so via the SH_ComboBox_Popup style hint.

In that case, checkable items were not supported; the QComboBox didn't
pass the checked state correctly to the style, and the delegate used
for rendering the items into the list view did not implement modifying
the checked state of the item.

However, the QStyleOptionMenuItem's checked state and checkType members
were set anyway, as on e.g. macOS style we use a checkmark to show
which item is currently selected in the combobox.

The QStyle::State enum defines State_On and State_Off for toggleable
things, so in addition to setting QStyleOptionMenuItem::checked, we are
now also adding State_On or State_Off if the model provides a valid
checked/unchecked state. Otherwise, we only set the checked state if
the item is currently selected.

In addition, we implement the delegate to support toggling of checkable
model data with mouse and keyboard, using a simplified version of the
QItemDelegate implementation. To avoid spurious item toggles when the
popup is opened, we only handle mouse releases when the press was on
the same row.

In the fusion style, we ignore the workaround to let QtQuickControls
render comboboxes if State_On or State_Off are set.

[ChangeLog][QtWidgets][QComboBox] Support checkable items in styles
that use a popup for the dropdown.

Change-Id: Ia01519694b0419d777dc66b1ef683482fb01754c
Fixes: QTBUG-60310
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
2019-12-11 13:12:31 +01:00
Andy Shaw
a7108ec6cf Fix CVE-2019-19244 in SQLite
Fixes: QTBUG-80635
Change-Id: I718349e28ec76ea164dd50f2a985f2074dd6bdbd
Reviewed-by: Jesus Fernandez <jsfdez@gmail.com>
2019-12-11 11:21:46 +01:00
Friedemann Kleint
5a26bf9d65 Avoid initializing QFlags with 0 or nullptr in macOS-specific code
It is being deprecated.

Change-Id: If1b0b058140e197d41efae93025c4eefc2ed9bbd
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2019-12-11 09:49:51 +01:00
Thiago Macieira
a77fdc9847 Doc: remove the claim that zero timers execute after GUI events
This ties our hands on what we can do in our implementations. I don't
care if you've depended on this in your code. It was wrong.

Fixes: QTBUG-80600
Change-Id: I568dea4813b448fe9ba6fffd15de8865a27f0a35
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2019-12-10 20:24:29 -08:00
Thiago Macieira
6bef90f3cf QTest::toString(QBitArray): fix Mismatched free() / delete / delete []
==8015== Mismatched free() / delete / delete []
==8015==    at 0x483958B: operator delete[](void*) (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==8015==    by 0x48752D6: QTestResult::compare(bool, char const*, char*, char*, char const*, char const*, char const*, int) (qtestresult.cpp:356)
==8015==  Address 0x602eb30 is 0 bytes inside a block of size 12 alloc'd
==8015==    at 0x483777F: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==8015==    by 0x44AAE2: char* QTest::toString<QBitArray>(QBitArray const&) (qtest.h:98)
==8015==    by 0x44D212: bool QTest::qCompare<QBitArray>(QBitArray const&, QBitArray const&, char const*, char const*, char const*, int) (qtestcase.h:352)

Change-Id: Ia2aa807ffa8a4c798425fffd15dabfebfd63fdbd
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2019-12-10 20:24:14 -08:00
Thiago Macieira
0d4dea728f MIME: Make the internal database direct content, not a Qt resource
This saves us from having to bootstrap rcc in regular (non-cross)
compilations, as it can now link to QtCore. Actually un-bootstrapping
rcc is left as an exercise for the reader.

This commit discovered that MSVC cannot handle constexpr arrays bigger
than 256 kB, at which point it simply starts claiming that the constant
expressions using it are not constexpr. ICC has a similar problem at
64 kB, but it tells you why ("note: type "const unsigned char [65537]"
too large for constant-expression evaluation").

Note also that this requires gzip or zstd to be in PATH for compression
to happen. RCC linked to zlib, which is always present due to the
bundled copy. gzip's presence is not likely to be a problem on Unix
systems, but could be for Windows users, especially MSVC ones. If gzip
is not present, QtCore's size will increase by about 1910 kB of
read-only (sharable) data.

Change-Id: I2b1955a995ad40f3b89afffd15a3e65a94670242
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2019-12-10 15:56:09 -08:00
Robert Szefner
6ffedc07a7 PSQL: Optimize QPSQLResult::data() function for date and time types
Minor performance optimalizations:
- No need to check if the date and time are correct because the QDate,
  QTime and QDateTime parsing functions already perform these checks
- No need to add minute part to the UTC offset before parsing the date,
  because the QDateTime class can parse time zone offset both in form
  ±hh:mm and ±hh

Change-Id: Id74b7ae075135c5c8cf420247c49b5f12fe88899
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2019-12-10 21:21:34 +01:00
Lorn Potter
382f1a221b wasm: fix getOpenFileContent doc
The callback should be named the same as the function expects

Change-Id: I4ca73958313c93c0d68e7205d8641c4104247e0c
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2019-12-11 06:06:51 +10:00
Lorn Potter
93d261b965 wasm: enforce emscripten version
This creates a define in the binary, as well as writing emscripten
version for qmake.

It also enforces app builder to use a certain known version.

Task-number: QTBUG-77745
Change-Id: I37691512171635cec66aa3ffa16258081f3f1e1b
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2019-12-11 06:06:45 +10:00
Laszlo Agocs
e6de661a8a rhi: gl: Handle struct and array of struct uniforms
We have intentionally limited support for advanced things like
arrays in a uniform block. There is one very common case however:
a one dimensional array of a struct.

Typical example for Qt Quick 3D:

struct LightSource
{
    vec4 position;
    ...
};

layout (std140, binding = 1) uniform cbBufferLights
{
    int uNumLights;
    LightSource lights[MAX_NUM_LIGHTS];
};

With GLSL (uniform blocks disabled) this gets turned into two structs
where one has a 'lights' member that is an array of the other struct.

Teach the OpenGL backend of QRhi how to handle this.

This makes the QRhi port of Qt Quick3D functional with the OpenGL
backend as well.

Change-Id: I6a09b93276794f7ecdd38f5bfbd3491a9ef58146
Fixes: QTBUG-80628
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2019-12-10 17:37:28 +01:00
Edward Welbourne
bf65c27789 Fix more mis-handling of spaces in ISO date format strings
ISO date format doesn't allow spaces within a date, although 3339 does
allow a space to replace the T between date and time. Sixteen tests
added to check this all failed. So clean up the handling of spaces in
the parsing of ISO date-time strings.

[ChangeLog][QtCore][QDateTime] ISO 8601: parsing of dates now requires
a punctuator as separator (it previously allowed any non-digit;
officially only a dash should be allowed) and parsing of date-times no
longer tolerates spaces in the numeric fields: an internal space is
only allowed in an ISO 8601 date-time as replacement for the T between
date and time.

Change-Id: I24d110e71d416ecef74e196d5ee270b59d1bd813
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-12-10 17:26:02 +01:00
Laszlo Agocs
53804f553d rhi: gl: Destructure mat3 correctly
As per std140 packing rules.

Change-Id: I85663d36a9fa617ea387e8f201677471b2ebd948
Fixes: QTBUG-80655
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2019-12-10 16:53:06 +01:00
Liang Qi
979b9335e5 Merge "Merge remote-tracking branch 'origin/5.14' into 5.15" 2019-12-10 17:53:06 +02:00
Joerg Bornemann
c5777ad81c Fix calls to qtFlattenResources from outside resources.prf
The xml_escape function must be part of resources_functions.prf, and the
qmake_immediate resource must not be created multiple times. Instead,
create another qmake_immediate resource with a number suffix.

This commit amends 577b6554.

Task-number: QTBUG-79672
Change-Id: Ibbe20c0fd1940f1fe7733cd1e5b0891f65689782
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2019-12-10 16:13:51 +01:00
Samuel Gaist
42aa740df7 rcc: Fix namespace handling for initializer
rcc currently always writes the namespace mangling macros in both the
initializer constructor and destructor. This patch add the missing
handling of the --namespace option for that part of the generated code.

[ChangeLog][Tools][rcc] rcc now generates correct code when using the
--namespace option.

Change-Id: I7e5e608eb0ad267d11d601fc69c1a87d3f655a6e
Fixes: QTBUG-80649
Reviewed-by: hjk <hjk@qt.io>
2019-12-10 13:30:31 +01:00
Liang Qi
90210d5d9c Merge remote-tracking branch 'origin/5.14' into 5.15
Conflicts:
	tests/auto/network/kernel/qnetworkinterface/BLACKLIST

Change-Id: I1e8866c63b54bcd95fc2a044276ee15b7f60e79a
2019-12-10 13:51:40 +02:00
Timur Pocheptsov
30e32870a0 QCocoaEventDispatcher: make 'interrupt' work
even if we are currently inside processEvents (apparently called manually
and not from QEventLoop::exec()). A carefully crafted application
(see, for example, the linked QTBUG or even updated auto-test)
can trigger itself into failing to exit the current (potentially nested)
event loop. We can harden our Cocoa event dispatcher to detect
such condition and properly propagate 'interrupt' to where it'll
do its job, indeed, interrupting the real event loop (aka [NSApp run]).
This mainly means we have to undo what bool blocker would erroneously do.
Also, long live (as people love to say these days) to another tricky
(somewhat) auto-test (surely, it's not flaky!).

Fixes: QTBUG-79477
Change-Id: I794f0cda23e24d36be67f2bb63d52b74be057c31
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2019-12-10 11:33:26 +01:00
Eirik Aavitsland
95689c645f Make inputmask 'X' mask character require non-blank input
The implementation for the X mask would accept any printable
character. Since that includes the blank character, there was no
difference in behavior between the requiring X and optional x: both
would allow the input to be unset, i.e. blank.

This change should be seen in conjunction with the doc improvement
da0af1e.

[ChangeLog][QtWidgets][QLineEdit] Inputmask X character now requires non-blank input.

Fixes: QTBUG-76320
Change-Id: I3e0363e9be5c13373a157cce69c99379615b5829
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2019-12-10 09:36:24 +01:00
Christian Ehrlicher
5231c26a82 tst_QSqlQuery: fix some tests
Fix some tests in tst_QSqlQuery:
 - make sure to use QSql::HighPrecision in tst_QSqlQuery::precision()
   (needed for psql)
 - remove outdated stuff for mysql 3.x
 - psql_bindWithDoubleColonCastOperator: the placeholder are stored as
   named placeholders in psql
 - avoid some useless old-style casts

Change-Id: I54d29a7e24f17d853cce6baa09a67d9278098810
Reviewed-by: Robert Szefner <robertsz27@interia.pl>
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2019-12-10 06:27:09 +01:00
Andre de la Rocha
b209270825 Windows QPA: Export "checkable" info for menu items through UI Automation
In order to allow screen readers to say checked/unchecked for checkable
menu items, this information has to be provided through UI Automation.
Checkable menu items should implement the "Toggle" UI Automation pattern.
The "checkable" state must also be supported by QAccessibleMenuItem, which
is being added by a separated change.

Task-number: QTBUG-80551
Change-Id: I661668310d1b6b4701d0c0efdb1dcfd15d0db729
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2019-12-10 05:46:45 +01:00
Andre de la Rocha
e40e82ede1 Add "checkable" state to accessible menu item
The information about whether a menu item may be checked is necessary
to allow the platform code (in particular, Windows UI Automation layer)
to make this information available to screen readers.

Task-number: QTBUG-80551
Change-Id: Ibfcc4f2da1ebc68e7dc5df2cd46bbfc0a177da12
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2019-12-10 05:45:51 +01:00
Volker Hilsheimer
c69a2448ab macOS: support copying lazily provided data to the clipboard
Using always EagerRequest type forces the application to provide the
data at copy or drag-begin time, even though the data might never be
requested (pasted or dropped into another application). For data that
is expensive to generate, this is wasteful, and on other platforms Qt
uses the functionality provided by the native clipboard to allow for
on-demand retrieval of data.

Changing the request type to LazyRequest for the cocoa clipboard works,
but then we need to make sure that we resolve all promises at shutdown
time so that the data is available (which is what the end user expects).
Commit ad0d2f463a disabled this for
lazy requests to prevent crashes when using drag'n'drop, where the
QMacPasteboard object is short-lived and stack allocated. We definitely
don't need to worry about lazy data that is not yet retrieved at the
end of a drag'n'drop operation, so limit the fix from the previous
commit to the drag'n'drop scenario.

[ChangeLog][QtGui][QClipboard] Support lazily provided copying of data
to the clipboard on macOS

Change-Id: Id2203999024a0d9d854d6933d39077cc4af925d0
Fixes: QTBUG-76263
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2019-12-10 05:24:11 +01:00
Lorn Potter
c978de990b wasm: set focus on canvas on new screen
This allows user to utilize the application without having to click on
it first to cause the focus-in event.

Change-Id: Ibc9582254dda91eb14ebcdf4b8ea4a4f862aa88d
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2019-12-10 13:46:03 +10:00
Lorn Potter
73fada6d70 wasm: Fix clamp mode
Clamp mode was being obliterated by not appending to EMCC_COMMON_LFLAGS
This fixes crashes of integer overflow

Change-Id: Icae757a7189de25db5ed41df6d41d86304c39830
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2019-12-10 09:57:21 +10:00
Tor Arne Vestbø
c3bd5ffdc8 Don't wrap feature detection macros with QT_HAS_FOO() variants
Using wrappers for these macros is problematic when for example passing the
-frewrite-includes flag to preprocess sources before shipping off to distcc
or Icecream. It will also start producing warnings when compilers implement
http://eel.is/c++draft/cpp.cond#7.sentence-2. See for example
https://reviews.llvm.org/D49091

Both https://clang.llvm.org/docs/LanguageExtensions.html and the SD-6 document at
https://isocpp.org/std/standing-documents/sd-6-sg10-feature-test-recommendations
recommend defining '__has_foo(x) 0' as a fallback for compilers without the
macros, so that's what we go for.

Change-Id: I0298cd3b4a6ff6618821e34642a5ddd6728be767
Reviewed-by: Alex Richardson <arichardson.kde@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-12-10 00:48:07 +01:00
Eirik Aavitsland
191ac31598 Modernize shapedclock example
Relying on the hard clipping of QRegion widget masks to create
non-rectangular windows is a solution from a bygone era. The result
looks horrible with today's eyes, particularly on a high-dpi
screen. Update the example to create smooth anti-aliased edges using
translucent window bacground.

Task-number: QTBUG-64229
Change-Id: I8859d61177d2a2dc446632c23f27f42050e0d7c7
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2019-12-10 00:38:40 +01:00
Eirik Aavitsland
03dc30acca Fix QPushButton style sheet style for overlay (content) image
Unlike comparable widgets like QLabel or QFrame, QPushButton would not
render a content image specified in the stylesheet, unless a border
style was also specified. Fix by explicitly rendering the content
image, if set, in the native-border codepath also.

Although the doc warns about the QPushButton border style having to be
set in order for the background styling to take effect (since the
native border painting otherwise hides it), the previous behavior does
seem unexpected.

Fixes: QTBUG-72029
Change-Id: I8b979b010515dab4dcf2f00344a187c87eeec096
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
2019-12-10 00:38:39 +01:00
Edward Welbourne
f16bd40189 Convert some uses of QStringRef to QStringView
There remain QStringRef uses where QString::splitRef() is used.
Requires converting some .count()s to .size()s, as QStringView lacks count();
and some .toInt()s need to be handled by QLocale::c().

Change-Id: If9a49e063d217671ea9335a82e4bf977b7b48be0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-12-09 19:48:07 +01:00
Edward Welbourne
8310981b80 Prefer QDate::startOfDay() over QDateTime(const QDate &)
The latter can be invalid if midnight is skipped by a spring-forward.

Change-Id: Ibf98d165557229f19622774ebf9a27bb0911c7a7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-12-09 19:47:55 +01:00
Christian Ehrlicher
c27123d743 QAbstractItemView: add a note about ToolTipRole in dataChanged()
Qt::ToolTipRole is not honored by dataChanged() which may be a little
bit surprising. Therefore add a small note about this behavior.

Fixes: QTBUG-78726
Change-Id: Ic4361f55e55ab59d5bae2fdb98907a62055604c5
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2019-12-09 18:49:53 +01:00
Christian Ehrlicher
46d21a3b34 QPushButton: fix icon + text layouting in RTL mode
The fusion style did not properly handle the text layouting for a
QPushButton in RTL mode. Also the menu indicator was not adjusted in
this case.
Fix it by calling the base class implementation as QCommonStyle does it
mostly right. Since Fusion does not handle State_On or State_Sunken but
QCommonStyle does, explicitly mask them out.

Fixes: QTBUG-80083
Change-Id: Ide7bf997b4f4a5b61fcb8ea4a1a152122daef1e2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2019-12-09 18:47:46 +01:00