我是新来的Qt,所以我启动了一个项目使用的库练习。我有两个控件窗口:有固定大小的小部件的布局里面的Qt窗口
- 列表窗口小部件(顶部)
- 图形视图(底部)
它们在centralWidget
布局进行分组。
<?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>660</width>
<height>412</height>
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralWidget">
<property name="enabled">
<bool>true</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QListWidget" name="listWidget"/>
</item>
<item>
<widget class="QGraphicsView" name="graphicsView">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>100</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>100</height>
</size>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QMenuBar" name="menuBar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>660</width>
<height>21</height>
</rect>
</property>
</widget>
<widget class="QToolBar" name="mainToolBar">
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
</widget>
<widget class="QStatusBar" name="statusBar"/>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>
<connections/>
</ui>
控件随着窗口增长,但它们没有根据需要调整大小。所以我已经阅读了Qt站点的文档,没有任何说明。以下是窗口如何调整大小的视频。
https://www.youtube.com/watch?v=rDSxcKFILOE
请留意它能够清楚地了解是什么问题。
应该如何的事情发生?
当我水平调整窗口大小,一切都已经工作正常,这两个控件成长与窗口/收缩。当我垂直调整窗口大小时,唯一应调整大小的控件是顶部的控件(ListView)。图形视图必须大小width: as the listview, height: 100
修好了,不好意思 – Victor