QT 应用QSS时,没有生效??
[code=C/C++][/code]
#ifndef SHEET_H#define SHEET_H#include <QDialog>class QPushButton;class Sheet : public QDialog{ Q_OBJECTpublic: Sheet(QWidget *parent = 0);private: QPushButton *pushButton ;};#endif // SHEET_H
#include <QApplication>#include <QTextCodec>#include <QPushButton>#include <QFile>#include <QString>#include "sheet.h"Sheet::Sheet(QWidget *parent){ pushButton = new QPushButton("sheet",this);}int main(int argc,char **argv){ QApplication app(argc,argv); QTextCodec::setCodecForTr(QTextCodec::codecForName("GB2312")); Sheet *sheet = new Sheet; QFile qss("C://style.qss"); //这个是绝对路径,,,用的是XP 系统,,编译能通过,就是没有效果,, qss.open(QFile::ReadOnly); qApp->setStyleSheet(qss.readAll()); qss.close(); sheet->setVisible(true); return app.exec();}