Results 1 to 9 of 9

Thread: Problem with QDockWidget

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2008
    Posts
    39
    Thanks
    10
    Qt products
    Qt4
    Platforms
    Windows

    Default Problem with QDockWidget

    Hello
    I am new to QT and am having the following problem with a simple test application that I would appreciate a point in the right direction.

    I have used the Designer to create the interface as follows:

    Qt Code:
    1. class Ui_MainWindow(object):
    2. def setupUi(self, MainWindow):
    3. MainWindow.setObjectName("MainWindow")
    4. MainWindow.resize(QtCore.QSize(QtCore.QRect(0,0,800,600).size()).expandedTo(MainWindow.minimumSizeHint()))
    5.  
    6. self.centralwidget = QtGui.QWidget(MainWindow)
    7. self.centralwidget.setObjectName("centralwidget")
    8.  
    9. self.line = QtGui.QFrame(self.centralwidget)
    10. self.line.setGeometry(QtCore.QRect(663,50,20,481))
    11. self.line.setFrameShape(QtGui.QFrame.VLine)
    12. self.line.setFrameShadow(QtGui.QFrame.Sunken)
    13. self.line.setObjectName("line")
    14. MainWindow.setCentralWidget(self.centralwidget)
    15.  
    16. self.menubar = QtGui.QMenuBar(MainWindow)
    17. self.menubar.setGeometry(QtCore.QRect(0,0,800,21))
    18. self.menubar.setObjectName("menubar")
    19. MainWindow.setMenuBar(self.menubar)
    20.  
    21. self.statusbar = QtGui.QStatusBar(MainWindow)
    22. self.statusbar.setObjectName("statusbar")
    23. MainWindow.setStatusBar(self.statusbar)
    24.  
    25. self.retranslateUi(MainWindow)
    26. QtCore.QMetaObject.connectSlotsByName(MainWindow)
    27.  
    28. def retranslateUi(self, MainWindow):
    29. MainWindow.setWindowTitle(QtGui.QApplication.translate("MainWindow", "MainWindow", None, QtGui.QApplication.UnicodeUTF8))
    To copy to clipboard, switch view to plain text mode 
    with the main file:
    Qt Code:
    1. class MainWindow(QMainWindow, Ui_MainWindow):
    2. def __init__(self, parent=None):
    3. super(MainWindow, self).__init__(parent)
    4. self.ui = Ui_MainWindow()
    5. self.ui.setupUi(self)
    6. self.createDockWindows()
    7.  
    8. def createDockWindows(self):
    9. dock1 = QDockWidget("Dock1", self)
    10. dock1.setAllowedAreas(Qt.RightDockWidgetArea)
    11. w = QLabel("Hello")
    12. dock1.setWidget(w)
    13. self.addDockWidget(Qt.RightDockWidgetArea, dock1)
    14.  
    15. def main():
    16. app = QApplication(sys.argv)
    17. mainwindow = MainWindow()
    18. mainwindow.show()
    19. sys.exit(app.exec_())
    20.  
    21. main()
    To copy to clipboard, switch view to plain text mode 
    The problem that I have is that when the dockwidget is resized by the user, it just goes over the top of the main window. I have tried writing the interface manually and that works but I can't work out why using the designer is different - obviously some operator error but I can't work it out.

    Thanks in advance
    Last edited by jpn; 11th March 2008 at 10:15. Reason: missing [code] tags

Similar Threads

  1. Tricky problem with ARGB widget / UpdateLayeredWindow
    By nooky59 in forum Qt Programming
    Replies: 3
    Last Post: 21st February 2008, 10:35
  2. Replies: 8
    Last Post: 4th February 2007, 00:42
  3. QDockWidget nesting problem..
    By aamer4yu in forum Qt Programming
    Replies: 6
    Last Post: 31st January 2007, 12:23
  4. Problem in restoring more than one QDockWidget
    By vratojr in forum Qt Programming
    Replies: 3
    Last Post: 13th March 2006, 13:45
  5. Replies: 16
    Last Post: 7th March 2006, 15:57

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.