using qvg files to get rid of the qsvg dependency
This commit is contained in:
parent
1150c8693d
commit
bfdecc0413
|
@ -6,10 +6,8 @@
|
||||||
#include "GraphicProvider.h"
|
#include "GraphicProvider.h"
|
||||||
|
|
||||||
#include <QskGraphic.h>
|
#include <QskGraphic.h>
|
||||||
|
#include <QskGraphicIO.h>
|
||||||
|
|
||||||
#include <QSvgRenderer>
|
|
||||||
#include <QPainter>
|
|
||||||
#include <QImage>
|
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
|
|
||||||
const inline QString pathName( const QString& baseName, const QString& suffix )
|
const inline QString pathName( const QString& baseName, const QString& suffix )
|
||||||
|
@ -23,7 +21,7 @@ const inline QString pathName( const QString& baseName, const QString& suffix )
|
||||||
|
|
||||||
const QskGraphic* GraphicProvider::loadGraphic( const QString& id ) const
|
const QskGraphic* GraphicProvider::loadGraphic( const QString& id ) const
|
||||||
{
|
{
|
||||||
static QString scope = QStringLiteral( ":/images/" );
|
static QString scope = QStringLiteral( ":/images/qvg/" );
|
||||||
|
|
||||||
QString baseName = scope;
|
QString baseName = scope;
|
||||||
baseName += id.toLower().replace( ' ', '-' );
|
baseName += id.toLower().replace( ' ', '-' );
|
||||||
|
@ -31,30 +29,12 @@ const QskGraphic* GraphicProvider::loadGraphic( const QString& id ) const
|
||||||
auto path = pathName( baseName, QString() );
|
auto path = pathName( baseName, QString() );
|
||||||
|
|
||||||
if ( path.isEmpty() )
|
if ( path.isEmpty() )
|
||||||
path = pathName( baseName, ".png" );
|
path = pathName( baseName, ".qvg" );
|
||||||
|
|
||||||
if ( path.isEmpty() )
|
|
||||||
path = pathName( baseName, ".svg" );
|
|
||||||
|
|
||||||
QskGraphic graphic;
|
QskGraphic graphic;
|
||||||
|
|
||||||
if ( !path.isEmpty() )
|
if ( !path.isEmpty() )
|
||||||
{
|
graphic = QskGraphicIO::read( path );
|
||||||
if ( path.endsWith( ".png" ) )
|
|
||||||
{
|
|
||||||
graphic = QskGraphic::fromImage( QImage( path ) );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
QSvgRenderer renderer;
|
|
||||||
if ( renderer.load( path ) )
|
|
||||||
{
|
|
||||||
QPainter painter( &graphic );
|
|
||||||
renderer.render( &painter );
|
|
||||||
painter.end();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return graphic.isNull() ? nullptr : new QskGraphic( graphic );
|
return graphic.isNull() ? nullptr : new QskGraphic( graphic );
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,20 +1,20 @@
|
||||||
<RCC>
|
<RCC>
|
||||||
<qresource prefix="/">
|
<qresource>
|
||||||
<file>images/main-icon.svg</file>
|
<file>images/qvg/main-icon.qvg</file>
|
||||||
<file>images/dashboard.svg</file>
|
<file>images/qvg/dashboard.qvg</file>
|
||||||
<file>images/rooms.svg</file>
|
<file>images/qvg/rooms.qvg</file>
|
||||||
<file>images/devices.svg</file>
|
<file>images/qvg/devices.qvg</file>
|
||||||
<file>images/statistics.svg</file>
|
<file>images/qvg/statistics.qvg</file>
|
||||||
<file>images/storage.svg</file>
|
<file>images/qvg/storage.qvg</file>
|
||||||
<file>images/members.svg</file>
|
<file>images/qvg/members.qvg</file>
|
||||||
<file>images/logout.svg</file>
|
<file>images/qvg/logout.qvg</file>
|
||||||
<file>images/indoor-temperature.svg</file>
|
<file>images/qvg/indoor-temperature.qvg</file>
|
||||||
<file>images/humidity.svg</file>
|
<file>images/qvg/humidity.qvg</file>
|
||||||
<file>images/up.svg</file>
|
<file>images/qvg/up.qvg</file>
|
||||||
<file>images/down.svg</file>
|
<file>images/qvg/down.qvg</file>
|
||||||
<file>images/lamps.svg</file>
|
<file>images/qvg/lamps.qvg</file>
|
||||||
<file>images/music-system.svg</file>
|
<file>images/qvg/music-system.qvg</file>
|
||||||
<file>images/ac.svg</file>
|
<file>images/qvg/ac.qvg</file>
|
||||||
<file>images/router.svg</file>
|
<file>images/qvg/router.qvg</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,8 +1,5 @@
|
||||||
CONFIG += qskexample
|
CONFIG += qskexample
|
||||||
|
|
||||||
QT += svg
|
|
||||||
QT += quick_private # TODO: examples should not use private headers
|
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
Box.cpp \
|
Box.cpp \
|
||||||
BoxWithButtons.cpp \
|
BoxWithButtons.cpp \
|
||||||
|
|
Loading…
Reference in New Issue