The naming convention for the automatic
"connectSlotsByName"<https://qt-project.org/doc/qt-4.8/qmetaobject.html#connectSlotsByName>should
be:
on_<object name>_<signal name>
So I would think your slot should be called: on_create_button_clicked()
But really, its so much easier to just ditch connectSlotsByName, name your
slots whatever you want, and hook them up yourself:
class designerUI(QtGui.QDialog):
def __init__(self, parent=getMayaWindow()):
super(designerUI, self).__init__(parent)
...
self.create_button.clicked(self.create_button_cb)
def create_button_cb(self):
print "linked"
On Thu, Jun 27, 2013 at 12:55 PM, John VanDerZalm <[email protected]
> wrote:
> hi all,
>
> so i'm trying to get a signal from a .ui desiger file to connect with a
> call which worked well in pyQt but pyside has the QUiLoader and i'm having
> trouble getting it to recognise a button. keeps on saying the object doesnt
> exist.
>
> has anyone used the QUiLoader and connected a button to a definition?
> the ui appears but nothing works
>
> here is what i have. i created a .ui dialog file with a single button and
> named "create_button"
> ###############
>
> import sys, os
> from PySide import QtGui, QtCore, QtUiTools
> from shiboken import wrapInstance
> from maya import OpenMayaUI, cmds, OpenMaya
>
>
> file = "D:\oneButtonTestDialog.ui"
>
> def getMayaWindow():
> ptr = OpenMayaUI.MQtUtil.mainWindow()
> if ptr is not None:
> return wrapInstance(long(ptr), QtGui.QMainWindow)
>
> class designerUI(QtGui.QDialog):
> def __init__(self, parent=getMayaWindow()):
> super(designerUI, self).__init__(parent)
> loader = QtUiTools.QUiLoader(self)
> widget = loader.load(file, self)
> QtCore.QMetaObject.connectSlotsByName(widget)
>
> widget.show()
>
> self.connect(self.create_button, QtCore.SIGNAL('clicked()'),
> self.create_button_cb)
> #old style signal
>
> def create_button_cb(self, *args):
> print "linked"
>
>
> designerUI()
>
> #############
>
>
>
> john
>
> --
> You received this message because you are subscribed to the Google Groups
> "Python Programming for Autodesk Maya" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
--
You received this message because you are subscribed to the Google Groups
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.