-1
我使用Maya 2016 + PyQt4.8PyQt在Maya中的可停靠窗口
我创建了一个简单的窗口。它的工作。但我想让对话框可以停靠。
import sip
import maya.OpenMayaUI as mui
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyQt4 import uic
import maya.cmds as cmds
#----------------------------------------------------------------------
def getMayaWindow():
ptr = mui.MQtUtil.mainWindow()
return sip.wrapinstance(long(ptr), QObject)
#----------------------------------------------------------------------
class SetTreeOnSplines(QDialog):
def __init__(self, parent=getMayaWindow()):
super(SetTreeOnSplines, self).__init__(parent)
uic.loadUi('X:/tools/Maya/windows/2016/python/setTree.ui', self)
#----------------------------------------------------------------------
# window
def setTree():
formCollect = SetTreeOnSplines()
formCollect.show()
#----------------------------------------------------------------------
# MAIN
setTree()
如何修改脚本使用PyQt的对话框是可停靠的?
其对接。 TNX。但函数closeEvent(self,evnt)停止工作... – MaxKu
和函数self.geometry()返回[0,0,w,h] - 0,0到位置窗口... – MaxKu
使用可停靠的小部件,我相信你必须改用'dockCloseEventTriggered'。 –