How to execute my .css file in Qt?
Hi,
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.
Thanks in advance,
Harish.M
Re: How to execute my .css file in Qt?
Add your style sheet file to resource (.qrc), and then load it from there.
Re: How to execute my .css file in Qt?
Hi Oleg,
I added my style sheet file to .qrc and still now it is not executing.
What might be the error i had done help me to solve this..
Re: How to execute my .css file in Qt?
just adding is not enough. you can add whatever you want ;)
you have to set the style. read the content of your css file into a QString. then set this QString as Style to your application.
Re: How to execute my .css file in Qt?
Quick snippet:
Code:
qApp
->setStyleSheet
(QString(f.
readAll()));
f.close();
}
Re: How to execute my .css file in Qt?
Thank you everyone for your replies i will try it and let me see.
It works fine thank you everyone