久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

更改顯示的 DPI 縮放大小會使 Qt 應用程序的字體

Changing DPI scaling size of display make Qt application#39;s font size get rendered bigger(更改顯示的 DPI 縮放大小會使 Qt 應用程序的字體大小變得更大)
本文介紹了更改顯示的 DPI 縮放大小會使 Qt 應用程序的字體大小變得更大的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我使用 Qt 創建了一些 GUI 應用程序.我的 GUI 應用程序包含按鈕和單選按鈕等控件.當我運行應用程序時,按鈕內的按鈕和字體看起來很正常.當我將顯示的 DPI 縮放大小從 100% 更改為 150% 或 200% 時,無論分辨率如何,控件的字體大小都會變大,但控件大小(按鈕、單選按鈕)不會.由于這個原因,控件中的文本被截斷了.請看附圖.

I have created some GUI application using Qt. My GUI application contains controls like push button and radio button. When I run the application, buttons and fonts inside button looks normal. When I change the DPI scaling size of display from 100% to 150% or 200%, font size of controls rendered bigger but not control size (pushbutton, radio button) irrespective of resolution. Due to this the text inside controls were cut off. please see the attached image.

Qt 應用程序在 DPI 縮放大小設置為 100% 時的外觀

Qt application look when DPI scaling size set to 100%

Qt 應用程序在 DPI 縮放大小設置為 200% 時的外觀

Qt application look when DPI scaling size set to 200%

我也在一些平板電腦上運行我的應用程序.在平板電腦中,DPI 比例值應大于 150%,否則所有內容都會顯示得很小.

I am running my application in some tablets also. In tablets, DPI scale value should be more than 150% else everything will be shown very small.

我在網上搜索在 Qt 中創建 UI 應用程序,而不管分辨率和 DPI 比例值,但沒有運氣.所以我在這里發布我的任務.請告訴我是否有辦法擺脫這種情況.

I searched in the web for creating UI application in Qt irrespective of resolution and DPI scale value but no luck. So I am posting my questing here. Please let me know if there is some way to get rid of this.

推薦答案

從 Qt 5.6 開始啟用高 DPI 支持.

High DPI support is enabled from Qt 5.6 onward.

在應用程序源代碼中設置 QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling) 允許自動高 DPI 縮放.

Setting QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling) in your application source code allows automatic high-DPI scaling.

注意:要使用屬性方法,您必須在創建QApplication 對象之前設置屬性:

NOTICE: To use the attribute method, you must set the attribute before you create your QApplication object:

#include <QApplication>

int main(int argc, char *argv[])
{
    QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);

    QApplication app(argc, argv);   
    return app.exec();
}

這篇關于更改顯示的 DPI 縮放大小會使 Qt 應用程序的字體大小變得更大的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

How can I read and manipulate CSV file data in C++?(如何在 C++ 中讀取和操作 CSV 文件數據?)
In C++ why can#39;t I write a for() loop like this: for( int i = 1, double i2 = 0; (在 C++ 中,為什么我不能像這樣編寫 for() 循環: for( int i = 1, double i2 = 0;)
How does OpenMP handle nested loops?(OpenMP 如何處理嵌套循環?)
Reusing thread in loop c++(在循環 C++ 中重用線程)
Precise thread sleep needed. Max 1ms error(需要精確的線程睡眠.最大 1ms 誤差)
Is there ever a need for a quot;do {...} while ( )quot; loop?(是否需要“do {...} while ()?環形?)
主站蜘蛛池模板: 欧美aⅴ| 亚洲精品一区二区在线观看 | 国产福利免费视频 | 国产资源在线视频 | 精品国产成人 | a级在线| 亚洲成人在线免费 | 中文字幕一区二区三区日韩精品 | 97中文视频| 超碰在线人人 | 欧美高清视频 | 国产美女视频黄 | 男人的天堂视频网站 | 亚洲区一区二区 | 久久99精品视频 | 精品欧美一区二区精品久久 | 国产精品久久久久久久免费大片 | 在线视频一区二区三区 | aaaaaaa片毛片免费观看 | 伊人久久综合 | 久久久国产精品 | 天天拍天天操 | 午夜电影网| 91高清视频在线 | 卡通动漫第一页 | 亚洲人成一区二区三区性色 | 亚洲精品aⅴ | 国产高清一区二区三区 | 亚州毛片 | 中文字幕av网址 | 久久精品亚洲国产奇米99 | 午夜视频免费在线观看 | 黄色片在线观看网址 | 日韩欧美国产精品一区 | 在线高清免费观看视频 | avav在线看 | 一区二区三区日韩 | 可以免费看的毛片 | 亚洲视频在线一区 | 一区二区三区网站 | 日本一区二区三区免费观看 |