qvgfile parameter adeed

This commit is contained in:
Uwe Rathmann 2025-02-19 08:28:15 +01:00
parent b1ae08b91c
commit 75522ced4a
3 changed files with 11 additions and 3 deletions

View File

@ -31,8 +31,8 @@ class GraphicLabel : public QskGraphicLabel
Inverted
};
GraphicLabel( const QskGraphic& graphic, QQuickItem* parent = nullptr )
: QskGraphicLabel( graphic, parent )
GraphicLabel( QQuickItem* parent = nullptr )
: QskGraphicLabel( parent )
{
setMargins( 10 );
setPanel( true );
@ -74,7 +74,7 @@ class GraphicLabel : public QskGraphicLabel
MainWindow::MainWindow()
{
auto label = new GraphicLabel( QskGraphicIO::read( QString( ":/qvg/Tux.qvg" ) ) );
auto label = new GraphicLabel();
auto invertButton = new QskPushButton( "Inverted" );
invertButton->setSizePolicy( Qt::Horizontal, QskSizePolicy::Fixed );
@ -98,6 +98,12 @@ MainWindow::MainWindow()
setGraphicRoles( qskSkinManager->skin() );
}
void MainWindow::setGraphic( const QString& path )
{
if ( auto label = findChild< QskGraphicLabel* >() )
label->setGraphic( QskGraphicIO::read( path ) );
}
void MainWindow::setGraphicRoles( QskSkin* skin )
{
// substituting black

View File

@ -15,6 +15,7 @@ class MainWindow : public QskWindow
public:
MainWindow();
void setGraphic( const QString& );
private Q_SLOTS:
void setGraphicRoles( QskSkin* );

View File

@ -27,6 +27,7 @@ int main( int argc, char* argv[] )
focusIndicator->setObjectName( "FocusIndicator" );
MainWindow window;
window.setGraphic( ( argc > 1 ) ? argv[1] : ":/qvg/Tux.qvg" );
window.resize( 600, 400 );
window.addItem( focusIndicator );
window.show();