Answer the question
In order to leave comments, you need to log in
How to work with Qt *.qrc file in CMake project?
Unable to get resource file in code.
wrote in CMake
set(SOURCES
main.cpp
mainwindow.cpp
mainwindow.ui
)
qt_add_resources(RSS_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/resources.qrc)
add_executable(${PROJECT} ${SOURCES} ${RSS_SOURCES})
<RCC>
<qresource prefix="/">
<file>resources/css/style.css</file>
</qresource>
</RCC>
QFile styleFile(":/resources/css/syle.css");
if (styleFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
auto f = styleFile.readAll();
qDebug() << f;
qApp->setStyleSheet(f);
styleFile.close();
} else {
qDebug() << styleFile.errorString();
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question