Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QMdiArea subwindow scrolls not working in TabbedView
Forum Updated to NodeBB v4.3 + New Features

QMdiArea subwindow scrolls not working in TabbedView

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 1.6k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    babablacksheep
    wrote on last edited by
    #1

    I have setup simple example using PyQt designer.See below. I have mdiarea in in which i am adding a form as subwindow. I made subwindow form a bit lengthier than mainwindow to see if scroll-bar appears for child sub-window.

    PROBLEM:
    If i set mdiarea to setViewMode(QtGui.QMdiArea.TabbedView) scrollbars stop working and disappear. Howeevr If i dont use TabbedView, scrollbars work fine. Can anyone tell me whats wrong ? I need TabbedView of mdiarea with working scrollbars.

    Python Sample Code:
    Comment the line self.mdiArea.setViewMode to see example working.

    _
    I am using Python 2.7,PyQT 4.8.4/Pyside 1.2.1 on win7.

    @import sys
    from PyQt4 import QtCore, QtGui

    class Ui_MainWindow(object):
    def setupUi(self, MainWindow):
    MainWindow.setObjectName( "MainWindow" )
    MainWindow.resize(500, 400)
    self.centralwidget = QtGui.QWidget(MainWindow)
    self.centralwidget.setObjectName( "centralwidget" )
    self.verticalLayout = QtGui.QVBoxLayout(self.centralwidget)
    self.verticalLayout.setObjectName( "verticalLayout" )
    self.mdiArea = QtGui.QMdiArea(self.centralwidget)

        self.mdiArea.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded)
        self.mdiArea.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded)
    
        self.mdiArea.setActivationOrder(QtGui.QMdiArea.CreationOrder)
        self.mdiArea.setViewMode(QtGui.QMdiArea.TabbedView)
        self.mdiArea.setTabsClosable(True)
        self.mdiArea.setTabsMovable(True)
        self.mdiArea.setObjectName( "mdiArea" )
        self.verticalLayout.addWidget(self.mdiArea)
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtGui.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 508, 21))
        self.menubar.setObjectName( "menubar" )
        self.menuAdd = QtGui.QMenu(self.menubar)
        self.menuAdd.setObjectName( "menuAdd" )
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QtGui.QStatusBar(MainWindow)
        self.statusbar.setObjectName( "statusbar" )
        MainWindow.setStatusBar(self.statusbar)
        self.menubar.addAction(self.menuAdd.menuAction())
    
        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)
    
    def retranslateUi(self, MainWindow):
        MainWindow.setWindowTitle(   "MainWindow" )
        self.menuAdd.setTitle( "&Add Form" )
    

    class Ui_Form(object):
    def setupUi(self, Form):
    Form.setObjectName( ("Form"))
    Form.resize(400, 800)
    self.gridLayout = QtGui.QGridLayout(Form)
    self.gridLayout.setObjectName( ("gridLayout"))
    self.plainTextEdit = QtGui.QPlainTextEdit(Form)
    self.plainTextEdit.setMinimumSize(QtCore.QSize(0, 731))
    self.plainTextEdit.setObjectName( ("plainTextEdit"))
    self.gridLayout.addWidget(self.plainTextEdit, 0, 0, 1, 1)
    self.buttonBox = QtGui.QDialogButtonBox(Form)
    self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
    self.buttonBox.setObjectName( ("buttonBox"))
    self.gridLayout.addWidget(self.buttonBox, 1, 0, 1, 1)

        self.retranslateUi(Form)
        QtCore.QMetaObject.connectSlotsByName(Form)
    
    def retranslateUi(self, Form):
        Form.setWindowTitle( "Lengthy subwindow" )
        self.plainTextEdit.setPlainText( "Lengthy Form" ) 
    

    class MyApp(QtGui.QMainWindow):
    def init(self, parent=None):
    super(MyApp, self).init(parent)
    self.ui = Ui_MainWindow()
    self.ui.setupUi(self)

    def Add_Subwindow(self):
        widget = QtGui.QWidget()
        self.subwin_abq = Ui_Form()
        self.subwin_abq.setupUi(widget)
        self.subwindow = QtGui.QMdiSubWindow(self.ui.mdiArea) 
        widget.setParent(self.subwindow)
        self.subwindow.setWidget(widget)  
        self.subwindow.setWindowTitle("testing")
        self.ui.mdiArea.addSubWindow(self.subwindow)
        widget.show()
        self.subwindow.show()
        self.subwindow.widget().show()
    

    if name == "main":
    app = QtGui.QApplication(sys.argv)
    window = MyApp()
    window.show()
    window.Add_Subwindow()
    sys.exit(app.exec_())@

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved