Search Results

Search found 1 results on 1 pages for 'whospal'.

Page 1/1 | 1 

  • PyQt4: Scrollbar doesn't show in scrollarea when resizing dockWidget

    - by Whospal
    I created a python test program (Test_InfoPanel.py) that has MainWindow with dockWidget, and within it, a tabWidget with scrollArea widget. However, when I resize the MainWindow, the vertical scrollbar doesn't auto-appear when the Similarly, when I undock the dockWidget & resize, the vertical scrollbar doesn't auto-appear. Pls help! Test Program (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_()) Generated *.ui script (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: I initially created the mainWindow as a Dialog, but realized that after undock & redock, the dockWidget doesn't dock properly. Somehow there's an offset. This doesn't seem to be a problem if the mainWindow is a QtGui.QMainWindow instead of a QtGui.QDialog.

    Read the article

1