<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hi guys,</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
I have an application that uses three QTabWidgets in a QGroupBox as the central widget.<br>
This works great and I have implemented dragging of tabs between these three widgets.</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
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.<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
My questions are:</div>
<ul>
<li><span style="font-family: Calibri, Helvetica, sans-serif;">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.<br>
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?</span></li><li><span style="font-family: Calibri, Helvetica, sans-serif;">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 '</span><span style="font-family: Calibri, Helvetica, sans-serif;">self.addDockWidget(Qt.TopDockWidgetArea, dockwidget)</span><span style="font-family: Calibri, Helvetica, sans-serif;">',
I can only move them side-by-side, I cannot move one above or below another. What am I missing? My test Example:</span><br>
<span style="font-family: Calibri, Helvetica, sans-serif;"></span><span style="font-family: Calibri, Helvetica, sans-serif;"><span style="font-size: 10pt; line-height: normal;">from PyQt5.QtWidgets import *</span><span><br>
</span>
<div><span style="font-size: 10pt; line-height: normal;">from PyQt5.QtGui import *</span><br>
</div>
<div><span style="font-size: 10pt; line-height: normal;">from PyQt5.QtCore import *</span><br>
</div>
<div><span style="font-size: 10pt; line-height: normal;">import sys</span><br>
</div>
<div><br>
</div>
<div><span style="font-size: 10pt; line-height: normal;">class Window(QMainWindow):</span><br>
</div>
<div><span style="font-size: 10pt; line-height: normal;"> def __init__(self):</span><br>
</div>
<div><span style="font-size: 10pt; line-height: normal;"> super().__init__()</span><br>
</div>
<div><br>
</div>
<div><span style="font-size: 10pt; line-height: normal;"> title = "DockAble Application"</span><br>
</div>
<div><span style="font-size: 10pt; line-height: normal;"> top = 400</span><br>
</div>
<div><span style="font-size: 10pt; line-height: normal;"> left = 400</span><br>
</div>
<div><span style="font-size: 10pt; line-height: normal;"> width = 600</span><br>
</div>
<div><span style="font-size: 10pt; line-height: normal;"> height = 500</span><br>
</div>
<div><br>
</div>
<div><span style="font-size: 10pt; line-height: normal;"> self.setWindowTitle(title)</span><br>
</div>
<div><span style="font-size: 10pt; line-height: normal;"> self.setGeometry(top,left, width, height)</span><br>
</div>
<div><br>
</div>
<div><span style="font-size: 10pt; line-height: normal;"> self.dockAble()</span><br>
</div>
<div><br>
</div>
<div><span style="font-size: 10pt; line-height: normal;"> def dockAble(self):</span><br>
</div>
<div><span style="font-size: 10pt; line-height: normal;"> for i in range(3):</span><br>
</div>
<div><span style="font-size: 10pt; line-height: normal;"> dock = QDockWidget("Test widget", self)</span><br>
</div>
<div><span style="font-size: 10pt; line-height: normal;"> dock.setAllowedAreas(Qt.AllDockWidgetAreas)</span><br>
</div>
<div><span style="font-size: 10pt; line-height: normal;"> self.addDockWidget(Qt.TopDockWidgetArea, dock)</span><br>
</div>
<div><br>
</div>
<div><span style="font-size: 10pt; line-height: normal;">app = QApplication(sys.argv)</span><br>
</div>
<div><span style="font-size: 10pt; line-height: normal;">window = Window()</span><br>
</div>
<div><span style="font-size: 10pt; line-height: normal;">window.show()</span><br>
</div>
<span style="font-size: 10pt; line-height: normal;">app.exec()</span></span></li></ul>
<div><span style="font-family: Calibri, Helvetica, sans-serif;"><span style="font-size: 12pt; line-height: normal; font-family: Calibri, Helvetica, sans-serif;"><br>
</span></span></div>
<div><span style="font-family: Calibri, Helvetica, sans-serif;"><span style="font-size: 12pt; line-height: normal; font-family: Calibri, Helvetica, sans-serif;">Thanks</span><span style="font-size: 10pt; line-height: normal;">,</span></span></div>
<div><span style="font-family: Calibri, Helvetica, sans-serif;"><span style="font-size: 12pt; line-height: normal;">Matic</span><span style="font-size: 10pt; line-height: normal;"><br>
</span></span></div>
<div><span style="font-family: Calibri, Helvetica, sans-serif;"><span style="font-size: 10pt; line-height: normal;"></span></span></div>
</body>
</html>