<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>
<div>
<div>
<div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<blockquote style="border-color:rgb(200,200,200); border-left:3px solid rgb(200,200,200); padding-left:1ex; margin-left:0.8ex; color:rgb(102,102,102)">
<div>
<div>
<div>
<div dir="ltr">
<div style="color:black; font-size:12pt; font-family:Calibri,Helvetica,sans-serif">
Hey Kyle,</div>
<div style="color:black; font-size:12pt; font-family:Calibri,Helvetica,sans-serif">
<br>
</div>
<div style="color:black; font-size:12pt; font-family:Calibri,Helvetica,sans-serif">
If it was ported, it would be exactly what I need.<br>
Unfortunately, I don't have any experience with SIP to be able to do it. But I will look into it, thanks.</div>
<div style="color:black; font-size:12pt; font-family:Calibri,Helvetica,sans-serif">
<br>
</div>
<div style="color:black; font-size:12pt; font-family:Calibri,Helvetica,sans-serif">
If anyone else has other suggestions/solutions, please let me know.<br>
</div>
<div style="color:black; font-size:12pt; font-family:Calibri,Helvetica,sans-serif">
<br>
</div>
<div style="color:black; font-size:12pt; font-family:Calibri,Helvetica,sans-serif">
Regards,<br>
</div>
<div style="color:black; font-size:12pt; font-family:Calibri,Helvetica,sans-serif">
Matic<br>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div dir="ltr">
<div dir="ltr"><font style="font-size:11pt" face="Calibri,sans-serif" color="black"><b>From:</b> Kyle Altendorf <sda@fstab.net><br>
<b>Sent:</b> Wednesday, June 26, 2019 1:23 PM<br>
<b>To:</b> Matic Kukovec<br>
<b>Cc:</b> pyqt@riverbankcomputing.com<br>
<b>Subject:</b> Re: [PyQt] Upgrading from static to dock widgets?</font>
<div> </div>
</div>
<div style="font-size:10pt">
<p style="margin-top: 0px; margin-bottom: 0px;margin-top:0px; margin-bottom:0px; margin-top:0; margin-bottom:0">
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.</p>
<p style="margin-top: 0px; margin-bottom: 0px;margin-top:0px; margin-bottom:0px; margin-top:0; margin-bottom:0">
<a href="https://github.com/richardjdare/Qt-Advanced-Docking-System" target="_blank" rel="noopener noreferrer">https://github.com/richardjdare/Qt-Advanced-Docking-System</a></p>
<p style="margin-top: 0px; margin-bottom: 0px;margin-top:0px; margin-bottom:0px; margin-top:0; margin-bottom:0">
Cheers,</p>
<p style="margin-top: 0px; margin-bottom: 0px;margin-top:0px; margin-bottom:0px; margin-top:0; margin-bottom:0">
-kyle</p>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div dir="ltr">
<div style="font-size:10pt">
<p style="margin-top: 0px; margin-bottom: 0px;margin-top:0px; margin-bottom:0px; margin-top:0; margin-bottom:0">
On 2019-06-26 05:33, Matic Kukovec wrote:</p>
<div style="color:black; font-size:12pt; font-family:Calibri,Helvetica,sans-serif">
Hi guys,</div>
<div style="color:black; font-size:12pt; font-family:Calibri,Helvetica,sans-serif">
 </div>
<div style="color:black; font-size:12pt; font-family:Calibri,Helvetica,sans-serif">
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="color:black; font-size:12pt; font-family:Calibri,Helvetica,sans-serif">
 </div>
<div style="color:black; font-size:12pt; font-family:Calibri,Helvetica,sans-serif">
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.</div>
<div style="color:black; font-size:12pt; font-family:Calibri,Helvetica,sans-serif">
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><span style="line-height:normal">from PyQt5.QtWidgets import *</span><span><br>
</span></span></span>
<div><span style="line-height:normal">from PyQt5.QtGui import *</span></div>
<div><span style="line-height:normal">from PyQt5.QtCore import *</span></div>
<div><span style="line-height:normal">import sys</span></div>
<div> </div>
<div><span style="line-height:normal">class Window(QMainWindow):</span></div>
<div><span style="line-height:normal">    def __init__(self):</span></div>
<div><span style="line-height:normal">        super().__init__()</span></div>
<div> </div>
<div><span style="line-height:normal">        title = "DockAble Application"</span></div>
<div><span style="line-height:normal">        top = 400</span></div>
<div><span style="line-height:normal">        left = 400</span></div>
<div><span style="line-height:normal">        width = 600</span></div>
<div><span style="line-height:normal">        height = 500</span></div>
<div> </div>
<div><span style="line-height:normal">        self.setWindowTitle(title)</span></div>
<div><span style="line-height:normal">        self.setGeometry(top,left, width, height)</span></div>
<div> </div>
<div><span style="line-height:normal">        self.dockAble()</span></div>
<div> </div>
<div><span style="line-height:normal">    def dockAble(self):</span></div>
<div><span style="line-height:normal">        for i in range(3):</span></div>
<div><span style="line-height:normal">            dock = QDockWidget("Test widget", self)</span></div>
<div><span style="line-height:normal">            dock.setAllowedAreas(Qt.AllDockWidgetAreas)</span></div>
<div><span style="line-height:normal">            self.addDockWidget(Qt.TopDockWidgetArea, dock)</span></div>
<div> </div>
<div><span style="line-height:normal">app = QApplication(sys.argv)</span></div>
<div><span style="line-height:normal">window = Window()</span></div>
<div><span style="line-height:normal">window.show()</span></div>
<span style="font-family:Calibri,Helvetica,sans-serif"><span style="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"> </span></span></div>
<div><span style="font-family:Calibri,Helvetica,sans-serif"><span style="font-size:12pt; line-height:normal">Thanks</span><span style="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="line-height:normal"><br>
</span></span></div>
<div> </div>
<br>
<div style="font-family:monospace; margin:0; padding:0">_______________________________________________<br>
PyQt mailing list    <a href="mailto:PyQt@riverbankcomputing.com" target="_blank" rel="noopener noreferrer">PyQt@riverbankcomputing.com</a><br>
<a href="https://www.riverbankcomputing.com/mailman/listinfo/pyqt" target="_blank" rel="noopener noreferrer">https://www.riverbankcomputing.com/mailman/listinfo/pyqt</a></div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
<div>Hey guys,</div>
<div><br>
</div>
<div>I've got the docking anywhere working correctly, didn't know that at least one widget inside a dockwidget is needed for the docking to work correctly.</div>
<div><br>
</div>
<div>Now I am trying to emulate the behavior of click&dragging the dockwidget's titlebar, by having it work exactly the same when click&dragging the dockwidget's child's tab bar. I'm working with this example:</div>
<blockquote style="margin-top: 0px; margin-bottom: 0px;">
<div><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>
<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><span style="font-size: 10pt; line-height: normal;">        self.setDockOptions(self.dockOptions() & ~QMainWindow.AnimatedDocks)</span><br>
</div>
<div><span style="font-size: 10pt; line-height: normal;">        self.setDockNestingEnabled(True)</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(4):</span><br>
</div>
<div><span style="font-size: 10pt; line-height: normal;">            dock = QDockWidget("Employee", self)</span><br>
</div>
<div><span style="font-size: 10pt; line-height: normal;">            dock.setFloating(False)</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.employee = ["John", "Doe", "Parwiz", "Bob"]</span><br>
</div>
<div><span style="font-size: 10pt; line-height: normal;">            tabw = QTabWidget(dock)</span><br>
</div>
<div><span style="font-size: 10pt; line-height: normal;">            listw = QListWidget(tabw)</span><br>
</div>
<div><span style="font-size: 10pt; line-height: normal;">            listw.addItems(self.employee)</span><br>
</div>
<div><span style="font-size: 10pt; line-height: normal;">            tabw.addTab(listw, "MyTab")</span><br>
</div>
<div><span style="font-size: 10pt; line-height: normal;">            dock.setWidget(tabw)</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><br>
</div>
</blockquote>
<div><br>
</div>
<div>Can anyone give me a hint of where to start?</div>
<div><br>
</div>
<div>Thanks,</div>
<div>Matic<br>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>