1

I am having a .css file (with some button images and background image) instead of using style sheet and had added it to my project.

I don't know how to link the .css file with my button image and background.

If anyone knows how to add it please get me some sample or examples for it.

1 Answer 1

1

You can just read the file in your application and apply it to the whole application (or anything else):

void main( int argc, char* argv[] )
{
    QApplication app( argc, argv );

    QFile styleSheetFile( ":/stylesheet.css" );  // assuming stylesheet is part of the resources
    styleSheetFile.open( QFile::ReadOnly );
    QString styleSheet = styleSheetFile.readAll();

    app->setStyleSheet( styleSheet );
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.