QT 使用高清晰

說到這個問題,我們要用到QT_REQUIRE_VERSION這個宏,Qt文檔中這麼描述:


這裏是要設置當前開發的Qt版本相匹配。

比如我用的是Qt5.6.0,所以在main.cpp上要這樣寫:

#include "mainwindow.h"
#include <QApplication>
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    QT_REQUIRE_VERSION(argc, argv, "5.6.0");
    QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);//解決Qt在Retina屏幕上圖片模糊問題
    MainWindow w;
    w.show();
    return a.exec();
}


核心代碼:
    QT_REQUIRE_VERSION(argc, argv, "5.6.0");
    QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);//解決Qt在Retina屏幕上圖片模糊問題


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章