Use Qt Style Sheets

 QFile styleSheet ( ": / default.qss"); overall grasp of the contents of the file is read out, the default is the type of QByteArray

 if (! styleSheet.open (QIODevice :: ReadOnly)) is then converted into Qstring read out the contents can be used

 {

 qWarning("Can't open the style sheet file.");

 }else{

  QByteArray ba = styleSheet.readAll();

QTextCodec* codec = QTextCodec::codecForName("UTF-8");

  QString str = codec->toUnicode(ba);/ QString str = QString::fromLatin1(ba);

       this->setStyleSheet(str);

       styleSheet.close();

   }

Published 104 original articles · won praise 22 · views 40000 +

Guess you like

Origin blog.csdn.net/qq_41672557/article/details/103076718