我正在编写一个小测试程序(翻译程序),以便进入QtDesigner。
如您所见,两个组合框的宽度不同-我没有手动更改任何宽度值,我只更改了对齐和布局。除了文本之外,整个左半部分和右半部分是相同的,
除了
它似乎与存储在组合框中的项目也没有任何关系,遗憾的是,我无法手动更改项目的大小,因为它们似乎绑定在一个布局中。
有人能告诉我这是怎么回事吗?这不是一个大问题,但看起来很痛苦。
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>711</width>
<height>402</height>
</rect>
</property>
<property name="maximumSize">
<size>
<width>790</width>
<height>402</height>
</size>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralwidget">
<property name="minimumSize">
<size>
<width>663</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>795</width>
<height>414</height>
</size>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<layout class="QVBoxLayout" name="InputLayout">
<item alignment="Qt::AlignHCenter">
<widget class="QLabel" name="Label_Input">
<property name="text">
<string>Input:</string>
</property>
</widget>
</item>
<item>
<widget class="QTextEdit" name="Text_Input">
<property name="undoRedoEnabled">
<bool>false</bool>
</property>
<property name="html">
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;">
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p></body></html></string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="Combo_Input">
<property name="enabled">
<bool>true</bool>
</property>
<item>
<property name="text">
<string>Auto</string>
</property>
</item>
<item>
<property name="text">
<string>en</string>
</property>
</item>
<item>
<property name="text">
<string>de</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
<item row="0" column="1">
<layout class="QVBoxLayout" name="ButtonLayout">
<item>
<widget class="QPushButton" name="Button_Translate">
<property name="text">
<string>=></string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="Button_Swap">
<property name="text">
<string><-></string>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="2">
<layout class="QVBoxLayout" name="OutputLayout">
<item alignment="Qt::AlignHCenter">
<widget class="QLabel" name="Label_Output">
<property name="text">
<string>Translated result:</string>
</property>
</widget>
</item>
<item>
<widget class="QTextBrowser" name="Text_Output">
<property name="html">
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;">
<p align="center" style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p></body></html></string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="Combo_Output">
<item>
<property name="text">
<string>en</string>
</property>
</item>
<item>
<property name="text">
<string>de</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
<resources/>
<connections/>
</ui>
我在试图解决这个问题时遇到的另一个大问题是,在破坏布局并设置最小尺寸后,我无法再更改组合框的对齐方式-
即使在我按住ctrl+z键回到原来的位置之后!