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 <QskGraphic.h>
|
||||
#include <QskGraphicIO.h>
|
||||
|
||||
#include <QSvgRenderer>
|
||||
#include <QPainter>
|
||||
#include <QImage>
|
||||
#include <QFile>
|
||||
|
||||
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
|
||||
{
|
||||
static QString scope = QStringLiteral( ":/images/" );
|
||||
static QString scope = QStringLiteral( ":/images/qvg/" );
|
||||
|
||||
QString baseName = scope;
|
||||
baseName += id.toLower().replace( ' ', '-' );
|
||||
@ -31,30 +29,12 @@ const QskGraphic* GraphicProvider::loadGraphic( const QString& id ) const
|
||||
auto path = pathName( baseName, QString() );
|
||||
|
||||
if ( path.isEmpty() )
|
||||
path = pathName( baseName, ".png" );
|
||||
|
||||
if ( path.isEmpty() )
|
||||
path = pathName( baseName, ".svg" );
|
||||
path = pathName( baseName, ".qvg" );
|
||||
|
||||
QskGraphic graphic;
|
||||
|
||||
if ( !path.isEmpty() )
|
||||
{
|
||||
if ( path.endsWith( ".png" ) )
|
||||
{
|
||||
graphic = QskGraphic::fromImage( QImage( path ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
QSvgRenderer renderer;
|
||||
if ( renderer.load( path ) )
|
||||
{
|
||||
QPainter painter( &graphic );
|
||||
renderer.render( &painter );
|
||||
painter.end();
|
||||
}
|
||||
}
|
||||
}
|
||||
graphic = QskGraphicIO::read( path );
|
||||
|
||||
return graphic.isNull() ? nullptr : new QskGraphic( graphic );
|
||||
}
|
||||
|
@ -1,20 +1,20 @@
|
||||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file>images/main-icon.svg</file>
|
||||
<file>images/dashboard.svg</file>
|
||||
<file>images/rooms.svg</file>
|
||||
<file>images/devices.svg</file>
|
||||
<file>images/statistics.svg</file>
|
||||
<file>images/storage.svg</file>
|
||||
<file>images/members.svg</file>
|
||||
<file>images/logout.svg</file>
|
||||
<file>images/indoor-temperature.svg</file>
|
||||
<file>images/humidity.svg</file>
|
||||
<file>images/up.svg</file>
|
||||
<file>images/down.svg</file>
|
||||
<file>images/lamps.svg</file>
|
||||
<file>images/music-system.svg</file>
|
||||
<file>images/ac.svg</file>
|
||||
<file>images/router.svg</file>
|
||||
<qresource>
|
||||
<file>images/qvg/main-icon.qvg</file>
|
||||
<file>images/qvg/dashboard.qvg</file>
|
||||
<file>images/qvg/rooms.qvg</file>
|
||||
<file>images/qvg/devices.qvg</file>
|
||||
<file>images/qvg/statistics.qvg</file>
|
||||
<file>images/qvg/storage.qvg</file>
|
||||
<file>images/qvg/members.qvg</file>
|
||||
<file>images/qvg/logout.qvg</file>
|
||||
<file>images/qvg/indoor-temperature.qvg</file>
|
||||
<file>images/qvg/humidity.qvg</file>
|
||||
<file>images/qvg/up.qvg</file>
|
||||
<file>images/qvg/down.qvg</file>
|
||||
<file>images/qvg/lamps.qvg</file>
|
||||
<file>images/qvg/music-system.qvg</file>
|
||||
<file>images/qvg/ac.qvg</file>
|
||||
<file>images/qvg/router.qvg</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
BIN
examples/iotdashboard/images/qvg/ac.qvg
Normal file
BIN
examples/iotdashboard/images/qvg/ac.qvg
Normal file
Binary file not shown.
BIN
examples/iotdashboard/images/qvg/dashboard.qvg
Normal file
BIN
examples/iotdashboard/images/qvg/dashboard.qvg
Normal file
Binary file not shown.
BIN
examples/iotdashboard/images/qvg/devices.qvg
Normal file
BIN
examples/iotdashboard/images/qvg/devices.qvg
Normal file
Binary file not shown.
BIN
examples/iotdashboard/images/qvg/down.qvg
Normal file
BIN
examples/iotdashboard/images/qvg/down.qvg
Normal file
Binary file not shown.
BIN
examples/iotdashboard/images/qvg/humidity.qvg
Normal file
BIN
examples/iotdashboard/images/qvg/humidity.qvg
Normal file
Binary file not shown.
BIN
examples/iotdashboard/images/qvg/indoor-temperature.qvg
Normal file
BIN
examples/iotdashboard/images/qvg/indoor-temperature.qvg
Normal file
Binary file not shown.
BIN
examples/iotdashboard/images/qvg/lamps.qvg
Normal file
BIN
examples/iotdashboard/images/qvg/lamps.qvg
Normal file
Binary file not shown.
BIN
examples/iotdashboard/images/qvg/logout.qvg
Normal file
BIN
examples/iotdashboard/images/qvg/logout.qvg
Normal file
Binary file not shown.
BIN
examples/iotdashboard/images/qvg/main-icon.qvg
Normal file
BIN
examples/iotdashboard/images/qvg/main-icon.qvg
Normal file
Binary file not shown.
BIN
examples/iotdashboard/images/qvg/members.qvg
Normal file
BIN
examples/iotdashboard/images/qvg/members.qvg
Normal file
Binary file not shown.
BIN
examples/iotdashboard/images/qvg/music-system.qvg
Normal file
BIN
examples/iotdashboard/images/qvg/music-system.qvg
Normal file
Binary file not shown.
BIN
examples/iotdashboard/images/qvg/rooms.qvg
Normal file
BIN
examples/iotdashboard/images/qvg/rooms.qvg
Normal file
Binary file not shown.
BIN
examples/iotdashboard/images/qvg/router.qvg
Normal file
BIN
examples/iotdashboard/images/qvg/router.qvg
Normal file
Binary file not shown.
BIN
examples/iotdashboard/images/qvg/statistics.qvg
Normal file
BIN
examples/iotdashboard/images/qvg/statistics.qvg
Normal file
Binary file not shown.
BIN
examples/iotdashboard/images/qvg/storage.qvg
Normal file
BIN
examples/iotdashboard/images/qvg/storage.qvg
Normal file
Binary file not shown.
BIN
examples/iotdashboard/images/qvg/up.qvg
Normal file
BIN
examples/iotdashboard/images/qvg/up.qvg
Normal file
Binary file not shown.
@ -1,8 +1,5 @@
|
||||
CONFIG += qskexample
|
||||
|
||||
QT += svg
|
||||
QT += quick_private # TODO: examples should not use private headers
|
||||
|
||||
SOURCES += \
|
||||
Box.cpp \
|
||||
BoxWithButtons.cpp \
|
||||
|
Loading…
x
Reference in New Issue
Block a user