get position of a dockable widget in python

morten_bohne
Advocate
Advocate

get position of a dockable widget in python

morten_bohne
Advocate
Advocate

I'm trying to make a Pyside widget dockable to the main max window. Since i'm working in max17, as far as i can see, my only option is using MaxPlus.MakeQWidgetDockable

 

But after setting the widget to dockable, the normal pyside calls to geometry(), pos() etc stops working:

 

from PySide import QtGui, QtCore
import MaxPlus

class TestWindow(QtGui.QWidget):

    def __init__(self, parent):
        super(TestWindow, self).__init__(parent)
        # make dockable to right side
        MaxPlus.MakeQWidgetDockable(self, 8)
        self.main_layout = QtGui.QVBoxLayout()
        self.setLayout(self.main_layout)
        self.label = QtGui.QLabel("This window docks right")
        self.main_layout.addWidget(self.label)
        self.show()

w = TestWindow(parent=MaxPlus.GetQMaxWindow())
print w.pos()

 

 

>> PySide.QtCore.QPoint(0, 0)

and after moving the window around, printing the pos again will continue to return:

 

 

PySide.QtCore.QPoint(4, 4)

 

 

Any ideas or workarounds to how i can allow my users to dock the window, but if they haven't, store the window-geometry using QtCore.QSettings?

Reply
698 Views
4 Replies
Replies (4)

richecoeur.m
Explorer
Explorer

Hi, did you find a workaround 🙂

0 Likes

morten_bohne
Advocate
Advocate

Not sure, and I have changed job since that, so can't really go back and check. (Think it's been a year since last time i opened Max 😃)

As I recall, I ended up only storing the geometry if the widget isn't dockable.

 

-Hope you find a better solution

richecoeur.m
Explorer
Explorer

Okay 😄 i will just make my widget float then. I tried to hack the thing, but without success... i will just wait for my studio to upgrade our 3dsmax  .Thank you for your response after all these years! 

0 Likes

garrygoldberg1
Contributor
Contributor

I see you have strong knowledge of programming. I have one business project. It's a dating app. Please, write me if want to help.

0 Likes