File indexing completed on 2023-10-03 11:16:16
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 0019 //Qt 0020 #include <QtCore/QString> 0021 #include <QtCore/QTimer> 0022 #include <QtGui/QGuiApplication> 0023 #include <QQuickView> 0024 #include <QQmlEngine> 0025 #include <QQmlContext> 0026 #include <QSharedPointer> 0027 #include <QQmlApplicationEngine> 0028 0029 #include "modelviewtester.h" 0030 #include "freefloatingmodel.h" 0031 0032 #include <KQuickItemViews/plugin.h> 0033 0034 #ifdef KQUICKITEMVIEWS_USE_STATIC_PLUGIN 0035 Q_IMPORT_PLUGIN(KQuickItemViews) 0036 #else 0037 #include <KQuickItemViews/plugin.h> 0038 #endif 0039 0040 0041 int main(int argc, char **argv) 0042 { 0043 QGuiApplication app(argc, argv); 0044 0045 QQmlApplicationEngine engine; 0046 0047 qmlRegisterType<FreeFloatingModel>("modeltest", 1,0, "FreeFloatingModel"); 0048 qmlRegisterType<ModelViewTester >("modeltest", 1,0, "ModelViewTester"); 0049 0050 #ifdef KQUICKITEMVIEWS_USE_STATIC_PLUGIN 0051 qobject_cast<QQmlExtensionPlugin*>(qt_static_plugin_KQuickItemViews().instance())->registerTypes("org.kde.playground.kquickitemviews"); 0052 #else 0053 KQuickItemViews v; 0054 v.registerTypes("org.kde.playground.kquickitemviews"); 0055 #endif 0056 0057 engine.load(QUrl("qrc:///modeltest.qml")); 0058 0059 qDebug() << "LOADED" << engine.rootObjects() << engine.rootObjects().isEmpty(); 0060 0061 return engine.rootObjects().isEmpty() ? 1 : app.exec(); 0062 }