setStylesheet = Qss file
Unsolved
General and Desktop
-
QFile file(":/theme/dark.qss"); file.open(QFile::ReadOnly); QString styleSheet = QLatin1String(file.readAll()); a.setStyleSheet(styleSheet);
gives me
QIODevice::read (QFile, ":\theme\dark.qss"): device not open
w0000t....
@Kris-Revi
QFile::open()
returns abool
so you can test whether it has succeeded or not. Clearly it has not here. -
@Kris-Revi
QFile::open()
returns abool
so you can test whether it has succeeded or not. Clearly it has not here.@JonB so i added this
QFile ssf(":/theme/dark.qss"); if( ssf.exists() ) { qDebug() << "Stylesheet does exists"; } if( ssf.open(QFile::ReadOnly) ) { qDebug() << "File is opened for read!"; } QString styleSheet = QLatin1String(ssf.readAll()); a.setStyleSheet(styleSheet);
but none of them prints :/
-
@JonB so i added this
QFile ssf(":/theme/dark.qss"); if( ssf.exists() ) { qDebug() << "Stylesheet does exists"; } if( ssf.open(QFile::ReadOnly) ) { qDebug() << "File is opened for read!"; } QString styleSheet = QLatin1String(ssf.readAll()); a.setStyleSheet(styleSheet);
but none of them prints :/
@Kris-Revi So that file doesn't exist. Show the .pro and .qrc
-
@Kris-Revi So that file doesn't exist. Show the .pro and .qrc