I simply want to use a style sheet.
I get this error when I want to Compile
C:\Erfan\C++\Exersize\QT\untitled01\main.cpp:19: error: 'class QCoreApplication' has no member named 'setStyleSheet'
QApplication::instance()->setStyleSheet(ts.readAll());
^
Here's my Code
#include "mainwindow.h"
#include <QApplication>
#include <QFile>
#include <Qtextstream>
int main(int argc, char *argv[])
{
QFile f
(":qdarkstyle/style.qss");
if (!f.exists())
{
printf("Unable to set stylesheet, file not found\n");
}
else
{
}
MainWindow w;
w.show();
return a.exec();
}
#include "mainwindow.h"
#include <QApplication>
#include <QFile>
#include <Qtextstream>
int main(int argc, char *argv[])
{
QFile f(":qdarkstyle/style.qss");
if (!f.exists())
{
printf("Unable to set stylesheet, file not found\n");
}
else
{
f.open(QFile::ReadOnly | QFile::Text);
QTextStream ts(&f);
QApplication::instance()->setStyleSheet(ts.readAll());
}
QApplication a(argc, argv);
MainWindow w;
w.show();
return a.exec();
}
To copy to clipboard, switch view to plain text mode
Bookmarks