[PyQt] Possible bug with dock widgets in PyQt5

Phil Thompson phil at riverbankcomputing.com
Tue Sep 2 16:30:48 BST 2014


On 19/08/2014 4:26 am, Ben wrote:
> I'm encountering a really weird issue with PyQt5.  I'm trying to use
> Dock Widgets  and I keep on getting these issues with "lingering
> docks."  If I switch over to PyQt4, it works all fine.  I'm using
> xubuntu 14.04 and python 3.x if that matters.
> 
> Here is a screenshot of some: http://i.imgur.com/0wadhh8.png
> 
> And here is some code:
> --------
>     # File:           dock_test.py
>     # Author:         Ben Summerton  (define-private-public)
>     # Description:    Made out of my frustration in trying to
> understand dock widgets.  I decided to take a break from the regular
>     #                 development of the app to get these dock widgets 
> working.
> 
>     import sys
>     from PyQt5.QtCore import *
>     from PyQt5.QtGui import *
>     from PyQt5.QtWidgets import *
> 
> 
>     class DockedApp(QMainWindow):
> 
>         def __init__(self, parent=None):
>             super(DockedApp, self).__init__(parent)
> 
>             self.setWindowTitle('Docked App')
>             self.setGeometry(200, 200, 640, 480)
> 
>             # Central Widget
>             self.textEdit = QTextEdit()
>             self.setCentralWidget(self.textEdit)
> 
>             # Create the dock windows
>             dock = QDockWidget('A Label for you', self)
>             dock.setAllowedAreas(Qt.TopDockWidgetArea | 
> Qt.BottomDockWidgetArea)
>             self.lolipop = QLabel('Dr. Lolipop, M.D.', dock)
>             dock.setWidget(self.lolipop)
>             self.addDockWidget(Qt.TopDockWidgetArea, dock)
> 
> 
> 
> 
> 
>     def main():
>         app = QApplication(sys.argv)
> 
>         da = DockedApp()
>         da.show()
>         sys.exit(app.exec_())
> 
> 
>     main()
> --------
> 
> I also took the dock widgets example and tried that out, and it breaks
> as well.  So far the only remedy is to reboot my OS. Restarting
> lightdm doesn't even fix it.
> 
> I'd really like to use Qt5, but this is a really big problem.

So what actually is the problem? It works as expected for me.

Phil


More information about the PyQt mailing list