當我創造出了主窗口與dockWidget一個Python測試程序(Test_InfoPanel.py)滾動條不scrollarea顯示,並在其中,與scrollArea小部件tabWidget。 然而,當我調整主窗口,垂直滾動條沒有自動出現時PyQt4中:調整dockWidget
同樣地,當我取消停靠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:我啓動盟友創建了一個對話框的主窗口,但意識到,在取消鎖定&重新鎖定後,dockWidget無法正確對接。不知何故有一個抵消。如果mainWindow是QtGui.QMainWindow而不是QtGui.QDialog,這似乎不成問題。
我改變了* .UI文件在scrollArea中使用網格佈局,但它不起作用滾動條仍然不顯示 – Whospal
@Whospal:在另一個裏面的每個小部件應該在'否則他們不能相互溝通調整大小這就是'QLayout'及其派生類的全部內容,你仍然沒有這樣做,我添加了一個模擬你的設計的'.ui'文件,但是請仔細閱讀並檢查它以及我在答案中提供的文檔鏈接 – Avaris
最初,我沒有看到您的用戶界面如何在沒有佈局小部件的情況下工作,這是我爲我的標籤和LineEdits所做的工作在tabWidget的scrollArea中。然後我查看了屬性並注意到一些小部件的佈局屬性設置爲Grid或Vert。我假設這是通過使用RightClick並選擇佈局選項完成的。 我修改了我的UI到你的示例,它的工作原理!非常感謝! 現在我明白QT4是如何工作的。 :) – Whospal