900字范文,内容丰富有趣,生活中的好帮手!
900字范文 > QT设计师无法修改窗口大小 无法通过鼠标拖动窗口改变大小的解决方案

QT设计师无法修改窗口大小 无法通过鼠标拖动窗口改变大小的解决方案

时间:2020-09-02 12:50:30

相关推荐

QT设计师无法修改窗口大小 无法通过鼠标拖动窗口改变大小的解决方案

如题,我使用的是pyside6进行设计界面,通过添加布局实现了自动缩放的界面,但遇到了一个很诡异的现象,就是窗口无法缩小,在QT设计师界面,在geometry属性那里怎么修改,一点确定之后宽度和高度都是原来的值,无法修改窗口大小。然后生成界面运行之后也无法修改。

然后我将界面.ui文件用notepad++打开之后,大家有发现什么问题吗?

<property name="geometry"><rect><x>0</x><y>0</y><width>1024</width><height>1024</height></rect></property><property name="sizePolicy"><sizepolicy hsizetype="Preferred" vsizetype="Preferred"><horstretch>0</horstretch><verstretch>0</verstretch></sizepolicy></property><property name="maximumSize"><size><width>2000</width><height>3000</height></size></property>

是的,里面少了minimumSize属性,于是我又添加了这个属性如下:

<property name="geometry"><rect><x>0</x><y>0</y><width>1024</width><height>1024</height></rect></property><property name="sizePolicy"><sizepolicy hsizetype="Preferred" vsizetype="Preferred"><horstretch>0</horstretch><verstretch>0</verstretch></sizepolicy></property><property name="minimumSize"><size><width>0</width><height>0</height></size></property><property name="maximumSize"><size><width>2000</width><height>3000</height></size></property>

结果还是不行,这时我有将minimunSize属性设置了一个初始值为100,如下

<property name="geometry"><rect><x>0</x><y>0</y><width>1024</width><height>1024</height></rect></property><property name="sizePolicy"><sizepolicy hsizetype="Preferred" vsizetype="Preferred"><horstretch>0</horstretch><verstretch>0</verstretch></sizepolicy></property><property name="minimumSize"><size><width>100</width><height>100</height></size></property><property name="maximumSize"><size><width>2000</width><height>3000</height></size></property>

然后保存之后,奇迹发生了,不管是在QT设计师还是运行之后都可以缩小窗口了。

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。