main.cpp 1.4 KB

1234567891011121314151617181920212223242526272829303132333435
  1. #include <QtGui/QApplication>
  2. #include <QtDeclarative>
  3. #include "qmlapplicationviewer.h"
  4. #include "qdeclarativepincharea.h"
  5. #include "coloringcanvas.h"
  6. #include "drmimageprovider.h"
  7. #include "thumbnailimageprovider.h"
  8. #include "FilePathConst.h"
  9. int main(int argc, char *argv[])
  10. {
  11. QApplication app(argc, argv);
  12. QmlApplicationViewer viewer;
  13. viewer.rootContext()->setContextProperty("drmDataRoot", getDrmDataRoot());
  14. viewer.rootContext()->setContextProperty("thumbnailDataRoot", getThumbnailDataRoot());
  15. viewer.rootContext()->setContextProperty("freeDataRoot", getFreeDataRoot());
  16. viewer.rootContext()->setContextProperty("defaultImageFile", getDefaultImageFile());
  17. qmlRegisterType<ColoringCanvas>("ColoringItems", 1, 0, "ColoringCanvas");
  18. qmlRegisterType<QDeclarativePinchArea>("ColoringItems", 1, 0, "PinchArea");
  19. qmlRegisterType<QDeclarativePinchEvent>("ColoringItems", 1, 0, "PinchEvent");
  20. qmlRegisterType<QDeclarativePinch>("ColoringItems", 1, 0, "Pinch");
  21. viewer.rootContext()->engine()->addImageProvider(QLatin1String("drm"), new DrmImageProvider);
  22. viewer.rootContext()->engine()->addImageProvider(QLatin1String("thumbnail"), new ThumbnailImageProvider);
  23. viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockLandscape);
  24. viewer.setMainQmlFile(QLatin1String("qml/ColouringBook/main.qml"));
  25. viewer.showExpanded();
  26. return app.exec();
  27. }