how to apply stylesheet defined in .qss file to qt application
Hi,
Can anyone pls tell me how to apply external stylesheet defined in a .qss file to a qt application? I'm using qt4.3
I dont want to use command line switch "-stylesheet".
Thanks in advance,
Namita
Re: how to apply stylesheet defined in .qss file to qt application
Code:
QFile qss
("stylesheet.qss");
qss.
open(QFile::ReadOnly);
app.setStyleSheet(qss.readAll());
qss.close();
Re: how to apply stylesheet defined in .qss file to qt application
Hi,
Thanks a lot...
Now i'm able to apply external stylesheet to the qt application.
Regards,
Namita
Re: how to apply stylesheet defined in .qss file to qt application
Quote:
Originally Posted by
namita
Hi,
Thanks a lot...
Now i'm able to apply external stylesheet to the qt application.
Regards,
Namita
Hi. Im also using qss file. Are u adding Q_INIT_RESOURCES in ur main(), inorder to initialise qss?
Thanx.
Re: how to apply stylesheet defined in .qss file to qt application
QSS and Q_INIT_RESOURCES have nothing to do with each other.
Re: how to apply stylesheet defined in .qss file to qt application
Quote:
Originally Posted by
wysota
QSS and Q_INIT_RESOURCES have nothing to do with each other.
As far my understand I think qss(qt Style sheet) is also a resources and Q_INIT_RESOURCES is required to initialise all resources. So i asked this. I also posted this inforum http://www.qtcentre.org/forum/f-qt-p...rce-12508.html But i didnt get any reply. So i asked this.:(
Re: how to apply stylesheet defined in .qss file to qt application
Quote:
Originally Posted by
phillip_Qt
As far my understand I think qss(qt Style sheet) is also a resources
That's not true.
Quote:
and Q_INIT_RESOURCES is required to initialise all resources.
That's not true as well.
"Qt resources" is a virtual filesystem, nothing more, nothing less. Stylesheets have nothing to do with files and in this particular case the stylesheet is loaded from an external and real file.
Q_INIT_RESOURCES is only needed if you want to initialize resources that are embedded int a static library on some of the platforms. It' required to link them to the filesystem already existing in the application.
Re: how to apply stylesheet defined in .qss file to qt application
Quote:
Originally Posted by
wysota
That's not true.
That's not true as well.
"Qt resources" is a virtual filesystem, nothing more, nothing less. Stylesheets have nothing to do with files and in this particular case the stylesheet is loaded from an external and real file.
Q_INIT_RESOURCES is only needed if you want to initialize resources that are embedded int a static library on some of the platforms. It' required to link them to the filesystem already existing in the application.
Thank you very much
But i ve a doubt, can i use Q_INIT_RESOURCE macro in a dll.?
Re: how to apply stylesheet defined in .qss file to qt application
Do you need the macro? Yes, you can use it, but you probably don't have to.