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

更改顯示的 DPI 縮放大小會使 Qt 應(yīng)用程序的字體

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

問題描述

我使用 Qt 創(chuàng)建了一些 GUI 應(yīng)用程序.我的 GUI 應(yīng)用程序包含按鈕和單選按鈕等控件.當(dāng)我運行應(yīng)用程序時,按鈕內(nèi)的按鈕和字體看起來很正常.當(dāng)我將顯示的 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 應(yīng)用程序在 DPI 縮放大小設(shè)置為 100% 時的外觀

Qt application look when DPI scaling size set to 100%

Qt 應(yīng)用程序在 DPI 縮放大小設(shè)置為 200% 時的外觀

Qt application look when DPI scaling size set to 200%

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

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.

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

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.

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

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

注意:要使用屬性方法,您必須在創(chuàng)建QApplication 對象之前設(shè)置屬性:

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();
}

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

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

相關(guān)文檔推薦

How can I read and manipulate CSV file data in C++?(如何在 C++ 中讀取和操作 CSV 文件數(shù)據(jù)?)
In C++ why can#39;t I write a for() loop like this: for( int i = 1, double i2 = 0; (在 C++ 中,為什么我不能像這樣編寫 for() 循環(huán): for( int i = 1, double i2 = 0;)
How does OpenMP handle nested loops?(OpenMP 如何處理嵌套循環(huán)?)
Reusing thread in loop c++(在循環(huán) C++ 中重用線程)
Precise thread sleep needed. Max 1ms error(需要精確的線程睡眠.最大 1ms 誤差)
Is there ever a need for a quot;do {...} while ( )quot; loop?(是否需要“do {...} while ()?環(huán)形?)
主站蜘蛛池模板: 美女在线观看av | 中文二区 | 欧美日韩国产中文 | 狠狠狠 | 成人国产在线视频 | 精品视频久久久久久 | 久久精品亚洲精品国产欧美kt∨ | 国产日韩欧美电影 | 亚洲成人自拍 | 欧美激情精品久久久久久变态 | 日本亚洲一区二区 | 欧美一区二区三区视频在线观看 | 一区天堂 | 国产成人免费 | 亚洲成人午夜电影 | 91av视频在线播放 | 亚洲高清在线 | 日日av| 精品国产一区二区三区性色av | 夫妻午夜影院 | 成人 在线 | 国产二区精品视频 | 男女羞羞视频网站 | 日韩在线中文字幕 | 蜜臀网 | 在线观看成人 | 精精国产xxxx视频在线野外 | 欧美一区2区三区3区公司 | 国产在线精品一区二区 | 亚洲人人舔人人 | 精品久久久久久亚洲综合网站 | 桃花av在线| 日本成人中文字幕在线观看 | 欧美成人一区二免费视频软件 | 久久精品亚洲国产奇米99 | 亚洲成人毛片 | 久久久久久久久99精品 | 午夜在线小视频 | 欧美性生活网 | 国产精品一二三区 | www.v888av.com |