Solved How to add .qrc and .qss files into CMake
-
Hi All,
I have icon.qrc and Stylesheet.qss files both should come under CMake i have placed it like:
set(EXPLORER_RESOURCE
iconfile.qrc
flex_ui_stylesheet.qss
)and in the main.cpp i am reading that flex_ui_stylesheet.qss file like :
QFile styleFile(":/flex_ui_stylesheet.qss");
if (styleFile.open(QIODevice::ReadOnly))
{
QTextStream textStream(&styleFile);
QString styleSheet = textStream.readAll();
styleFile.close();
App.setStyleSheet(styleSheet);
}
w.show();but i am unble to read and get expected output , can someone suggest me where i am going wrong .
Thanks in advance
-
Hi,
Please take a look at the CMake Manual in Qt's documentation. It shows the macros available to handle .qrc files.
The
flex_ui_stylesheet.qss
has nothing to do with cmake. It should be in the resource file itself.