Lv.的博客

Qt加载本地字体 .ttc或.ttf

版权声明:支持原创,转载请说明~ 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);
posted @ 2018-10-26 14:50  Avatarx  阅读(3641)  评论(0编辑  收藏  举报