[PyQt] Upgrading from static to dock widgets?
sda at fstab.net
Wed Jun 26 12:23:33 BST 2019
Side note, perhaps something like below would be of interest to you. It
would require wrapping it for Python but hopefully SIP would make that
'easy'. I've been meaning to do that myself for awhile but haven't
gotten to it yet.
On 2019-06-26 05:33, Matic Kukovec wrote:
> Hi guys,
> I have an application that uses three QTabWidgets in a QGroupBox as the central widget.
> This works great and I have implemented dragging of tabs between these three widgets.
> To upgrade to docking, I would wrap each QTabWidget in a QDockWidget and remove it's titlebar with 'setTitleBarWidget', as I don't want a titlebar. I would also remove the central widget and just have three QDockWidget's docked somewhere.
> My questions are:
> * I would upgrade the QTabWidget to wrap a dragged tab by putting it inside a new QTabWidget and putting it into a QDockWidget automatically on the fly.
> How can I then manually initiate a 'dock move' when I drag one of the tabs from a QTabWidget after the dragged tab widget was wrapped as described in the previous sentence?
> * I tried playing around with QDockWidgets to figure out how to make them movable to any space (above, below, left, right) of any other QDockWidget, but the way in which they can be moved is limited to what area they were initialized in. For example if I add 4 dockwidgets to the QMainWindow with the 'self.addDockWidget(Qt.TopDockWidgetArea, dockwidget)', I can only move them side-by-side, I cannot move one above or below another. What am I missing? My test Example:
> from PyQt5.QtWidgets import *
> from PyQt5.QtGui import *
> from PyQt5.QtCore import *
> import sys
> class Window(QMainWindow):
> def __init__(self):
> title = "DockAble Application"
> top = 400
> left = 400
> width = 600
> height = 500
> self.setGeometry(top,left, width, height)
> def dockAble(self):
> for i in range(3):
> dock = QDockWidget("Test widget", self)
> self.addDockWidget(Qt.TopDockWidgetArea, dock)
> app = QApplication(sys.argv)
> window = Window()
> window.show() app.exec()
> PyQt mailing list PyQt at riverbankcomputing.com
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the PyQt