2017-07-21 18:21:34 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* QSkinny - Copyright (C) 2016 Uwe Rathmann
|
|
|
|
* This file may be used under the terms of the 3-clause BSD License
|
|
|
|
*****************************************************************************/
|
|
|
|
|
2017-07-24 07:48:36 +02:00
|
|
|
#include "Image.h"
|
|
|
|
|
2017-07-21 18:21:34 +02:00
|
|
|
#include <SkinnyShapeProvider.h>
|
|
|
|
#include <SkinnyShortcut.h>
|
|
|
|
|
|
|
|
#include <QskGraphicImageProvider.h>
|
2018-10-04 10:34:44 +02:00
|
|
|
#include <QskQml.h>
|
2017-07-21 18:21:34 +02:00
|
|
|
#include <QskObjectCounter.h>
|
|
|
|
|
|
|
|
#include <QGuiApplication>
|
2018-08-03 08:15:28 +02:00
|
|
|
#include <QQmlApplicationEngine>
|
2022-04-11 11:13:47 +02:00
|
|
|
#include <QQuickWindow>
|
|
|
|
|
|
|
|
namespace
|
|
|
|
{
|
|
|
|
class ImageProvider : public QskGraphicImageProvider
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ImageProvider( const QString& id )
|
|
|
|
: QskGraphicImageProvider( id, type() )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
static ImageType type()
|
|
|
|
{
|
|
|
|
const auto backend = QQuickWindow::sceneGraphBackend();
|
|
|
|
return ( backend == "software" ) ? Image : Texture;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
2017-07-21 18:21:34 +02:00
|
|
|
|
|
|
|
int main( int argc, char* argv[] )
|
|
|
|
{
|
|
|
|
#ifdef ITEM_STATISTICS
|
|
|
|
QskObjectCounter counter( true );
|
|
|
|
#endif
|
|
|
|
|
|
|
|
const char providerId[] = "shapes";
|
|
|
|
|
2018-10-04 10:34:44 +02:00
|
|
|
QskQml::registerTypes();
|
2017-07-24 07:48:36 +02:00
|
|
|
qmlRegisterType< Image >( "Images", 1, 0, "Image" );
|
|
|
|
|
2017-07-21 18:21:34 +02:00
|
|
|
Qsk::addGraphicProvider( providerId, new SkinnyShapeProvider() );
|
|
|
|
|
|
|
|
QGuiApplication app( argc, argv );
|
|
|
|
|
|
|
|
SkinnyShortcut::enable( SkinnyShortcut::Quit |
|
|
|
|
SkinnyShortcut::DebugShortcuts );
|
|
|
|
|
|
|
|
QQmlApplicationEngine engine( QUrl( "qrc:/qml/images.qml" ) );
|
2022-04-11 11:13:47 +02:00
|
|
|
|
|
|
|
// image provider that falls back to the graphic provider above
|
|
|
|
engine.addImageProvider( providerId, new ImageProvider( providerId ) );
|
2017-07-21 18:21:34 +02:00
|
|
|
|
|
|
|
return app.exec();
|
|
|
|
}
|