You're probably right. Also shows why it was such a bad idea in the first
place.

Thanks Marcus.



On Thu, Jun 5, 2014 at 6:43 PM, Marcus Ottosson <[email protected]>
wrote:

> It may be that there are widgets on top of the widget you are
> monkey-patching that intercepts and accepts press events before it reaches
> your custom function.
>
>
> On 5 June 2014 16:39, Risto Jankkila <[email protected]> wrote:
>
>> Hi Marcus,
>>
>> "my_func" would be any function I would like to use to override
>> mousePressEvent-method.
>>
>> My colleague pointed out that event filters are a better way of doing
>> this sort of thing, but I still wonder why this doesn't work with
>> swatchDisplayPorts.
>>
>> Cheers,
>> Risto
>>
>>
>> On Thu, Jun 5, 2014 at 4:48 PM, Marcus Ottosson <[email protected]>
>> wrote:
>>
>>> Hi Risto,
>>>
>>> What is "my_func"?
>>>
>>>
>>> On 5 June 2014 10:49, Risto Jankkila <[email protected]> wrote:
>>>
>>>> Hi,
>>>>
>>>> I'm trying to execute a function when user clicks a swatchDisplayPort
>>>> that's inside a Qt-window.
>>>>
>>>> Currently my code looks something like this:
>>>>
>>>> swatch_name = cmds.swatchDisplayPort(rs=64, wh=[64, 64], sn="lambert1")
>>>> ptr = OpenMayaUI.MQtUtil.findControl(swatch_name)
>>>> swatch_widget = shiboken.wrapInstance(long(ptr), QtGui.QWidget)
>>>> swatch_widget.mousePressEvent = my_func
>>>>
>>>> I can get this to work on other Qt-objects (ie. labels) but not with
>>>> swatchDisplayPorts.
>>>> Any help would be greatly appreciated.
>>>>
>>>> Cheers,
>>>> Risto
>>>>
>>>>  --
>>>> 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 view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/python_inside_maya/CA%2B5uDBZ2J8vPY%3Do6i3MgsZz5u_GzUwM3T4jU0wYAS5zehhMk9Q%40mail.gmail.com
>>>> <https://groups.google.com/d/msgid/python_inside_maya/CA%2B5uDBZ2J8vPY%3Do6i3MgsZz5u_GzUwM3T4jU0wYAS5zehhMk9Q%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>> .
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>>
>>>
>>> --
>>> *Marcus Ottosson*
>>> [email protected]
>>>
>>> --
>>> 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 view this discussion on the web visit
>>> https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOC_wHdZpKNLmAuGqUNARTJ7BVGTBJ4WSR%2BFET8DOaPLWw%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOC_wHdZpKNLmAuGqUNARTJ7BVGTBJ4WSR%2BFET8DOaPLWw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> --
>> -------------------------------------------
>> Risto Jankkila
>> mob. +44 (0)77 6741 9890 (UK)
>> mob. +358 (0)40 5422 625 (FI) <[email protected]>
>> [email protected]
>> -------------------------------------------
>>
>>  --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/python_inside_maya/CA%2B5uDBa%3D02BkjDV5jV7iMvXORP6tQNbi4xxFgsAvh7NS%3DhfrTA%40mail.gmail.com
>> <https://groups.google.com/d/msgid/python_inside_maya/CA%2B5uDBa%3D02BkjDV5jV7iMvXORP6tQNbi4xxFgsAvh7NS%3DhfrTA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> *Marcus Ottosson*
> [email protected]
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOBG8%2B3u1zeO7MgUmrz-K2VnyOxaf1Gf4ovxfn4TFfovcw%40mail.gmail.com
> <https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOBG8%2B3u1zeO7MgUmrz-K2VnyOxaf1Gf4ovxfn4TFfovcw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
-------------------------------------------
Risto Jankkila
mob. +44 (0)77 6741 9890 (UK)
mob. +358 (0)40 5422 625 (FI) <[email protected]>
[email protected]
-------------------------------------------

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CA%2B5uDBZZDNOARY9rbXrwQ9XV%3D8788A75OyZfzE_tCNT6MCkJmA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to