Commit Graph

47607 Commits

Author SHA1 Message Date
Jarek Kobus
225cc60954 Fix flaky QFutureWatcher::startFinish() test
Since waiting for a spy employs polling, it may happen
that while waiting for a startedSpy we had received already
a signal for finishedSpy. This explains current flakiness.

The fix is to connect to lambdas instead and update
the hit count accordingly. Inside lambdas we also
ensure the correct order for started / finised signals.

After waitForFinished() unblocks we ensure that possible
pending asynchronous signals (started / finished) are processed
and check the final state.

Task-number: QTBUG-83076
Change-Id: I16963ef9c011cb613d7b409d3e3032303a942336
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-09-03 20:45:00 +02:00
Volker Hilsheimer
85b0335c41 Tighten up QDialogButtonBox::ButtonLayout enum
... and the equivalent enum in QPlatformDialogHelper.

No need to keep numerical values the same anymore.
Remove ### Qt 6 comment.

Change-Id: Ib369ea6ca2362f6ab0f71a3a6c90c4adaa7f11cd
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-09-03 18:51:41 +02:00
Volker Hilsheimer
f51b690e91 Remove timeStep parameter from QAnimationDrive::advanceAnimation
Addresses ### Qt 6 comment, and documentation pointing out that the parameter
value is ignored. It wasn't ignored in the code, but that's the kind of change
we can make now.

With this change, QUnifiedTimer::updateAnimationTimers is only called with -1
as the currentTick input parameter, also from Qt Declarative. Make it default,
so that leaf modules can be fixed. Once that it done, the parameter can be
removed completely.

Change-Id: I80c57ff92f3b615b932dd73d711cf6397347efd8
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
2020-09-03 18:43:22 +02:00
Tasuku Suzuki
21de5aa1ac Fix build without features.highdpiscaling
Broken since 37d5aaa4b4

Change-Id: Id741f23ccae4f619e6a389ee71b3e7fe0c599989
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-09-04 00:33:50 +09:00
Morten Johan Sørvig
fdb442a72a Remove obsolete native client platform
Change-Id: Ia27cfbb618d216c371a0f8210f0bec483d4f15db
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-09-03 14:51:13 +02:00
Tor Arne Vestbø
f4c58b79a7 Extend test blacklisting from Ubuntu 18.04 to 20.04
Task-number: QTBUG-86187
Change-Id: I3ac3233f7355d1c16bc9bf6e052fdf4bd9ea90de
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-09-03 14:30:04 +02:00
Giuseppe D'Angelo
d5db4ab46d QCocoaKeyMapper: do not sum integral+QFlags
It will become illegal; keep the semantics but force the
right casts.

Change-Id: I4002c5bca6eb90e798e35ca263e7bbb4ff5ad4b1
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-09-03 14:29:47 +02:00
Laszlo Agocs
f6802a5aac rhi: Sanity check the srb in debug builds
Instead of cryptic assertions and crashes depending on the backend,
show some useful warnings (in debug builds only) when one tries to
create an srb with a list where there are duplicated bindings. (a
mistake that happens relatively often during the development of
frameworks, such as Quick 3D, on top)

Change-Id: If1b50a2e8165b001878ad566e048f146e636514f
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2020-09-03 14:18:30 +02:00
Lars Knoll
95daeb2407 Add QByteArrayView overloads for push_back and push_front
Change-Id: If70f3ac6764958d92dcbab44432b4f4994d20405
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2020-09-03 14:15:53 +02:00
Lars Knoll
8897aa071a Clean up the QByteArray API and implementation
Add overloads using a QByteArrayView where it makes sense, and
call those inline from the other overloads. Remove overloads
that are not required anymore (due to implicit conversion of
a const char * to a QByteArrayView).

Guard all implementations against passing this object to them.

Change-Id: I930156f8b05ce72c32cb8201c70513f2e6e19d3e
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-09-03 14:15:52 +02:00
Mårten Nordheim
8eef75f0b5 QList/QByteArray/QString: Base GrowsBackwards heuristic on old size
If you grow from 10 to 100 characters then even if the point of
insertion was the end then it will get the GrowsBackwards option on
realloc. By basing it on the oldSize the intention of the position to
insert at is better clarified.

Change-Id: Ia73f4902e8356d94709556de5704cbfa0e1a3a56
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-09-03 14:15:32 +02:00
Fabian Kosmale
69d239ef00 Enforce complete method types of QML registered classes
For QML, we like to avoid doing string to type lookups at runtime as
much as possible. Therefore, QML registration macros like QML_ELEMENT
now cause moc to require complete types not only for properties, but
also for all methods known to the metatype system.

Change-Id: Ied3d940c102719db4852d3a748d05be1f415b353
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2020-09-03 09:46:57 +02:00
Tasuku Suzuki
905d4e4eee Fix build without features.filesystemmodel
94dcb5454f breaks the build indirectly

Change-Id: Iba76a76fd14e65a7eb230c53608e405bd821ef74
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-09-03 16:27:42 +09:00
Ulf Hermann
53fde3c573 Reimplement QSequentialIterable using QMetaSequence
Change-Id: Ie721a5f0caa697c4bf15a81f3762cf79d3c54f5a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-09-03 08:27:44 +02:00
Eskil Abrahamsen Blomfeldt
0e0149c64d Ignore weight in .ui files instead of converting it
In 3558704ed5, we added code to
support old .ui files which used the old integer scale for font
weights by checking for a special attribute which would help
separate new and old files.

Since then, it has become apparent that the weight element in
.ui is not actually used for anything, since it is only emitted
when the bold flag is set and always has to match QFont::Bold
in these cases.

So instead of converting, we simply ignore it now, and respect
the bold flag instead.

This also reverts the changes to ui4.* in uic, since the
scale attribute is no longer needed.

Task-number: QTBUG-42248
Change-Id: I1898868b58004099590f4eaf01f24c57bd34d779
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2020-09-03 07:31:45 +02:00
Volker Hilsheimer
6bbf3f0257 Mark obsolete QPrinter functions as deprecated from 5.15 on
Some of the methods are overrides of virtuals in QPagedPaintDevice, so document
and mark those as obsolete as well.

Adjust code that calls those APIs to use the recommended replacement.

Change-Id: I3cd1980609ea20808d17379a5f97ca595e869875
Pick-to: 5.15
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-09-03 07:00:36 +02:00
Giuseppe D'Angelo
25351dcc54 Long live QKeyCombination!
C++20 via P1120 is deprecating arithmetic operations between
unrelated enumeration types, and GCC 10 is already complaining.
Hence, these operations might become illegal in C++23 or C++26 at
the latest.

A case of this that affects Qt is in key combinations: a
QKeySequence can be constructed by summing / ORing modifiers and a
key, for instance:

  Qt::CTRL + Qt::Key_A
  Qt::SHIFT | Qt::CTRL | Qt::Key_G (recommended, see below)

The problem is that the modifiers and the key belong to different
enumerations (and there's 2 enumerations for the modifier, and one
for the key).

To solve this: add a dedicated class to represent a combination of
keys, and operators between those enumerations to build instances
of this class.

I would've simply defined operator|, but again docs and pre-existing
code use operator+ as well, so added both to at least tackle simple
cases (modifier + key).

Multiple modifiers create a problem: operator+ between them yields
int, not the corresponding flags type (because operator+ is not
overloaded for this use case):

  Qt::CTRL + Qt::SHIFT + Qt::Key_A
  \__________________/      /
          int              /
           \______________/
                  int

Not only this loses track of the datatypes involved, but it would
also then "add" the key (with NO warnings, now its int + enum, so
it's not mixing enums!) and yielding int again.

I don't want to special-case this; the point of the class is
that int is the wrong datatype. Everything works just fine when
using operator| instead:

  Qt::CTRL | Qt::SHIFT | Qt::Key_A
  \__________________/      /
      Qt::Modifiers        /
           \______________/
            QKeyCombination

So I'm defining operator+ so that the simple cases still work,
but also deprecating it.

Port some code around Qt to the new class. In certain cases,
it's a huge win for clarity. In some others, I've just added
the necessary casts to make it still compile without warnings,
without attempting refactorings.

[ChangeLog][QtCore][QKeyCombination] New class to represent
a combination of a key and zero or more modifiers, to be used
when defining shortcuts or similar.

[ChangeLog][Potentially Source-Incompatible Changes] A keyboard
modifier (such as Qt::CTRL, Qt::AltModifier, etc.) should be
combined with a key (such as Qt::Key_A, Qt::Key_F1, etc.) by using
operator|, not operator+.  The result is now an object of type
QKeyCombination, that stores the key and the modifiers.

Change-Id: I657a3a328232f059023fff69c5031ee31cc91dd6
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-09-03 07:00:31 +02:00
Edward Welbourne
f03b2f7711 Turn QFileDevice::MemoryMapFlags into a proper QFlag
Task-number: QTBUG-85700
Change-Id: I2a741b67927fa7185acece51d774b90b0b88c705
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2020-09-02 21:53:42 +00:00
Joerg Bornemann
067fb7915a pro2cmake: Fix qmake parser's line continuation handling
The qmake parser of pro2cmake handles completely commented lines to make
assignments like this work:

    SUBDIRS = \
       foo \
    #  bar \
       bar

However, assignments like

    SUBDIRS = \
       foo \
       #bar \
       bar

were cut off at the commented line.

Fix this by allowing leading whitespace for "fully commented lines".

Change-Id: Ib5de850a02fd9b9ebb7c056c2f64f9d684334b08
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-09-02 23:44:15 +02:00
Joerg Bornemann
46f8c46bee CMake: Teach QtProcessConfigureArgs.cmake to configure other modules
Until now, QtProcessConfigureArgs.cmake could only handle qtbase and the
top-level build. Add the variable MODULE_ROOT that the user can point to
the module that is to be configured.

Example - QtDeclarative can now be configured like this:

cd qtdeclarative-build-dir
echo -qml-network > config.opt
cmake -DOPTFILE=config.opt -DMODULE_ROOT=<source-root>/qtdeclarative \
    -DCMAKE_COMMAND=<install-prefix>/bin/qt-cmake-private \
    -P <source-root>/qtbase/cmake/QtProcessConfigureArgs.cmake

A convenience script that saves the user from entering this unwieldy
incantation will be added in a subsequent commit.

Change-Id: If46103de3a8eb84b15e7600ebfec25544451e1d5
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-09-02 23:44:03 +02:00
Andrei Golubev
27fed69d0a QString/QList: disregard space at front during reserve()
Aligned QString, QList to the new agreed upon behavior

Aligned QList::resize() along the way to be consistent with QString/QBA

Task-number: QTBUG-84320
Change-Id: Ie9d7b4b6ebe54bd373af78d92906144b383bbfe2
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-09-02 23:10:25 +02:00
Mårten Nordheim
b98b7de0da QByteArray: Disregard space at front during ::reserve(...)
Traditionally when calling reserve it's because you expect to append
up to X amount of bytes. We should keep that behavior the same.

With another patch still in the works current behavior caused an issue
with QStringBuilder in QNAM, as mirrored in the testcase attached.

Change-Id: I9792a8f158fc9235e3de48ac8b06ac2c10e7f3dc
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-09-02 23:10:21 +02:00
Giuseppe D'Angelo
39e07ebf64 Long live QAIM::multiData!
Views / delegates absolutely *adore* hammering data(). A simple
QListView showing a couple of dozens entries can call data()
a hundred of times on the first show.

Back of the hand calculation,

* 2 times per visible item (sizeHint() + paint()),
* times 9 roles used by the default delegate,
* times 20 visible items

= 360 as a bare minimum, assuming the view doesn't redraw twice
accidentally. Move the mouse over the view, and that'll cause
a full update with certain styles: 360 calls to data() per update.

This has an overhead visible in profilers. The model's data()
has to re-fetch the index from its data structure and extract
the requested field every time.

Also, QVariant is used for the data interexchange,
meaning anything that won't fit in one is also a memory allocation.
This problem will likely be gone in Qt6Variant as that
will store sizeof(void*) * 3, meaning QImage/QPixmap and similar
polymorphic classes will fit in a QVariant now...

So I'm trying to to remove part of that overhead by allowing
views to request all the data they need in one go. For now,
one index a a time.

A view might also store the data returned. The idea is that
the same role on different indexes will _very likely_
return variants of the same type. So a model could move-assign
the data into the variant, avoiding the memory allocation
/deallocation for the variant's private.

This patch:

1) Introduces QModelRoleData as a holder for role+data.

2) Introduces QModelRoleDataSpan as a span over QModelRoleData.
The idea of a span type is twofold. First and foremost, we are
in no position to choose which kind of container a view should
use to store the QModelRoleData objects for a multiData() call;
a span abstracts any contiguous sequence, leaving the view free
to do whatever it wants (statically allocate, use a vector, etc.).
It also solves the problem of efficient passing the roles and
gathering the returned variants from multiData().

3) Add multiData(), which populates a span of roles for a given
model index. The main advantage here is that a model can fetch
all the needed information for a given index just once, then
iterate on the span and provide data for each requested role.
Cf. this with data(), where every call has to re-fetch
the information for the index.

A couple of models have been ported to multiData(), as well as
QStyledItemDelegate.

[ChangeLog][QtCore][QModelRoleData] New class.

[ChangeLog][QtCore][QModelRoleDataSpan] New class.

[ChangeLog][QtCore][QAbstractItemModel] Added the multiData()
function.

Change-Id: Icce0d108ad4e156c9fb05c83ce6df5f58f99f118
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-09-02 22:51:42 +02:00
Fabian Kosmale
19874d6a63 QVariant: Fix conversion code
Fixes: QTBUG-86330
Change-Id: Ib89dcf1195e0081b4c4e2845f90c52c612e5911a
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2020-09-02 22:50:50 +02:00
Christian Ehrlicher
3ddffd2d8b QTable/TreeView: fix sortByColumn() when view is already sorted
When the view was already sorted by the column and order given to
sortByColumn(), a resort was not triggered which is a regression since
d0f909f8db.
Therefore don't rely on sortIndicatorChanged() in this case and trigger
an explicit sort as it's done when no user-triggered sorting is enabled

Fixes: QTBUG-86268
Change-Id: I3ec30ab81f304d5a19cef6d67b8a81c21b4a112d
Pick-to: 5.15
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2020-09-02 22:44:30 +02:00
Lars Knoll
26b38510ce Fix an annoying compiler warning on MSVC
Fix a warning about truncating a const through a static_cast
on MSVC.

Change-Id: I381ce806d602c006ef6f14eb4fc89716bc5403ae
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-09-02 22:44:29 +02:00
Lars Knoll
927647cd03 Fix QPropertyAlias to work with all kinds of properties
So far QPropertyAlias was limited to working with QProperty<T>.
Change the implementation, so it can be constructed from any
property or even a QBindable<T>.

Change-Id: I175cffe94a9ef332367d39faa976eb065b0e6ffe
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-09-02 22:44:29 +02:00
Lars Knoll
91a24f6cd7 Add setter/getter support in QBindableInterface
This is required to properly implement QPropertyAlias on
all properties.

Change-Id: I2443b52aa72116596fa0891e5f8b8414518dcd93
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-09-02 22:44:29 +02:00
Lars Knoll
ad32ac5b4f Make bindings introspectable through moc
Add a new BINDABLE declaration to the Q_PROPERTY() macro that tells moc
where to find the QBindable for the property.

Add a QUntypedBindable base class to QBindable<T> that gives access to
generic functionality and checks argument compatibility at runtime.
QBindable<T> will still do static checking at compile time.

Add QMetaProperty::isBindable() and QMetaProperty::bindable()
to be able to dynamically access the binding functionality.

Change-Id: Ic7b08ae2cde83fd43e627d813a886e1de01fa3dc
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-09-02 22:44:29 +02:00
Fabian Kosmale
3e6c092793 Fix static build
Change-Id: I52a31c76d2acb996ae5cf0b2ee6d221864d76b28
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-09-02 22:44:29 +02:00
Lars Knoll
5b81c80b46 Add QObjectCompatProperty
Add a compatibility property class that makes porting to the new
property system as simple as possible.

Binding evaluation for those compat properties is eager, as we
do not control possible side effects of the code in the existing
setters.

Change-Id: Ic56347abb49e40631ec73e88c6d40d4bdb05ca29
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-09-02 22:44:29 +02:00
Lars Knoll
918c61f275 Add support for computed properties
Add a QObjectComputedProperty. This class doesn't store the data
itself, instead relies on a getter method to compute it's value.
As the property is read-only, one can not bind to it, but it can
be used in other property bindings.

Change-Id: I0f6bffdd9f80f1d0829826f93a47257f2b3127af
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-09-02 22:44:29 +02:00
Lars Knoll
1e1b888092 Pass a pointer to the property data into the method evaluating a binding
Make it possible to evaluate the binding but write the result into
a different memory location. This will help support compat properties,
where the setter does a lot of additional work.

Change-Id: Ib60220eb629e3dcb5c0d7004b693e92290dfabe5
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-09-02 22:44:29 +02:00
Lars Knoll
3b3b190eef Add support for bindable properties to QObject
Add Q_OBJECT_BINDABLE_PROPERTY() macro that can be used to define
a bindable property inside QObject.

The macro and the class behind it creates storage for a property
that is bindable inside a QObject or QObjectPrivate. The property
only uses as much space as the data contained, ie. it has no
storage overhead, as long as no bindings are being used.

Bindings are being stored and looked up in the QBindingStorage
associated with the owning object.

Change-Id: I1dadd7bddbad6fbf10cfa791d6461574b9db82dd
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-09-02 22:44:28 +02:00
Lars Knoll
af149ada60 Always allow setting a null binding on a property
This should always work to allow clearing a binding.

Change-Id: I55165a50f7fe62a1f8a5078d452968db09a6d360
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-09-02 22:44:28 +02:00
Lars Knoll
b788c64dc3 Cleanup QBindingPrivate
Simplify the data structure. We only need one pointer for either
the static callback or a bindingWrapper, so don't share it
with the dependency observer array.

Also ensure we reset the propertyDataPtr and clear the observers
when the binding gets removed from a property.

Change-Id: I4c1e7ec7823c3ef12c63d6f758b757e7bac60cae
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-09-02 22:44:28 +02:00
Lars Knoll
6778b247a8 Add a QBindingStorage class
QBindingStorage is a class that can store a set of binding objects
for the properties of a QObject. This will get used to reduce the
memory overhead of the property system when adding bindable properties
to QObject based classes.

The binding storage has a pointer to the TLS entry containing the
currently evaluating binding. Like that we avoid repeated TLS
lookups and reduce the overhead of the property system to one
pointer lookup and one compare for the case that properties
aren't being used.

Each QObject now owns one binding storage object, that can be used to
store binding data for properties that members of the QObject.

Change-Id: I27427c03c2ba281f072e074be96147bdbcaac246
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-09-02 22:44:28 +02:00
Lars Knoll
9b6df7deb3 Ground work for bindable properties in QObject
Add a private QBindableInterface and a public QBindable<T>
class, that will be the API interface for accessing bindings
for properties in QObject.

The QBindable class gives access to all aspects of
the property related to bindings. This includes setting
and retrieving bindings, installing observers and creating
a direct binding on this property.

Change-Id: Iaead54d2bd6947bd2cda5052142b2a47dd8bf7c4
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2020-09-02 22:44:28 +02:00
Lars Knoll
638df6138e Remove operators allowing assignment of a binding to a property
These look rather weird, an explicit property.setBinding() call
is simply better in this case, and also more aligned with the API
we can offer in QObject.

Change-Id: Ifb00fd47a75e6b3bc94e34bf49e4f13249565bfe
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2020-09-02 22:44:28 +02:00
Lars Knoll
ee96d705cc Move QPropertyObserver further up in the header file
Reorder source code to make the follow-up work easier. Also clean up
retrieving the pointer to the aliased property.

Make setSource(QPropertyBindingData) public, it'll be needed later on.

Change-Id: I784fdceac8722c7df756b2d7c35e08c7ab3a2074
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2020-09-02 22:44:28 +02:00
Lars Knoll
e3ea8768fc Introduce a common base class for all QProperty types
Add an empty QUntypedPropertyData class. This allows making
a couple of places where the system is currently using a
void * more type safe.

Also add a QPropertyData<T> as an intermediate class between
QUntypedPropertyData and QProperty. This class will get used
in a future commit to simplify storing property data separately
from the possible binding data.

Also simplify the static observer handling a bit by always
passing it a pointer to the QUntypedPropertyData instead of
some other void * that could point to anything.

Change-Id: I1f8144ea717815b1bc6f034d1ac883c13af5aaf8
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2020-09-02 22:44:27 +02:00
Lars Knoll
e6988d4d0b Remove QNotifiedProperty and Q_PRIVATE_QPROPERTY
And all related functionality. This is being replaced by
Q_BINDABLE_PROPERTY and Q_OBJECT_BINDABLE_PROPERTY in the
next few commits. The new infrastructure coming will play
nicer along with the existing property system.

Commented out some autotests, that will get reimplemented
with the updated infrastructure.

Change-Id: I50c30bd4d5c6c6b6471f8eb93870e27d86f5a009
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2020-09-02 22:44:27 +02:00
Lars Knoll
e638e8a28d Cleanups: Rename some classes
Rename QPropertyBase to QPropertyBindingData, as it contains the
data related to bindings. The new name fits better, as the data
can now also live somewhere else than the data strored in the
property.

Change-Id: I489efb86ad2e0bad2740c9d1aa74506fe103d343
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2020-09-02 22:44:27 +02:00
Lars Knoll
0c89721716 Get rid of QPropertyValueStorage
This simplifies and cleans up the code.

Change-Id: Ic811925d644466ff298f1109efcda0537e52ce0d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-09-02 22:44:27 +02:00
Lars Knoll
331c106bdb Remove the special handling of QProperty<bool>
Since we will be storing property data differently in most cases,
having this special case would create too many additional complications.

Change-Id: I27042b0730559bb375d8e3c07324398403a9885d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-09-02 22:44:27 +02:00
Fabian Kosmale
733d890430 Add operator-> and operator*() to QProperty
Enable the arrow operator for all types that could have members, so
that one can e.g. write myStringProperty->size() instead of having to
use the less convenient myStringProperty.value().size().

Also cleaned up the rvalue ref overloads to be
disabled for basic types. For those we now also
return by value, for more complex types we
return a const reference.

Change-Id: If6a75898dc0a097f57052488f0af0cd7166b3393
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2020-09-02 22:44:27 +02:00
Lars Knoll
52bbb19fa4 Reduce some code duplication
The r-value setBinding() overloads can be removed,
as they took a copy internally anyway.

Change-Id: I691265299e5cb336791f614b30788c81467df534
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-09-02 22:44:27 +02:00
Lars Knoll
80745bfffe Generalize some methods taking a QProperty<>
Generalize some methods taking a QProperty<T>,
so that they can work with other types that
implement the QProperty interface as well.

This removes some duplication between QProperty and
QNotifiedProperty. It also makes it possible to
create private property classes that store their
data in a different place.

Change-Id: I4b1ae8589cb9a76be59e63206044dcf2244163c2
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2020-09-02 22:44:26 +02:00
Friedemann Kleint
00e181fdae Vista Style: Fix pixelized arrow of QCommandLinkButton with scaling
Do not unnecessarily downscale the pixmap; QIcon will set the correct
device pixel ratio.

Pick-to: 5.15
Task-number: QTBUG-86344
Change-Id: I04ba93ec3003d3dfd458b032cc5c8fc9cf38e957
Reviewed-by: André de la Rocha <andre.rocha@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2020-09-02 20:44:26 +00:00
Friedemann Kleint
85cdc8ebc1 Vista style: Fix pixelized elements after focus/activation
Use a float device pixel ratio in the style animations and default
to the application's device pixel ratio.

Pick-to: 5.15
Task-number: QTBUG-86344
Change-Id: I093bfefc0f544eb488da0993a183f92c9c77a286
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2020-09-02 22:44:26 +02:00