版权声明:支持原创,转载请说明~ https://blog.csdn.net/luoyayun361/article/details/54934437

    //设置本地字体,黑体简
    
  1. int fontId = QFontDatabase::addApplicationFont(QCoreApplication::applicationDirPath() + "/黑体简.TTC");
  2. qDebug() << "fontId = "<< fontId;
  3. QString msyh = QFontDatabase::applicationFontFamilies(fontId).at(0);
  4. qDebug() <<"msyh = " <<msyh;
  5. QFont font(msyh);
  6. QApplication::setFont(font);
05-11 18:11