From 7eddc26d24defb3444e21adfbd43f8e568be576d Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Sat, 22 Jul 2017 04:30:45 +0200 Subject: ModelIndexRetriever to abuse Repeater less publicly Simliar to Retriever, but we'd have to alias all properties/roles automatically somehow. --- framework/qml/ModelIndexRetriever.qml | 32 ++++++++++++++++++++++++++++++++ framework/qmldir | 1 + 2 files changed, 33 insertions(+) create mode 100644 framework/qml/ModelIndexRetriever.qml (limited to 'framework') diff --git a/framework/qml/ModelIndexRetriever.qml b/framework/qml/ModelIndexRetriever.qml new file mode 100644 index 00000000..fa3fb64b --- /dev/null +++ b/framework/qml/ModelIndexRetriever.qml @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2017 Christian Mollekopf, + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +import QtQuick 2.4 + +Repeater { + id: root + property var currentData + Item { + id: delegate + property var currentData: model + onCurrentDataChanged: { + root.currentData = model + } + visible: false + } +} diff --git a/framework/qmldir b/framework/qmldir index b7e455b3..0a71b6c8 100644 --- a/framework/qmldir +++ b/framework/qmldir @@ -33,6 +33,7 @@ ListView 1.0 ListView.qml TreeView 1.0 TreeView.qml GridView 1.0 GridView.qml ScrollHelper 1.0 ScrollHelper.qml +ModelIndexRetriever 1.0 ModelIndexRetriever.qml singleton Messages 1.0 Messages.qml singleton Colors 1.0 Colors.qml singleton Icons 1.0 Icons.qml -- cgit v1.2.3