The text file from resource in Qt 4.8 not open?
I have a file the contain the project style sheet and I added it to my Resource file.
I use this code to open the style sheet. but I think this code could not open the file:
QFile File(":/style.qss"); File.open(QFile::ReadOnly); QString StyleSheet = QLatin1String(File.readAll()); qApp->setStyleSheet(StyleSheet); I used qt4.8 . the images in this resource is loaded but this file could not open to apply style sheet to my project. How can I apply style sheet to my project? thank you.
Why dont you use a common class for Stylesheet for your entire application,
Name the class as stylesheetCommon.h
define the variables inside it
#define stylesheetButton "background-color:#000000 ;color: #FFFFFF;font-size: 40px;"
use the variable
thanks. it solved.
What was the issue @MhM93
can you share the solution.
using resource file?
your solution is nice but i find my problem in my code. after delete the extra code it works fine and the main code does not have any problem.
Your solution is also a second way to set stylesheet for at app.