From 607ced5bfd1390de4342bb44ab99e7acafd9f4e9 Mon Sep 17 00:00:00 2001 From: Paolo Angelelli Date: Wed, 9 May 2018 17:16:59 +0200 Subject: Allow DelegateModel-based views to support multiple delegate types This patch adds a specific abstract QQmlComponent subclass, QQmlAbstractDelegateComponent, and a default implementation, DelegateChooser, that, together with the type DelegateChoice allows determining the delegate type by role and/or index. The patch also adds QQmlAbstractDelegateComponent support to QQmlTableInstanceModel, that is a simplified version of the delegate model, currently only used in the new table view. DelegateChoosers are intended to behave just like Components in the context of the view. This means that they can be declared outside of the view, and also in separate files, and the same delegate component can be used at the same time in multiple views. [ChangeLog][QtQuick][Item Views] Added a DelegateChooser Component to host DelegateChoice instances to choose different delegates in an Item View (e.g. TableView) depending on model roles. Done-with: Michael Brasser Task-number: QTBUG-26681 Change-Id: Ibe24a31daf9142c8a9ff45ef6c65da0aec8a14dc Reviewed-by: Shawn Rutledge --- src/qml/types/types.pri | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/qml/types/types.pri') diff --git a/src/qml/types/types.pri b/src/qml/types/types.pri index 6a74d70a0e..492f408271 100644 --- a/src/qml/types/types.pri +++ b/src/qml/types/types.pri @@ -34,11 +34,13 @@ qtConfig(qml-list-model) { qtConfig(qml-delegate-model) { SOURCES += \ - $$PWD/qqmldelegatemodel.cpp + $$PWD/qqmldelegatemodel.cpp \ + $$PWD/qqmldelegatecomponent.cpp HEADERS += \ $$PWD/qqmldelegatemodel_p.h \ - $$PWD/qqmldelegatemodel_p_p.h + $$PWD/qqmldelegatemodel_p_p.h \ + $$PWD/qqmldelegatecomponent_p.h } qtConfig(qml-animation) { -- cgit v1.2.3