PyQt——高清屏幕自适应设置

2023-05-16

Qt Designer 设计界面:
在这里插入图片描述
在高清屏未设置AA_EnableHighDpiScaling的预览界面:布局字体控件尺寸上明显存在偏差.
在这里插入图片描述
设置了AA_EnableHighDpiScaling的预览界面:运行后,与designer界面一致
在这里插入图片描述

from PyQt5.QtWidgets import QApplication, QMainWindow, QMessageBox
from PyQt5.QtCore import Qt
from Ui_mainqt import Ui_MainWindow
 
class MainWindow(QMainWindow, Ui_MainWindow):
    def __init__(self):
        super(MainWindow, self).__init__()
        self.setupUi(self)
        self.iniConn()
 
if __name__ == '__main__':
    import sys
    QApplication.setAttribute(Qt.AA_EnableHighDpiScaling) 
    app = QApplication(sys.argv)
    formmain = MainWindow()
    formmain.show()
    sys.exit(app.exec_())
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

PyQt——高清屏幕自适应设置 的相关文章

随机推荐

  • PyQt——QSpinBox(计数器)

    span class token keyword import span sys span class token keyword from span PyQt5 span class token punctuation span QtCo
  • PyQt——QSlider(滑动条)

    span class token keyword import span sys span class token keyword from span PyQt5 span class token punctuation span QtCo
  • PyQt——QTableView

    span class token keyword from span PyQt5 span class token punctuation span QtWidgets span class token keyword import spa
  • 正则表达式——验证数字

    验证数字 xff1a span class token operator span span class token punctuation span span class token number 0 span span class to
  • PyQt——QTableWidget

    span class token keyword import span sys span class token keyword from span PyQt5 span class token punctuation span QtWi
  • PyQt——QListView

    span class token comment coding utf 8 span span class token triple quoted string string 39 39 39 简介 PyQt5中 QListView 例子
  • PyQt——QListWidget

    span class token comment coding utf 8 span span class token triple quoted string string 39 39 39 简介 PyQt5中 QListWidget 例
  • PyQt——QTabWidget

    span class token comment coding utf 8 span span class token triple quoted string string 39 39 39 简介 PyQt5中 QTabWidget 例子
  • PyQt——QStackedWidget

    span class token comment coding utf 8 span span class token triple quoted string string 39 39 39 简介 PyQt5中 QStackedWidge
  • PyQt——QDockWidget

    span class token comment coding utf 8 span span class token triple quoted string string 39 39 39 简介 PyQt5中 QDockWidget 例
  • lingo入门教程之二 --- 集合运用

    lingo中的集合用法很多 xff0c 这里主要通过几个例题来进行讲解 对于每一个问题 xff0c 都要先找到对应的目标函数 xff0c 然后对相应值进行初始化 xff0c 然后找到约束条件等进行求解 例1 xff1a SAILCO公司需要
  • PyQt——MDI(多文档界面)

    span class token comment coding utf 8 span span class token triple quoted string string 39 39 39 简介 PyQt5中 QMdiArea 例子 3
  • PyQt——QScrollBar

    span class token comment coding utf 8 span span class token triple quoted string string 39 39 39 简介 PyQt5中 QScrollBar 例子
  • PyQt——QTimer

    span class token comment coding utf 8 span span class token triple quoted string string 39 39 39 简介 PyQT5中 QTimer例子 39 3
  • PyQt——QThread

    span class token comment coding utf 8 span span class token triple quoted string string 39 39 39 简介 PyQT5中 QThread 例子 39
  • PyQt——事件处理

    PyQt事件处理 前言1 低级的事件处理程序2 事件处理机制1 事件机制与信号槽机制的区别2 事件处理的方法3 事件处理实例 前言 1 低级的事件处理程序 span class token comment coding utf 8 span
  • python——精华技巧

    1 大量的if else结构采用字典key来匹配 days span class token operator 61 span span class token string 34 Mon Tue Wed Thu Fri Sat Sun 3
  • Python使用struct处理二进制(pack和unpack用法)

    python有时需要处理二进制数据 xff0c 例如 存取文件 xff0c socket操作时 这时候 xff0c 可以使用python的struct模块来完成 可以用struct来处理c语言中的结构体 一 struct模块中最重要的三个函
  • PyQt——QGroupBox

    QGroupBox为构建分组框提供了支持 分组框通常带有一个边框和一个标题栏 xff0c 作为容器部件来使用 xff0c 在其中可以布置各种窗口部件 布局时可用作一组控件的容器 xff0c 但是需要注意的是 xff0c 内部必须使用布局控件
  • PyQt——高清屏幕自适应设置

    Qt Designer 设计界面 xff1a 在高清屏未设置AA EnableHighDpiScaling的预览界面 xff1a 布局字体控件尺寸上明显存在偏差 设置了AA EnableHighDpiScaling的预览界面 xff1a 运