2

我创建了一个 python 测试程序 (Test_InfoPanel.py),它有 MainWindow 和 dockWidget,在其中还有一个 tabWidget 和 scrollArea 小部件。但是,当我调整 MainWindow 的大小时,垂直滚动条不会自动出现

同样,当我取消停靠 dockWidget 并调整大小时,垂直滚动条不会自动出现。

请帮忙!

测试程序(Test_InfoPanel.py):

#!/usr/bin/env python

# Filename: Test_InfoPanel.py
# Date: 2012-Sep-18
'''
This program test the scrollarea to show scrollbars for the InfoPanel_UI.
'''

import sys
from PyQt4 import QtCore, QtGui

if __name__ == "__main__":
    import sys
    app = QtGui.QApplication(sys.argv)
    # Look and feel changed to 'Cleanlooks'.
    app.setStyle('Cleanlooks')

    from InfoPanel_UI import Ui_MainWindow_InfoPanel

    AppWindow = QtGui.QMainWindow()
    ui = Ui_MainWindow_InfoPanel()
    ui.setupUi(AppWindow)

    ui.tabWidget_Info_Panel.setCurrentWidget(ui.scrollArea_Info_Panel)

    AppWindow.show()
    sys.exit(app.exec_())

生成的 *.ui 脚本 (InfoPanel_UI.py):

# -*- coding: utf-8 -*-

# Form implementation generated from reading ui file 'InfoPanel.ui'
#
# Created: Wed Sep 19 13:11:06 2012
#      by: PyQt4 UI code generator 4.9.4
#
# WARNING! All changes made in this file will be lost!

from PyQt4 import QtCore, QtGui

try:
    _fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
    _fromUtf8 = lambda s: s

class Ui_MainWindow_InfoPanel(object):
    def setupUi(self, MainWindow_InfoPanel):
        MainWindow_InfoPanel.setObjectName(_fromUtf8("MainWindow_InfoPanel"))
        MainWindow_InfoPanel.resize(602, 263)
        MainWindow_InfoPanel.setDocumentMode(False)
        self.centralwidget = QtGui.QWidget(MainWindow_InfoPanel)
        self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
        MainWindow_InfoPanel.setCentralWidget(self.centralwidget)
        self.statusbar = QtGui.QStatusBar(MainWindow_InfoPanel)
        self.statusbar.setObjectName(_fromUtf8("statusbar"))
        MainWindow_InfoPanel.setStatusBar(self.statusbar)
        self.dockWidget_Info_Panel = QtGui.QDockWidget(MainWindow_InfoPanel)
        self.dockWidget_Info_Panel.setMinimumSize(QtCore.QSize(300, 140))
        font = QtGui.QFont()
        font.setBold(True)
        font.setItalic(True)
        font.setWeight(75)
        self.dockWidget_Info_Panel.setFont(font)
        self.dockWidget_Info_Panel.setLayoutDirection(QtCore.Qt.LeftToRight)
        self.dockWidget_Info_Panel.setAllowedAreas(QtCore.Qt.LeftDockWidgetArea|QtCore.Qt.RightDockWidgetArea)
        self.dockWidget_Info_Panel.setObjectName(_fromUtf8("dockWidget_Info_Panel"))
        self.dockWidgetContents_Info_Panel = QtGui.QWidget()
        self.dockWidgetContents_Info_Panel.setObjectName(_fromUtf8("dockWidgetContents_Info_Panel"))
        self.tabWidget_Info_Panel = QtGui.QTabWidget(self.dockWidgetContents_Info_Panel)
        self.tabWidget_Info_Panel.setGeometry(QtCore.QRect(0, 0, 300, 215))
        font = QtGui.QFont()
        font.setBold(False)
        font.setItalic(False)
        font.setWeight(50)
        self.tabWidget_Info_Panel.setFont(font)
        self.tabWidget_Info_Panel.setObjectName(_fromUtf8("tabWidget_Info_Panel"))
        self.tab_1 = QtGui.QWidget()
        self.tab_1.setObjectName(_fromUtf8("tab_1"))
        self.scrollArea_Info_Panel = QtGui.QScrollArea(self.tab_1)
        self.scrollArea_Info_Panel.setGeometry(QtCore.QRect(9, 9, 271, 171))
        self.scrollArea_Info_Panel.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded)
        self.scrollArea_Info_Panel.setWidgetResizable(True)
        self.scrollArea_Info_Panel.setObjectName(_fromUtf8("scrollArea_Info_Panel"))
        self.scrollAreaWidgetContents = QtGui.QWidget()
        self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 269, 169))
        self.scrollAreaWidgetContents.setObjectName(_fromUtf8("scrollAreaWidgetContents"))
        self.frame_Info_Panel = QtGui.QFrame(self.scrollAreaWidgetContents)
        self.frame_Info_Panel.setGeometry(QtCore.QRect(0, 0, 261, 161))
        self.frame_Info_Panel.setObjectName(_fromUtf8("frame_Info_Panel"))
        self.label_Eqpt_Model = QtGui.QLabel(self.frame_Info_Panel)
        self.label_Eqpt_Model.setGeometry(QtCore.QRect(10, 10, 111, 27))
        self.label_Eqpt_Model.setObjectName(_fromUtf8("label_Eqpt_Model"))
        self.lineEdit_Eqpt_Model = QtGui.QLineEdit(self.frame_Info_Panel)
        self.lineEdit_Eqpt_Model.setEnabled(False)
        self.lineEdit_Eqpt_Model.setGeometry(QtCore.QRect(120, 10, 111, 27))
        palette = QtGui.QPalette()
        brush = QtGui.QBrush(QtGui.QColor(60, 60, 60))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Text, brush)
        brush = QtGui.QBrush(QtGui.QColor(60, 60, 60))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Text, brush)
        brush = QtGui.QBrush(QtGui.QColor(0, 0, 127))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Text, brush)
        self.lineEdit_Eqpt_Model.setPalette(palette)
        self.lineEdit_Eqpt_Model.setObjectName(_fromUtf8("lineEdit_Eqpt_Model"))
        self.label_State = QtGui.QLabel(self.frame_Info_Panel)
        self.label_State.setGeometry(QtCore.QRect(10, 40, 111, 27))
        self.label_State.setObjectName(_fromUtf8("label_State"))
        self.lineEdit_State = QtGui.QLineEdit(self.frame_Info_Panel)
        self.lineEdit_State.setEnabled(False)
        self.lineEdit_State.setGeometry(QtCore.QRect(120, 40, 111, 27))
        palette = QtGui.QPalette()
        brush = QtGui.QBrush(QtGui.QColor(60, 60, 60))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Text, brush)
        brush = QtGui.QBrush(QtGui.QColor(60, 60, 60))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Text, brush)
        brush = QtGui.QBrush(QtGui.QColor(0, 0, 127))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Text, brush)
        self.lineEdit_State.setPalette(palette)
        self.lineEdit_State.setObjectName(_fromUtf8("lineEdit_State"))
        self.groupBox_Current_Position = QtGui.QGroupBox(self.frame_Info_Panel)
        self.groupBox_Current_Position.setGeometry(QtCore.QRect(10, 70, 241, 91))
        palette = QtGui.QPalette()
        brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.WindowText, brush)
        brush = QtGui.QBrush(QtGui.QColor(85, 255, 0))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Button, brush)
        brush = QtGui.QBrush(QtGui.QColor(170, 255, 127))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Light, brush)
        brush = QtGui.QBrush(QtGui.QColor(127, 255, 63))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Midlight, brush)
        brush = QtGui.QBrush(QtGui.QColor(42, 127, 0))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Dark, brush)
        brush = QtGui.QBrush(QtGui.QColor(56, 170, 0))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Mid, brush)
        brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Text, brush)
        brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.BrightText, brush)
        brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ButtonText, brush)
        brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Base, brush)
        brush = QtGui.QBrush(QtGui.QColor(85, 255, 0))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Window, brush)
        brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Shadow, brush)
        brush = QtGui.QBrush(QtGui.QColor(170, 255, 127))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.AlternateBase, brush)
        brush = QtGui.QBrush(QtGui.QColor(255, 255, 220))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ToolTipBase, brush)
        brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ToolTipText, brush)
        brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.WindowText, brush)
        brush = QtGui.QBrush(QtGui.QColor(85, 255, 0))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Button, brush)
        brush = QtGui.QBrush(QtGui.QColor(170, 255, 127))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Light, brush)
        brush = QtGui.QBrush(QtGui.QColor(127, 255, 63))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Midlight, brush)
        brush = QtGui.QBrush(QtGui.QColor(42, 127, 0))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Dark, brush)
        brush = QtGui.QBrush(QtGui.QColor(56, 170, 0))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Mid, brush)
        brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Text, brush)
        brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.BrightText, brush)
        brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ButtonText, brush)
        brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Base, brush)
        brush = QtGui.QBrush(QtGui.QColor(85, 255, 0))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Window, brush)
        brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Shadow, brush)
        brush = QtGui.QBrush(QtGui.QColor(170, 255, 127))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.AlternateBase, brush)
        brush = QtGui.QBrush(QtGui.QColor(255, 255, 220))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ToolTipBase, brush)
        brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ToolTipText, brush)
        brush = QtGui.QBrush(QtGui.QColor(42, 127, 0))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.WindowText, brush)
        brush = QtGui.QBrush(QtGui.QColor(85, 255, 0))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Button, brush)
        brush = QtGui.QBrush(QtGui.QColor(170, 255, 127))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Light, brush)
        brush = QtGui.QBrush(QtGui.QColor(127, 255, 63))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Midlight, brush)
        brush = QtGui.QBrush(QtGui.QColor(42, 127, 0))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Dark, brush)
        brush = QtGui.QBrush(QtGui.QColor(56, 170, 0))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Mid, brush)
        brush = QtGui.QBrush(QtGui.QColor(42, 127, 0))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Text, brush)
        brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.BrightText, brush)
        brush = QtGui.QBrush(QtGui.QColor(42, 127, 0))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ButtonText, brush)
        brush = QtGui.QBrush(QtGui.QColor(85, 255, 0))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Base, brush)
        brush = QtGui.QBrush(QtGui.QColor(85, 255, 0))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Window, brush)
        brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Shadow, brush)
        brush = QtGui.QBrush(QtGui.QColor(85, 255, 0))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.AlternateBase, brush)
        brush = QtGui.QBrush(QtGui.QColor(255, 255, 220))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ToolTipBase, brush)
        brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ToolTipText, brush)
        self.groupBox_Current_Position.setPalette(palette)
        self.groupBox_Current_Position.setObjectName(_fromUtf8("groupBox_Current_Position"))
        self.label_Current_Position_X = QtGui.QLabel(self.groupBox_Current_Position)
        self.label_Current_Position_X.setGeometry(QtCore.QRect(20, 20, 41, 27))
        self.label_Current_Position_X.setObjectName(_fromUtf8("label_Current_Position_X"))
        self.lineEdit_Current_Position_X = QtGui.QLineEdit(self.groupBox_Current_Position)
        self.lineEdit_Current_Position_X.setEnabled(False)
        self.lineEdit_Current_Position_X.setGeometry(QtCore.QRect(60, 20, 161, 27))
        palette = QtGui.QPalette()
        brush = QtGui.QBrush(QtGui.QColor(60, 60, 60))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Text, brush)
        brush = QtGui.QBrush(QtGui.QColor(60, 60, 60))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Text, brush)
        brush = QtGui.QBrush(QtGui.QColor(0, 0, 127))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Text, brush)
        self.lineEdit_Current_Position_X.setPalette(palette)
        self.lineEdit_Current_Position_X.setObjectName(_fromUtf8("lineEdit_Current_Position_X"))
        self.label_Current_Position_Y = QtGui.QLabel(self.groupBox_Current_Position)
        self.label_Current_Position_Y.setGeometry(QtCore.QRect(20, 50, 41, 27))
        self.label_Current_Position_Y.setObjectName(_fromUtf8("label_Current_Position_Y"))
        self.lineEdit_Current_Position_Y = QtGui.QLineEdit(self.groupBox_Current_Position)
        self.lineEdit_Current_Position_Y.setEnabled(False)
        self.lineEdit_Current_Position_Y.setGeometry(QtCore.QRect(60, 50, 161, 27))
        palette = QtGui.QPalette()
        brush = QtGui.QBrush(QtGui.QColor(60, 60, 60))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Text, brush)
        brush = QtGui.QBrush(QtGui.QColor(60, 60, 60))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Text, brush)
        brush = QtGui.QBrush(QtGui.QColor(0, 0, 127))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Text, brush)
        self.lineEdit_Current_Position_Y.setPalette(palette)
        self.lineEdit_Current_Position_Y.setObjectName(_fromUtf8("lineEdit_Current_Position_Y"))
        self.scrollArea_Info_Panel.setWidget(self.scrollAreaWidgetContents)
        self.tabWidget_Info_Panel.addTab(self.tab_1, _fromUtf8(""))
        self.tab_2 = QtGui.QWidget()
        self.tab_2.setObjectName(_fromUtf8("tab_2"))
        self.tabWidget_Info_Panel.addTab(self.tab_2, _fromUtf8(""))
        self.dockWidget_Info_Panel.setWidget(self.dockWidgetContents_Info_Panel)
        MainWindow_InfoPanel.addDockWidget(QtCore.Qt.DockWidgetArea(2), self.dockWidget_Info_Panel)

        self.retranslateUi(MainWindow_InfoPanel)
        self.tabWidget_Info_Panel.setCurrentIndex(0)
        QtCore.QMetaObject.connectSlotsByName(MainWindow_InfoPanel)

    def retranslateUi(self, MainWindow_InfoPanel):
        MainWindow_InfoPanel.setWindowTitle(QtGui.QApplication.translate("MainWindow_InfoPanel", "MainWindow Info Panel", None, QtGui.QApplication.UnicodeUTF8))
        self.dockWidget_Info_Panel.setWindowTitle(QtGui.QApplication.translate("MainWindow_InfoPanel", "Info Panel", None, QtGui.QApplication.UnicodeUTF8))
        self.label_Eqpt_Model.setText(QtGui.QApplication.translate("MainWindow_InfoPanel", "Eqpt Model:", None, QtGui.QApplication.UnicodeUTF8))
        self.lineEdit_Eqpt_Model.setText(QtGui.QApplication.translate("MainWindow_InfoPanel", "ABC", None, QtGui.QApplication.UnicodeUTF8))
        self.label_State.setText(QtGui.QApplication.translate("MainWindow_InfoPanel", "State:", None, QtGui.QApplication.UnicodeUTF8))
        self.lineEdit_State.setText(QtGui.QApplication.translate("MainWindow_InfoPanel", "Working", None, QtGui.QApplication.UnicodeUTF8))
        self.groupBox_Current_Position.setTitle(QtGui.QApplication.translate("MainWindow_InfoPanel", "Current Position:", None, QtGui.QApplication.UnicodeUTF8))
        self.label_Current_Position_X.setText(QtGui.QApplication.translate("MainWindow_InfoPanel", "X =", None, QtGui.QApplication.UnicodeUTF8))
        self.lineEdit_Current_Position_X.setText(QtGui.QApplication.translate("MainWindow_InfoPanel", "1000.00 m", None, QtGui.QApplication.UnicodeUTF8))
        self.label_Current_Position_Y.setText(QtGui.QApplication.translate("MainWindow_InfoPanel", "Y =", None, QtGui.QApplication.UnicodeUTF8))
        self.lineEdit_Current_Position_Y.setText(QtGui.QApplication.translate("MainWindow_InfoPanel", "1000.00 m", None, QtGui.QApplication.UnicodeUTF8))
        self.tabWidget_Info_Panel.setTabText(self.tabWidget_Info_Panel.indexOf(self.tab_1), QtGui.QApplication.translate("MainWindow_InfoPanel", "Info_Pg 1", None, QtGui.QApplication.UnicodeUTF8))
        self.tabWidget_Info_Panel.setTabText(self.tabWidget_Info_Panel.indexOf(self.tab_2), QtGui.QApplication.translate("MainWindow_InfoPanel", "Info_Pg 2", None, QtGui.QApplication.UnicodeUTF8))

PS:我最初将 mainWindow 创建为 Dialog,但意识到在 undock & redock 之后,dockWidget 无法正确停靠。不知何故,有一个偏移量。如果 mainWindow 是 QtGui.QMainWindow 而不是 QtGui.QDialog,这似乎不是问题。

4

2 回答 2

0

ui您在文件中没有任何布局。不要只是将小部件放在某些位置。使用适当的布局来放置小部件。布局将确保小部件在您调整大小时正确增长/缩小。

官方文档有一个在 Qt Designer 中使用布局的部分。

编辑

ui显示正确使用布局的示例文件:

<?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>539</width>
    <height>600</height>
   </rect>
  </property>
  <property name="windowTitle">
   <string>MainWindow</string>
  </property>
  <widget class="QWidget" name="centralwidget">
   <layout class="QGridLayout" name="gridLayout">
    <item row="0" column="0">
     <widget class="QFrame" name="frame">
      <property name="frameShape">
       <enum>QFrame::StyledPanel</enum>
      </property>
      <property name="frameShadow">
       <enum>QFrame::Raised</enum>
      </property>
     </widget>
    </item>
   </layout>
  </widget>
  <widget class="QMenuBar" name="menubar">
   <property name="geometry">
    <rect>
     <x>0</x>
     <y>0</y>
     <width>539</width>
     <height>21</height>
    </rect>
   </property>
  </widget>
  <widget class="QStatusBar" name="statusbar"/>
  <widget class="QDockWidget" name="dockWidget_2">
   <attribute name="dockWidgetArea">
    <number>2</number>
   </attribute>
   <widget class="QWidget" name="dockWidgetContents_2">
    <layout class="QVBoxLayout" name="verticalLayout_2">
     <item>
      <widget class="QTabWidget" name="tabWidget">
       <widget class="QWidget" name="tab">
        <attribute name="title">
         <string>Tab 1</string>
        </attribute>
        <layout class="QVBoxLayout" name="verticalLayout">
         <item>
          <widget class="QScrollArea" name="scrollArea">
           <property name="widgetResizable">
            <bool>true</bool>
           </property>
           <widget class="QWidget" name="scrollAreaWidgetContents">
            <property name="geometry">
             <rect>
              <x>0</x>
              <y>0</y>
              <width>327</width>
              <height>473</height>
             </rect>
            </property>
            <layout class="QGridLayout" name="gridLayout_2">
             <item row="4" column="1">
              <widget class="QLineEdit" name="lineEdit_4"/>
             </item>
             <item row="3" column="1">
              <widget class="QLineEdit" name="lineEdit_3"/>
             </item>
             <item row="0" column="0">
              <widget class="QLabel" name="label">
               <property name="text">
                <string>Eqpt Model:</string>
               </property>
              </widget>
             </item>
             <item row="4" column="0">
              <widget class="QLabel" name="label_5">
               <property name="text">
                <string>Y=</string>
               </property>
              </widget>
             </item>
             <item row="1" column="0">
              <widget class="QLabel" name="label_2">
               <property name="text">
                <string>State:</string>
               </property>
              </widget>
             </item>
             <item row="2" column="0">
              <widget class="QLabel" name="label_3">
               <property name="text">
                <string>Current Position</string>
               </property>
              </widget>
             </item>
             <item row="1" column="1">
              <widget class="QLineEdit" name="lineEdit_2"/>
             </item>
             <item row="3" column="0">
              <widget class="QLabel" name="label_4">
               <property name="text">
                <string>X=</string>
               </property>
              </widget>
             </item>
             <item row="0" column="1">
              <widget class="QLineEdit" name="lineEdit"/>
             </item>
             <item row="5" column="1">
              <spacer name="verticalSpacer">
               <property name="orientation">
                <enum>Qt::Vertical</enum>
               </property>
               <property name="sizeHint" stdset="0">
                <size>
                 <width>20</width>
                 <height>40</height>
                </size>
               </property>
              </spacer>
             </item>
            </layout>
           </widget>
          </widget>
         </item>
        </layout>
       </widget>
       <widget class="QWidget" name="tab_2">
        <attribute name="title">
         <string>Tab 2</string>
        </attribute>
       </widget>
      </widget>
     </item>
    </layout>
   </widget>
  </widget>
 </widget>
 <resources/>
 <connections/>
</ui>
于 2012-09-19T09:22:19.950 回答
0

我已经修改了 InfoPanel.ui(用 scrollArea 小部件中的 gridLayout 替换框架)。

信息面板.ui:

<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
 <class>MainWindow_InfoPanel</class>
 <widget class="QMainWindow" name="MainWindow_InfoPanel">
  <property name="geometry">
   <rect>
    <x>0</x>
    <y>0</y>
    <width>602</width>
    <height>263</height>
   </rect>
  </property>
  <property name="windowTitle">
   <string>MainWindow Info Panel</string>
  </property>
  <property name="documentMode">
   <bool>false</bool>
  </property>
  <widget class="QWidget" name="centralwidget">
   <widget class="QFrame" name="frame_Info_Panel">
    <property name="geometry">
     <rect>
      <x>20</x>
      <y>50</y>
      <width>261</width>
      <height>161</height>
     </rect>
    </property>
   </widget>
  </widget>
  <widget class="QStatusBar" name="statusbar"/>
  <widget class="QDockWidget" name="dockWidget_Info_Panel">
   <property name="minimumSize">
    <size>
     <width>300</width>
     <height>140</height>
    </size>
   </property>
   <property name="font">
    <font>
     <weight>75</weight>
     <italic>true</italic>
     <bold>true</bold>
    </font>
   </property>
   <property name="layoutDirection">
    <enum>Qt::LeftToRight</enum>
   </property>
   <property name="allowedAreas">
    <set>Qt::LeftDockWidgetArea|Qt::RightDockWidgetArea</set>
   </property>
   <property name="windowTitle">
    <string>Info Panel</string>
   </property>
   <attribute name="dockWidgetArea">
    <number>2</number>
   </attribute>
   <widget class="QWidget" name="dockWidgetContents_Info_Panel">
    <widget class="QTabWidget" name="tabWidget_Info_Panel">
     <property name="geometry">
      <rect>
       <x>0</x>
       <y>0</y>
       <width>300</width>
       <height>215</height>
      </rect>
     </property>
     <property name="font">
      <font>
       <weight>50</weight>
       <italic>false</italic>
       <bold>false</bold>
      </font>
     </property>
     <property name="currentIndex">
      <number>0</number>
     </property>
     <widget class="QWidget" name="tab_1">
      <attribute name="title">
       <string>Info_Pg 1</string>
      </attribute>
      <widget class="QScrollArea" name="scrollArea_Info_Panel">
       <property name="geometry">
        <rect>
         <x>9</x>
         <y>9</y>
         <width>271</width>
         <height>171</height>
        </rect>
       </property>
       <property name="verticalScrollBarPolicy">
        <enum>Qt::ScrollBarAsNeeded</enum>
       </property>
       <property name="widgetResizable">
        <bool>true</bool>
       </property>
       <widget class="QWidget" name="scrollAreaWidgetContents">
        <property name="geometry">
         <rect>
          <x>0</x>
          <y>0</y>
          <width>269</width>
          <height>169</height>
         </rect>
        </property>
        <widget class="QWidget" name="gridLayoutWidget">
         <property name="geometry">
          <rect>
           <x>0</x>
           <y>0</y>
           <width>261</width>
           <height>161</height>
          </rect>
         </property>
         <layout class="QGridLayout" name="gridLayout_Info_Panel">
          <item row="0" column="0">
           <widget class="QLabel" name="label_Eqpt_Model">
            <property name="text">
             <string>Eqpt Model:</string>
            </property>
           </widget>
          </item>
          <item row="1" column="1">
           <widget class="QLineEdit" name="lineEdit_State">
            <property name="enabled">
             <bool>false</bool>
            </property>
            <property name="palette">
             <palette>
              <active>
               <colorrole role="Text">
                <brush brushstyle="SolidPattern">
                 <color alpha="255">
                  <red>60</red>
                  <green>60</green>
                  <blue>60</blue>
                 </color>
                </brush>
               </colorrole>
              </active>
              <inactive>
               <colorrole role="Text">
                <brush brushstyle="SolidPattern">
                 <color alpha="255">
                  <red>60</red>
                  <green>60</green>
                  <blue>60</blue>
                 </color>
                </brush>
               </colorrole>
              </inactive>
              <disabled>
               <colorrole role="Text">
                <brush brushstyle="SolidPattern">
                 <color alpha="255">
                  <red>0</red>
                  <green>0</green>
                  <blue>127</blue>
                 </color>
                </brush>
               </colorrole>
              </disabled>
             </palette>
            </property>
            <property name="text">
             <string>Working</string>
            </property>
           </widget>
          </item>
          <item row="1" column="0">
           <widget class="QLabel" name="label_State">
            <property name="text">
             <string>State:</string>
            </property>
           </widget>
          </item>
          <item row="0" column="1">
           <widget class="QLineEdit" name="lineEdit_Eqpt_Model">
            <property name="enabled">
             <bool>false</bool>
            </property>
            <property name="palette">
             <palette>
              <active>
               <colorrole role="Text">
                <brush brushstyle="SolidPattern">
                 <color alpha="255">
                  <red>60</red>
                  <green>60</green>
                  <blue>60</blue>
                 </color>
                </brush>
               </colorrole>
              </active>
              <inactive>
               <colorrole role="Text">
                <brush brushstyle="SolidPattern">
                 <color alpha="255">
                  <red>60</red>
                  <green>60</green>
                  <blue>60</blue>
                 </color>
                </brush>
               </colorrole>
              </inactive>
              <disabled>
               <colorrole role="Text">
                <brush brushstyle="SolidPattern">
                 <color alpha="255">
                  <red>0</red>
                  <green>0</green>
                  <blue>127</blue>
                 </color>
                </brush>
               </colorrole>
              </disabled>
             </palette>
            </property>
            <property name="text">
             <string>ABC</string>
            </property>
           </widget>
          </item>
          <item row="2" column="0" colspan="2">
           <widget class="QGroupBox" name="groupBox_Current_Position">
            <property name="palette">
             <palette>
              <active>
               <colorrole role="WindowText">
                <brush brushstyle="SolidPattern">
                 <color alpha="255">
                  <red>0</red>
                  <green>0</green>
                  <blue>0</blue>
                 </color>
                </brush>
               </colorrole>
               <colorrole role="Button">
                <brush brushstyle="SolidPattern">
                 <color alpha="255">
                  <red>85</red>
                  <green>255</green>
                  <blue>0</blue>
                 </color>
                </brush>
               </colorrole>
               <colorrole role="Light">
                <brush brushstyle="SolidPattern">
                 <color alpha="255">
                  <red>170</red>
                  <green>255</green>
                  <blue>127</blue>
                 </color>
                </brush>
               </colorrole>
               <colorrole role="Midlight">
                <brush brushstyle="SolidPattern">
                 <color alpha="255">
                  <red>127</red>
                  <green>255</green>
                  <blue>63</blue>
                 </color>
                </brush>
               </colorrole>
               <colorrole role="Dark">
                <brush brushstyle="SolidPattern">
                 <color alpha="255">
                  <red>42</red>
                  <green>127</green>
                  <blue>0</blue>
                 </color>
                </brush>
               </colorrole>
               <colorrole role="Mid">
                <brush brushstyle="SolidPattern">
                 <color alpha="255">
                  <red>56</red>
                  <green>170</green>
                  <blue>0</blue>
                 </color>
                </brush>
               </colorrole>
               <colorrole role="Text">
                <brush brushstyle="SolidPattern">
                 <color alpha="255">
                  <red>0</red>
                  <green>0</green>
                  <blue>0</blue>
                 </color>
                </brush>
               </colorrole>
               <colorrole role="BrightText">
                <brush brushstyle="SolidPattern">
                 <color alpha="255">
                  <red>255</red>
                  <green>255</green>
                  <blue>255</blue>
                 </color>
                </brush>
               </colorrole>
               <colorrole role="ButtonText">
                <brush brushstyle="SolidPattern">
                 <color alpha="255">
                  <red>0</red>
                  <green>0</green>
                  <blue>0</blue>
                 </color>
                </brush>
               </colorrole>
               <colorrole role="Base">
                <brush brushstyle="SolidPattern">
                 <color alpha="255">
                  <red>255</red>
                  <green>255</green>
                  <blue>255</blue>
                 </color>
                </brush>
               </colorrole>
               <colorrole role="Window">
                <brush brushstyle="SolidPattern">
                 <color alpha="255">
                  <red>85</red>
                  <green>255</green>
                  <blue>0</blue>
                 </color>
                </brush>
               </colorrole>
               <colorrole role="Shadow">
                <brush brushstyle="SolidPattern">
                 <color alpha="255">
                  <red>0</red>
                  <green>0</green>
                  <blue>0</blue>
                 </color>
                </brush>
               </colorrole>
               <colorrole role="AlternateBase">
                <brush brushstyle="SolidPattern">
                 <color alpha="255">
                  <red>170</red>
                  <green>255</green>
                  <blue>127</blue>
                 </color>
                </brush>
               </colorrole>
               <colorrole role="ToolTipBase">
                <brush brushstyle="SolidPattern">
                 <color alpha="255">
                  <red>255</red>
                  <green>255</green>
                  <blue>220</blue>
                 </color>
                </brush>
               </colorrole>
               <colorrole role="ToolTipText">
                <brush brushstyle="SolidPattern">
                 <color alpha="255">
                  <red>0</red>
                  <green>0</green>
                  <blue>0</blue>
                 </color>
                </brush>
               </colorrole>
              </active>
              <inactive>
               <colorrole role="WindowText">
                <brush brushstyle="SolidPattern">
                 <color alpha="255">
                  <red>0</red>
                  <green>0</green>
                  <blue>0</blue>
                 </color>
                </brush>
               </colorrole>
               <colorrole role="Button">
                <brush brushstyle="SolidPattern">
                 <color alpha="255">
                  <red>85</red>
                  <green>255</green>
                  <blue>0</blue>
                 </color>
                </brush>
               </colorrole>
               <colorrole role="Light">
                <brush brushstyle="SolidPattern">
                 <color alpha="255">
                  <red>170</red>
                  <green>255</green>
                  <blue>127</blue>
                 </color>
                </brush>
               </colorrole>
               <colorrole role="Midlight">
                <brush brushstyle="SolidPattern">
                 <color alpha="255">
                  <red>127</red>
                  <green>255</green>
                  <blue>63</blue>
                 </color>
                </brush>
               </colorrole>
               <colorrole role="Dark">
                <brush brushstyle="SolidPattern">
                 <color alpha="255">
                  <red>42</red>
                  <green>127</green>
                  <blue>0</blue>
                 </color>
                </brush>
               </colorrole>
               <colorrole role="Mid">
                <brush brushstyle="SolidPattern">
                 <color alpha="255">
                  <red>56</red>
                  <green>170</green>
                  <blue>0</blue>
                 </color>
                </brush>
               </colorrole>
               <colorrole role="Text">
                <brush brushstyle="SolidPattern">
                 <color alpha="255">
                  <red>0</red>
                  <green>0</green>
                  <blue>0</blue>
                 </color>
                </brush>
               </colorrole>
               <colorrole role="BrightText">
                <brush brushstyle="SolidPattern">
                 <color alpha="255">
                  <red>255</red>
                  <green>255</green>
                  <blue>255</blue>
                 </color>
                </brush>
               </colorrole>
               <colorrole role="ButtonText">
                <brush brushstyle="SolidPattern">
                 <color alpha="255">
                  <red>0</red>
                  <green>0</green>
                  <blue>0</blue>
                 </color>
                </brush>
               </colorrole>
               <colorrole role="Base">
                <brush brushstyle="SolidPattern">
                 <color alpha="255">
                  <red>255</red>
                  <green>255</green>
                  <blue>255</blue>
                 </color>
                </brush>
               </colorrole>
               <colorrole role="Window">
                <brush brushstyle="SolidPattern">
                 <color alpha="255">
                  <red>85</red>
                  <green>255</green>
                  <blue>0</blue>
                 </color>
                </brush>
               </colorrole>
               <colorrole role="Shadow">
                <brush brushstyle="SolidPattern">
                 <color alpha="255">
                  <red>0</red>
                  <green>0</green>
                  <blue>0</blue>
                 </color>
                </brush>
               </colorrole>
               <colorrole role="AlternateBase">
                <brush brushstyle="SolidPattern">
                 <color alpha="255">
                  <red>170</red>
                  <green>255</green>
                  <blue>127</blue>
                 </color>
                </brush>
               </colorrole>
               <colorrole role="ToolTipBase">
                <brush brushstyle="SolidPattern">
                 <color alpha="255">
                  <red>255</red>
                  <green>255</green>
                  <blue>220</blue>
                 </color>
                </brush>
               </colorrole>
               <colorrole role="ToolTipText">
                <brush brushstyle="SolidPattern">
                 <color alpha="255">
                  <red>0</red>
                  <green>0</green>
                  <blue>0</blue>
                 </color>
                </brush>
               </colorrole>
              </inactive>
              <disabled>
               <colorrole role="WindowText">
                <brush brushstyle="SolidPattern">
                 <color alpha="255">
                  <red>42</red>
                  <green>127</green>
                  <blue>0</blue>
                 </color>
                </brush>
               </colorrole>
               <colorrole role="Button">
                <brush brushstyle="SolidPattern">
                 <color alpha="255">
                  <red>85</red>
                  <green>255</green>
                  <blue>0</blue>
                 </color>
                </brush>
               </colorrole>
               <colorrole role="Light">
                <brush brushstyle="SolidPattern">
                 <color alpha="255">
                  <red>170</red>
                  <green>255</green>
                  <blue>127</blue>
                 </color>
                </brush>
               </colorrole>
               <colorrole role="Midlight">
                <brush brushstyle="SolidPattern">
                 <color alpha="255">
                  <red>127</red>
                  <green>255</green>
                  <blue>63</blue>
                 </color>
                </brush>
               </colorrole>
               <colorrole role="Dark">
                <brush brushstyle="SolidPattern">
                 <color alpha="255">
                  <red>42</red>
                  <green>127</green>
                  <blue>0</blue>
                 </color>
                </brush>
               </colorrole>
               <colorrole role="Mid">
                <brush brushstyle="SolidPattern">
                 <color alpha="255">
                  <red>56</red>
                  <green>170</green>
                  <blue>0</blue>
                 </color>
                </brush>
               </colorrole>
               <colorrole role="Text">
                <brush brushstyle="SolidPattern">
                 <color alpha="255">
                  <red>42</red>
                  <green>127</green>
                  <blue>0</blue>
                 </color>
                </brush>
               </colorrole>
               <colorrole role="BrightText">
                <brush brushstyle="SolidPattern">
                 <color alpha="255">
                  <red>255</red>
                  <green>255</green>
                  <blue>255</blue>
                 </color>
                </brush>
               </colorrole>
               <colorrole role="ButtonText">
                <brush brushstyle="SolidPattern">
                 <color alpha="255">
                  <red>42</red>
                  <green>127</green>
                  <blue>0</blue>
                 </color>
                </brush>
               </colorrole>
               <colorrole role="Base">
                <brush brushstyle="SolidPattern">
                 <color alpha="255">
                  <red>85</red>
                  <green>255</green>
                  <blue>0</blue>
                 </color>
                </brush>
               </colorrole>
               <colorrole role="Window">
                <brush brushstyle="SolidPattern">
                 <color alpha="255">
                  <red>85</red>
                  <green>255</green>
                  <blue>0</blue>
                 </color>
                </brush>
               </colorrole>
               <colorrole role="Shadow">
                <brush brushstyle="SolidPattern">
                 <color alpha="255">
                  <red>0</red>
                  <green>0</green>
                  <blue>0</blue>
                 </color>
                </brush>
               </colorrole>
               <colorrole role="AlternateBase">
                <brush brushstyle="SolidPattern">
                 <color alpha="255">
                  <red>85</red>
                  <green>255</green>
                  <blue>0</blue>
                 </color>
                </brush>
               </colorrole>
               <colorrole role="ToolTipBase">
                <brush brushstyle="SolidPattern">
                 <color alpha="255">
                  <red>255</red>
                  <green>255</green>
                  <blue>220</blue>
                 </color>
                </brush>
               </colorrole>
               <colorrole role="ToolTipText">
                <brush brushstyle="SolidPattern">
                 <color alpha="255">
                  <red>0</red>
                  <green>0</green>
                  <blue>0</blue>
                 </color>
                </brush>
               </colorrole>
              </disabled>
             </palette>
            </property>
            <property name="title">
             <string>Current Position:</string>
            </property>
            <widget class="QLabel" name="label_Current_Position_X">
             <property name="geometry">
              <rect>
               <x>20</x>
               <y>20</y>
               <width>41</width>
               <height>27</height>
              </rect>
             </property>
             <property name="text">
              <string>X =</string>
             </property>
            </widget>
            <widget class="QLineEdit" name="lineEdit_Current_Position_X">
             <property name="enabled">
              <bool>false</bool>
             </property>
             <property name="geometry">
              <rect>
               <x>60</x>
               <y>20</y>
               <width>161</width>
               <height>27</height>
              </rect>
             </property>
             <property name="palette">
              <palette>
               <active>
                <colorrole role="Text">
                 <brush brushstyle="SolidPattern">
                  <color alpha="255">
                   <red>60</red>
                   <green>60</green>
                   <blue>60</blue>
                  </color>
                 </brush>
                </colorrole>
               </active>
               <inactive>
                <colorrole role="Text">
                 <brush brushstyle="SolidPattern">
                  <color alpha="255">
                   <red>60</red>
                   <green>60</green>
                   <blue>60</blue>
                  </color>
                 </brush>
                </colorrole>
               </inactive>
               <disabled>
                <colorrole role="Text">
                 <brush brushstyle="SolidPattern">
                  <color alpha="255">
                   <red>0</red>
                   <green>0</green>
                   <blue>127</blue>
                  </color>
                 </brush>
                </colorrole>
               </disabled>
              </palette>
             </property>
             <property name="text">
              <string>1000.00 m</string>
             </property>
            </widget>
            <widget class="QLabel" name="label_Current_Position_Y">
             <property name="geometry">
              <rect>
               <x>20</x>
               <y>50</y>
               <width>41</width>
               <height>27</height>
              </rect>
             </property>
             <property name="text">
              <string>Y =</string>
             </property>
            </widget>
            <widget class="QLineEdit" name="lineEdit_Current_Position_Y">
             <property name="enabled">
              <bool>false</bool>
             </property>
             <property name="geometry">
              <rect>
               <x>60</x>
               <y>50</y>
               <width>161</width>
               <height>27</height>
              </rect>
             </property>
             <property name="palette">
              <palette>
               <active>
                <colorrole role="Text">
                 <brush brushstyle="SolidPattern">
                  <color alpha="255">
                   <red>60</red>
                   <green>60</green>
                   <blue>60</blue>
                  </color>
                 </brush>
                </colorrole>
               </active>
               <inactive>
                <colorrole role="Text">
                 <brush brushstyle="SolidPattern">
                  <color alpha="255">
                   <red>60</red>
                   <green>60</green>
                   <blue>60</blue>
                  </color>
                 </brush>
                </colorrole>
               </inactive>
               <disabled>
                <colorrole role="Text">
                 <brush brushstyle="SolidPattern">
                  <color alpha="255">
                   <red>0</red>
                   <green>0</green>
                   <blue>127</blue>
                  </color>
                 </brush>
                </colorrole>
               </disabled>
              </palette>
             </property>
             <property name="text">
              <string>1000.00 m</string>
             </property>
            </widget>
           </widget>
          </item>
         </layout>
        </widget>
       </widget>
      </widget>
     </widget>
     <widget class="QWidget" name="tab_2">
      <attribute name="title">
       <string>Info_Pg 2</string>
      </attribute>
     </widget>
    </widget>
   </widget>
  </widget>
 </widget>
 <resources/>
 <connections/>
</ui>

在命令提示符中使用 pyuic4 -o InfoPanel_UI.py InfoPanel.ui 创建了 *_UI.pt。

使用 Test_InfoPanel.py 运行,在垂直调整大小时仍然显示滚动条未显示的相同结果。:(

于 2012-09-25T06:39:06.230 回答