File indexing completed on 2024-04-14 04:36:55
0001 /*************************************************************************** 0002 * Copyright (C) 2017 by Emmanuel Lepage Vallee * 0003 * Author : Emmanuel Lepage Vallee <emmanuel.lepage@kde.org> * 0004 * * 0005 * This program is free software; you can redistribute it and/or modify * 0006 * it under the terms of the GNU General Public License as published by * 0007 * the Free Software Foundation; either version 3 of the License, or * 0008 * (at your option) any later version. * 0009 * * 0010 * This program is distributed in the hope that it will be useful, * 0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 0013 * GNU General Public License for more details. * 0014 * * 0015 * You should have received a copy of the GNU General Public License * 0016 * along with this program. If not, see <http://www.gnu.org/licenses/>. * 0017 **************************************************************************/ 0018 #include "plugin.h" 0019 0020 #include <QtCore/QDebug> 0021 0022 #include "adapters/decorationadapter.h" 0023 #include "adapters/scrollbaradapter.h" 0024 #include "adapters/geometryadapter.h" 0025 #include "views/hierarchyview.h" 0026 #include "views/listview.h" 0027 #include "views/treeview.h" 0028 #include "views/sizehintview.h" 0029 #include "qmodelindexwatcher.h" 0030 #include "qmodelindexbinder.h" 0031 #include "views/comboboxview.h" 0032 #include "views/indexview.h" 0033 #include "flickablescrollbar.h" 0034 #include "delegatechoice.h" 0035 #include "delegatechooser.h" 0036 #include "proxies/sizehintproxymodel.h" 0037 0038 // Strategies 0039 #include "strategies/justintime.h" 0040 #include "strategies/role.h" 0041 #include "strategies/proxy.h" 0042 0043 0044 void KQuickItemViews::registerTypes(const char *uri) 0045 { 0046 Q_ASSERT(uri == QLatin1String("org.kde.playground.kquickitemviews")); 0047 0048 qmlRegisterType<HierarchyView>(uri, 1, 0, "HierarchyView"); 0049 qmlRegisterType<TreeView>(uri, 1, 0, "TreeView"); 0050 qmlRegisterType<ListView>(uri, 1, 0, "ListView"); 0051 qmlRegisterType<SizeHintView>(uri, 1, 0, "SizeHintView"); 0052 qmlRegisterType<IndexView>(uri, 1, 0, "IndexView"); 0053 qmlRegisterType<ScrollBarAdapter>(uri, 1, 0, "ScrollBarAdapter"); 0054 qmlRegisterType<GeometryAdapter>(uri, 1, 0, "GeometryAdapter"); 0055 qmlRegisterType<DecorationAdapter>(uri, 1,0, "DecorationAdapter"); 0056 qmlRegisterType<ComboBoxView>(uri, 1, 0, "ComboBoxView"); 0057 qmlRegisterType<FlickableScrollBar>(uri, 1, 0, "FlickableScrollBar"); 0058 qmlRegisterType<QModelIndexWatcher>(uri, 1, 0, "QModelIndexWatcher"); 0059 qmlRegisterType<QModelIndexBinder>(uri, 1, 0, "QModelIndexBinder"); 0060 qmlRegisterType<SizeHintProxyModel>(uri, 1, 0, "SizeHintProxyModel"); 0061 qmlRegisterType<DelegateChoice>(uri, 1, 0, "DelegateChoice"); 0062 qmlRegisterType<DelegateChooser>(uri, 1, 0, "DelegateChooser"); 0063 qmlRegisterUncreatableType<ListViewSections>(uri, 1, 0, "ListViewSections", ""); 0064 0065 auto suri = QString(QString(uri) + QString(".Strategies")).toLatin1(); 0066 qmlRegisterType<GeometryStrategies::JustInTime>(suri, 1, 0, "JustInTime"); 0067 qmlRegisterType<GeometryStrategies::Role>(suri, 1, 0, "Role"); 0068 0069 // Alias 0070 qmlRegisterUncreatableType<QModelIndexBinder>( 0071 "org.kde.playground.kquickitemviews", 1, 0, "RoleBinder", 0072 "Cannot create objects of type RoleBinder, use it as an attached poperty" 0073 ); 0074 } 0075 0076 void KQuickItemViews::initializeEngine(QQmlEngine *engine, const char *uri) 0077 { 0078 Q_UNUSED(engine) 0079 Q_UNUSED(uri) 0080 }