Merge branch 'master' of https://github.com/uwerat/qskinny
This commit is contained in:
commit
86cb02466c
|
@ -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 \
|
||||||
|
|
|
@ -22,7 +22,7 @@ int main( int argc, char* argv[] )
|
||||||
|
|
||||||
SkinnyShortcut::enable( SkinnyShortcut::AllShortcuts );
|
SkinnyShortcut::enable( SkinnyShortcut::AllShortcuts );
|
||||||
|
|
||||||
QskFocusIndicator* focusIndicator = new QskFocusIndicator();
|
auto focusIndicator = new QskFocusIndicator();
|
||||||
focusIndicator->setObjectName( "FocusIndicator" );
|
focusIndicator->setObjectName( "FocusIndicator" );
|
||||||
|
|
||||||
MainWindow window;
|
MainWindow window;
|
||||||
|
|
|
@ -125,11 +125,9 @@ namespace
|
||||||
#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
|
#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
|
||||||
registerUncreatableType< T >( className );
|
registerUncreatableType< T >( className );
|
||||||
#else
|
#else
|
||||||
// the class name without the "Qsk" prefix
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
According to the QML naming rules uncreatables have to
|
According to the QML naming rules uncreatables have to
|
||||||
start with a lowercase letter ( since Qt6 ) , while namespaces
|
start with a lowercase letter ( since Qt6 ), while namespaces
|
||||||
and creatable items usually start with a upper letter.
|
and creatable items usually start with a upper letter.
|
||||||
This results in an odd naming scheme for the enums defined inside of gadgets.
|
This results in an odd naming scheme for the enums defined inside of gadgets.
|
||||||
|
|
||||||
|
@ -140,7 +138,11 @@ namespace
|
||||||
enums are removed from the first and everything else than the enums from
|
enums are removed from the first and everything else than the enums from
|
||||||
the second. TODO ...
|
the second. TODO ...
|
||||||
*/
|
*/
|
||||||
registerUncreatableMetaObject( T::staticMetaObject, className );
|
|
||||||
|
if ( T::staticMetaObject.enumeratorCount() > 0 )
|
||||||
|
{
|
||||||
|
registerUncreatableMetaObject( T::staticMetaObject, className );
|
||||||
|
}
|
||||||
|
|
||||||
QByteArray name = className;
|
QByteArray name = className;
|
||||||
name.data()[0] = std::tolower( name.data()[0] );
|
name.data()[0] = std::tolower( name.data()[0] );
|
||||||
|
|
Loading…
Reference in New Issue