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

View File

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

View File

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