| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We need strong references for the cases where we place guards on the
stack to prevent the deletion of the objects, and weak references we
hand out to the view. The views don't systematically track the objects
they hold and generally use a QPointer as second line of defence. In
certain cases we cannot avoid deleting objects that are in fact still
referenced as the clearObjectWeakReferences() call shows. If the
QQmlDelegateModel itself is deleted while some view still holds a weak
reference to an object, we cannot avoid deleting that object, no matter
if the view agrees.
Also, we can do with 16bit numbers for the references. The guards on the
stack are rather few and you'll overflow the stack before you hit the
16bit maximum. The references handed out to the views are generally one
or two per item.
Task-number: QTBUG-141963
Change-Id: Ifb79e993abcaf4c169b08641ebc2a6378e0a4776
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
| |
|
|
|
|
|
|
| |
Since there are two kinds of references, we need to be more specific.
Task-number: QTBUG-141963
Change-Id: I8583b91fab62abec49a5f71652e8c04fa8906b7b
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Script references to QQmlDelegateModelItems were references held by
either the created delegate object, the incubation task, or the heap
object that holds the QQmlDelegateModelItem. However, for the object and
the incubation task we only incremented the script reference counter if
they were not populated by QQmlTableInstanceModel. Indeed it makes very
little sense to hold a script reference for those in general. The
incubation task is explicitly checked on isReferenced() and for the
object we have a separate reference count.
Encapsulate the reference counting and drop the unnecessary references.
Check the object in addition to isReferenced() where it matters.
Task-number: QTBUG-141963
Change-Id: Id0fcb7d36afcfc131f52584fc9bcab8989ff7fc1
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The object held by a QQmlDelegateModelItem should not be destroyed from
the outside.
The old destroyObject() method is renamed to destroyObjectLater() since
it actually calls deleteLater() on the object and handles the
implications of that case. The new destroyObject() deletes the object
right away.
Task-number: QTBUG-141963
Change-Id: I38c6a6dca2cb844a70a8af22ac66d29e2150379b
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
| |
|
|
|
|
|
|
|
|
| |
This is a purely mechanical change. It adds accessor methods for the
various members and makes the members private. Where necessary some code
is reordered and some members are cached in locals.
Task-number: QTBUG-141963
Change-Id: Ibc02764c33865896d146aff0950252cfee6d0732
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
| |
We shouldn't poke into the internals of the model item like this and we
should properly destroy the object including its context and attachment
rather than leaving those around.
Task-number: QTBUG-141963
Change-Id: Iddc835bbf8176b1a251f72f59d961f13308fc20a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
| |
As we assume that all QML comes from trusted sources, everything remains
at the default "signicant" security level. The exception are the module
headers which only include other headers and add a few defines.
QUIP: 23
Fixes: QTBUG-136203
Pick-to: 6.10 6.9 6.8
Change-Id: Ib1a2abbb94dbb25420f03e01a2b444f89517a902
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Allow QQmlDelegateModelItemMetaType to store any QQmlInstanceModel, but
also store the kind of model we're dealing with so that we can quickly
produce a QQmlDelegateModel or a QQmlTableInstanceModel when necessary.
This allows us to send the modelChanged() signal. We do not expect to
perform the same trickery that QQmlDelegateModel and
QQmlTableInstanceModel do more often. Therefore this solution does not
need to scale beyond those.
Pick-to: 6.10
Task-number: QTBUG-139941
Change-Id: Id6d2a8ae5f96b755a776eb354e6ae291314dbf7b
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If the delegate changes the model, those changes need to be visible in
the "model" property of the view. To this end, use
QQmlTableInstanceModel's model variant instead of the assigned one once
it has been synchronized.
The inner change signaling from the delegates to the view will be
added in a separate change.
Pick-to: 6.10
Task-number: QTBUG-139941
Change-Id: I1296fa2c886dad063b6b39defef56cb7faf1e943
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Since sticky bindings don't break when their target is written, we can
use two of them to synchronize the model object and the required
property both ways.
[ChangeLog][QtQml] DelegateModel now has a new property
delegateModelAccess. Setting it to DelegateModel.ReadWrite allows you to
write values into the model via required properties the way you can do
the same with context properties.
Task-number: QTBUG-132420
Change-Id: Iee914ca80e840943c0bbe133ab82ee8e88c45eb3
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It should allow the same data to be passed via all available options.
In particular it should allow objects and JavaScript arrays as
(structured) models.
To this effect, port the relevant tests from QQmlDelegateModel over to
QQuickTableView.
Since QQmlTableInstanceModel mistakenly allows passing data via context
properties even in the presence of required properties, we need to
introduce a separate flag for "structured model data". Simply comparing
the context object is not enough anymore.
Task-number: QTBUG-134648
Change-Id: I3828dc079d0efce11a3a280bd07cf723fc4493d5
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Implement QQuickHeaderViewDelegate as the base class for header view
delegates, introducing 'headerView' and 'orientation' properties.
Separate previous delegate settings into HorizontalHeaderViewDelegate
and VerticalHeaderViewDelegate components for Basic, Fusion, and Imagine
styles.
This change improves the modularity and reusability of header view
delegates across different styles. It also allows for more consistent
behavior and easier customization of header views.
A test suite has been added to verify default property settings and
ensure the new components work without warnings.
[ChangeLog][QtQuickControls][HeaderView] Add dedicated delegate
components for vertical and horizontal header views.
Task-number: QTBUG-70326
Change-Id: I8831e77f6909bdae13c3a7262145ab156f63a59a
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
The time it has spent in the pool is only relevant while it actually is
in the pool. There is no reason to waste the space for the poolTime
while it's not.
Furthermore, we don't need QList's implicit sharing for the pool. Use
std::vector instead. We do, however, need to check the pool for
overflows.
Change-Id: Ib9d545367c41dacf73ae4bc391af7928fa67ea2f
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
| |
|
|
|
|
| |
Change-Id: Id8f65f75d6ac5cc3bc20a294d0f449d19c327eea
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
It's better to have the assert condition w.r.t to the context object
within the model where we access the respective data. This patch
removes the existing assert in the QQmlTableInstanceModel::object() and
uses a similar validation inside the
QQmlTableInstanceModel::incubateModelItem() before accessing the
context-specific data.
Fixes: QTBUG-126981
Pick-to: 6.8 6.7 6.5 6.2 5.15
Change-Id: I799476434afc4c22c8b39544bc994232d6bf8ef2
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
roleNames are generally guaranteed to be stable (given that QAIM has no
change signal for them), except that resetting the model is allowed to
invalidate them. TableInstanceModel did so far not take this into account.
Handle this case correctly by snapshotting the current roleNames before
the model is reset. Afterwards, if we detect that roleNames has changed,
we throw the current model set up away and rebuild everything from
scratch – it is unlikely that a more efficient implementation would be
worth it.
Fixes: QTBUG-111987
Pick-to: 6.5 6.2
Change-Id: Id1e3b8e4f983c0f00fc7b30bd4897f1f7fcc3792
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
| |
This allows for a more natural handling of the case where there are no
required properties, and will enable further refactoring of
ConstructionState.
Unfortunately, we lack a way to mark pointers as always non-null in Qt,
else we could mark all required property pointers originating from
QQmlObjectCreatorSharedState as such.
Change-Id: Icaccb27654130fb57daf924bb44a70a5cf114fed
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
| |
|
|
|
|
|
|
|
|
| |
Now that QQuickTableView will start to use more than one
QQmlTableInstanceModel (to implement editDelegate), add
some extra asserts to ensure that we don't mix up which
delegate items were created from which instance model.
Change-Id: I0d556542ca5409a963ea05c63b3e33b643192bbd
Reviewed-by: Doris Verria <doris.verria@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is a semantic patch using ClangTidyTransformator as in
qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8:
auto QtContainerClass = anyOf(
expr(hasType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes))))).bind(o),
expr(hasType(namedDecl(hasAnyName(<classes>)))).bind(o));
makeRule(cxxMemberCallExpr(on(QtContainerClass),
callee(cxxMethodDecl(hasAnyName({"count", "length"),
parameterCountIs(0))))),
changeTo(cat(access(o, cat("size"), "()"))),
cat("use 'size()' instead of 'count()/length()'"))
a.k.a qt-port-to-std-compatible-api with config Scope: 'Container',
with the extended set of container classes recognized.
Change-Id: Idb1f75dfe2323bd1d9e8b4d58d54f1b4b80c7ed7
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If we have a bound context, we still need to record the information that
the object's context belongs to a delegate. For this purpose we have
the extra object. Even when we create the object in the component's
creation context, the object creator still produces a private internal
context for each object. We unconditionally attach the extra object to
that one, and check the whole context hierarchy for extra objects.
As we now record the creation context for model items incubated from
bound components, we need to make sure not to (re)set its context object
and not to forcibly invalidate it. We have QQmlRefPointer::reset() for
that anyway.
As a drive-by we also assert that the object ref count doesn't overflow,
as that has happened during testing.
Pick-to: 6.4
Fixes: QTBUG-104884
Change-Id: I836916c63656124a0f9d7b04902debba59b9f3a3
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Replace the current license disclaimer in files by
a SPDX-License-Identifier.
Files that have to be modified by hand are modified.
License files are organized under LICENSES directory.
Pick-to: 6.4
Task-number: QTBUG-67283
Change-Id: I63563bbeb6f60f89d2c99660400dca7fab78a294
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
|
| |
|
|
|
|
|
| |
We no longer need the parent parameter.
Change-Id: I2687f051d51269abc0a74c4aafe77230ae9223c1
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
| |
|
|
|
|
|
|
|
| |
We can convert everything into a QJSValue if we have an engine and we
can save a binding function in a QVariant by wrapping it into QJSValue.
Change-Id: I48e7c13f3f744f1c50bf673b427fe9331250f313
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add a virtual function setRequiredProperty() to
QQmlInstanceModel that we override in
QQmlTableInstanceModel. This function can be called
from QQuickTableView, upon getting the initItem signal,
to assign initial values to any required properties
that the view makes use of.
This patch is added as a preparation for adding selection
support to QQuickTableView (which will make use of
"required property isSelected" on the delegate)
Change-Id: I55885bafa14da1d432c120bef807e73165f1466c
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
| |
The only caller has a QMetaType available and can query that one. This
leads to subsequent cleanups in QQmlListAccessor::setList and
QQmlAdaptorModel::setModel which now no longer have a need to pass the
QQmlEngine along.
Task-number: QTBUG-82931
Change-Id: I6f38892a3a5098f07bc21f4eebcca82cf52a6838
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
| |
The moc_ file was included inside the namespace, causing
its includes to generate nested namespaces.
Recently some changes to the meta type system turned this
into a compilation error.
Change-Id: I31d6c9133bf56d12457daaa219467e44c1b4a7ea
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
| |\
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Conflicts:
src/qml/jsruntime/qv4executablecompilationunit.cpp
src/qml/jsruntime/qv4executablecompilationunit_p.h
src/qml/qml/qqmlobjectcreator.cpp
src/qml/qml/qqmlpropertycachecreator_p.h
src/qml/qml/qqmltypecompiler.cpp
src/qml/qml/qqmltypedata.cpp
tests/auto/qml/qmlformat/tst_qmlformat.cpp
tools/qmllint/scopetree.cpp
src/qml/qml/qqmlapplicationengine_p.h
Adjusted tools/qmllint/findunqualified.cpp to use newer API
Change-Id: Ibfb4678ca39d626d47527265e3c96e43313873d4
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
In Qt 5.14 model items are directly deleted when draining the reusable
items pool, rather than calling deleteLater() on them. This may be
slightly more efficient and due to some unknown side effect the
deleteLater() call creates a memory leak.
Restore the direct delete in drainReusableItems().
Fixes: QTBUG-82000
Change-Id: Ia1027b1004c04e8aceaa5ff16a600849c46bf470
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This class is not a private detail of QQmlContext. And it is incredibly
hard to see who owns what in there. Let's add some civilization ...
We enforce refcounting for QQmlContextData across the code base, with
two exceptions:
1. QQmlContextPrivate may or may not own its QQmlContextData.
2. We may request a QQmlContextData owned by its parent QQmlContextData.
For these two cases we keep flags in QQmlContextData and when the
respective field (m_parent or m_publicContext) is reset, we release()
once.
Furthermore, QQmlContextData and QQmlGuardedContextData are moved to
their own files, in order to de-spaghettify qqmlcontext_p.h and
qqmlcontext.cpp.
When the QQmlEngine is deleted, any QQmlComponents drop their object
creators now, in order to release any context data held by those.
Before, the context data would be deleted, but the object creators would
retain the dangling pointer.
[ChangeLog][QML][Important Behavior Changes] QQmlContext::baseUrl() does
what the documentation says now: It prefers explicitly set baseUrls over
compilation unit URLs. Only if no baseUrl is set, the CU's URL is
returned. It used to prefer the CU's URL.
Change-Id: Ieeb5dcb07b45d891526191321386d5443b8f5738
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
| |\|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Conflicts:
src/qml/compiler/qqmlirbuilder_p.h
src/qml/qml/qqmlpropertycachecreator_p.h
src/qmltyperegistrar/qmltypesclassdescription.cpp
src/qmltyperegistrar/qmltypesclassdescription.h
src/qmltyperegistrar/qmltypescreator.cpp
src/quick/items/qquicktext_p.h
src/quick/util/qquickvaluetypes_p.h
Change-Id: Ic209741592e7b85820bf3845722023a190ebc1c5
|
| | |\
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Conflicts:
src/qmlmodels/qqmltableinstancemodel.cpp
src/qmlmodels/qqmltableinstancemodel_p.h
Change-Id: I89339b1cb41ba27fe30c79530859a1c2bfbecc69
|
| | | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
In the dtor we don't need to care about any side effects a direct
delete may have. Rather, any deleteLater() may not take effect
anymore as the event loop may be gone already.
Task-number: QTBUG-82000
Change-Id: I97935dc47fbbfd0c050e80c333c36a05f685c45d
Reviewed-by: Joni Poikelin <joni.poikelin@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
| | | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
The reusable items pool should only hold unreferenced objects.
Therefore, we can immediately delete them when draining. release() is
not suitable here because it unconditionally decreases and therefore
underflows the refcount.
Furthermore, the metatype is also refcounted, which means we should
keep it in a QQmlRefCounter in order to not leak references.
Task-number: QTBUG-82000
Change-Id: Iefdaaecc34342eb2e3b1e5a3281f2e46ac472347
Reviewed-by: Joni Poikelin <joni.poikelin@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
| |/ /
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
In many places we carry major and minor versions or revisions that are
loosely coupled to minor versions. As the Qt minor version resets now,
we need to handle these things more systematically. In particular, we
need to add a "major" part to revisions.
QTypeRevision can express the current major/minor pairs more efficiently
and can also be used to add a major version to revisions. This change
does not change the semantics, yet, but only replaces the types.
Change-Id: Ie58ba8114d7e4c6427f0f28716deee71995c0d24
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
| | |
| |
| |
| |
| |
| |
| | |
Consistently store it in QQmlRefPointer so that it doesn't leak.
Change-Id: Id1f06228f6eb477b758901d61c1b71928671dc6a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
| | |
| |
| |
| |
| |
| |
| |
| |
| | |
Factor out the reuse pool logic in TableInstanceModel into a
separate class, so that we can share it with the upcoming implementation
for recycling items in QQmlDelegateModel.
Change-Id: If8f700b7a0208bac7d1cb1de087792e2c3a9b512
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Now that we're about to add support for delegate item
recycling in ListView, we need to add an extra enum
value to the ReleaseFlags. This will be needed later so
that ListView can distinguish between items that are
still referenced and visible in the viewport, and items
that not referenced, but at the same time, still
alive in the pool.
Change-Id: I4a1110b6b43ba109ccd160d22010569dd5410829
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
|
| |\|
| |
| |
| |
| |
| |
| |
| | |
Conflicts:
src/qml/qml/qqmlextensionplugin.cpp
tests/auto/quick/qquicktableview/tst_qquicktableview.cpp
Change-Id: Ic58d36a8532015bae30f2690063db9829b3bf372
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
When reusing a delegate item, it can sometimes happen that the item
ends up being reused at the same location in the table as it had
before it was pooled. And in that case, we don't emit changes to
index, row and column since they technically didn't change.
The problem is that the model might have changed in-between, e.g if
a row has been removed. And in that case, row and column will, even
when unchanged, point to other parts of the model. So all bindings
needs to be reevaluated to ensure that the values they use are
refreshed.
This patch will therefore ensure that we always emit changes to
the mentioned properties when an item is reused, regardless if
they change or not.
Fixes: QTBUG-79209
Change-Id: Icec201a43a30b9f677303fbf652baf6487621deb
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
|
| | |
| |
| |
| |
| |
| |
| | |
We want to have only one import URI per library.
Change-Id: I8be524cf361b12bcb423c9efccd4e047ae3d8d0e
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
| |/
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If a delegates declares a required property of a given name, and that
name exists as a role in the model, we set the property accordingly.
The same holds true for the special properties that come from the
QQmlDelegateModel like "index" and "model".
All roles are still injected into scope and thus accessible;
changing this in Qt5 would be tedious or even impossible while still
maintaining backwardscompatibility with delegates that do not use
required properties.
Change-Id: I4f388ba549c42f1ff9822bdb3b8357c4d45e4b66
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
|
|
The model types are not part of the core QML runtime and should only be
loaded if you explicitly import them. We cannot enforce that in Qt5 as
some of them are available from the QtQml import, but we can change it
in Qt6.
Change-Id: I1e49e84d748e352537ec2d4af901c034c91d038f
Reviewed-by: Erik Verbruggen <erik.verbruggen@me.com>
|