I'm not aware of another way to connect the old style besides the auto
connect by name feature.
The new style involves you defining a real python object as a signal
attribute on the class.
 On Mar 3, 2013 11:21 PM, "Panupat Chongstitwattana" <[email protected]>
wrote:

> Thanks again for the link Justin :)
>
> I have another question. Say I emit my own signal
> SIGNAL("panupat(blah)", blah)
>
> Is there a way to connect it using the new style?
> ui.myWidget.panupat.connect..... always give me error that panupat doesn't
> exist
>
> but I can use the old style to connect it
> ui.connect(myWidget, SIGNAL("panupat(blah)"), someMethod)
>
> I think I read somewhere about an "accept signal" method, is that what I
> need to do?
>
>
>
> On Sun, Mar 3, 2013 at 5:02 PM, Justin Israel <[email protected]>wrote:
>
>> currentIndexChanged() signal can do either an int index, or a string. But
>> because it is a signal, you can't really be sure where the underlying C++
>> code is emitting. It could be from multiple methods. Normally what you look
>> for in the documentation is for it to say a method is virtual and should be
>> reimplemented in subclasses for xyz custom functionality.
>>
>> In this current example, one way to approach a solution would be to just
>> connect the currentIndexChanged() signal to a private method on your
>> subclass, and emit some other signal.
>>
>> And if you are interested in knowing the underlying code of Qt widgets,
>> you can look at the C++ source code (since as you have discovered, the
>> PyQt4 modules are compiled objects):
>>
>> http://qt.gitorious.org/qt/qt/blobs/6248dff2c7f3288d675de639abfbbc6c1d618006/src/gui/widgets/qcombobox.cpp
>>
>>
>>
>>
>> On Mar 3, 2013, at 10:49 PM, Panupat Chongstitwattana wrote:
>>
>> For example, QComboBox currentIndexChanged signal give me an index. If I
>> want the signals to give additional values (maybe some string), which
>> method am I looking for?
>>
>>
>>
>> On Sun, Mar 3, 2013 at 4:33 PM, Justin Israel <[email protected]>wrote:
>>
>>> It just means c++ knows about it as a real slot.
>>>
>>> What do you mean by finding a list of methods exactly? All methods are
>>> documented in the api docs. Can you give an example of what you want to do?
>>>  On Mar 3, 2013 9:53 PM, "Panupat Chongstitwattana" <[email protected]>
>>> wrote:
>>>
>>>> Thanks for the link Justin.
>>>>
>>>> I don't quite understand what C++ signature does but I'll leave it at
>>>> that :D
>>>>
>>>> That page does bring up another topic I've always wonder about. It
>>>> shows sample of sub classing QComboBox and over ride signal emitters in the
>>>> handle_int and handle_string method. How can I find out more about methods
>>>> available in each widget so I can over ride it in my own class? The code
>>>> included with PyQt installation seems to be in binary.
>>>>
>>>>
>>>>
>>>> On Sun, Mar 3, 2013 at 3:24 PM, Justin Israel 
>>>> <[email protected]>wrote:
>>>>
>>>>> Pyqt4 let's you use any python callable as a slot. The decorator
>>>>> actually defines a c++ signature for it as a registered slot
>>>>>
>>>>>
>>>>> http://pythonxy.googlecode.com/hg-history/4ef4255f59b092a123a5788c821434d9fe94aee9/src/python/PyQt4/PLATLIB/PyQt4/doc/html/new_style_signals_slots.html#the-pyqtslot-decorator
>>>>>
>>>>> " Although PyQt allows any Python callable to be used as a slot when
>>>>> connecting signals, it is sometimes necessary to explicitly mark a Python
>>>>> method as being a Qt slot and to provide a C++ signature for it."
>>>>> ...
>>>>> " Connecting a signal to a decorated Python method also has the
>>>>> advantage of reducing the amount of memory used and is slightly faster."
>>>>>  On Mar 3, 2013 9:06 PM, "Panupat Chongstitwattana" <
>>>>> [email protected]> wrote:
>>>>>
>>>>>> Hi.
>>>>>>
>>>>>> I'm experimenting with some code and I'm curious what the
>>>>>> @QtCore.pyqtSlot() decoration does?
>>>>>> I saw it from some other codes, but even without it, testdef() still
>>>>>> returns the widget's name correctly.
>>>>>>
>>>>>>
>>>>>> from PyQt4 import QtGui, QtCore
>>>>>>
>>>>>> class cb(QtGui.QComboBox):
>>>>>>
>>>>>>  def __init__(self):
>>>>>>  super(cb, self).__init__()
>>>>>> self.setObjectName("test name")
>>>>>> self.currentIndexChanged.connect(self.testdef)
>>>>>> for i in range(5):
>>>>>> self.addItem(str(i))
>>>>>>
>>>>>> @QtCore.pyqtSlot()
>>>>>>
>>>>>> def testdef(obj):
>>>>>>  print str(obj.sender().objectName())
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> 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.
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> 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.
>>>
>>>
>>>
>>
>>
>> --
>> 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.
>>
>>
>>
>
>  --
> 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.


Reply via email to