[Paraview] linking vtkSMStringVectorProperty to a SLOT
Utkarsh Ayachit
utkarsh.ayachit at kitware.com
Fri Apr 10 11:42:24 EDT 2009
IN that case you'll have to use a what's called an information helper.
Look at vtkSMInformationHelper and subclasses.
On Fri, Apr 10, 2009 at 11:04 AM, Nehme Bilal <nehmebilal at gmail.com> wrote:
> Thanks Utkarsh. This will solve the problem.
> I have another question:
> to get the array from the client, I implemented a method in my server
> side that look like this:
> void SetArrays(const char *array, int state).
> This works perfectly but what if my StringVectorProperty was an
> information_only property that I want to set in the server side and
> display in the client.
> How can I set the element of an information_only StringVectorProperty
> that looks like this in the server side: ?
> <StringVectorProperty
> name="Arrays"
> command="GetArrays"
> repeat_command="1"
> number_of_elements_per_command="2"
> element_types="2 0"
> information_only=1>
> </StringVectorProperty>
>
> Thank you,
> Nehme
>
>
>
> 2009/4/9 Utkarsh Ayachit <utkarsh.ayachit at kitware.com>:
>> There;s no direct way around this. You can handle it in use Qt code by
>> using a singleshot timer and calling some other slot only on idle.
>> Alternatively try to look at the code that's modifying the "Array"
>> property. Instead of using the SetElement() API, change it to using
>> the SetElements() API which modifies all elements and then fires the
>> modified event.
>>
>> Utkarsh
>>
>> On Thu, Apr 9, 2009 at 8:21 AM, Nehme Bilal <nehmebilal at gmail.com> wrote:
>>> Hi again,
>>>
>>> I found a way that seems to work, but I still have a problem.
>>> The StringVectorProperty I'm using look like this:
>>>
>>> <StringVectorProperty
>>> name="Arrays"
>>> command="SetArrays"
>>> repeat_command="1"
>>> number_of_elements_per_command="2"
>>> element_types="2 0">
>>> </StringVectorProperty>
>>>
>>> to connect this property to a Qt SLOT, I used:
>>>
>>> vtkSmartPointer<vtkEventQtSlotConnect> VTKConnect =
>>> vtkSmartPointer<vtkEventQtSlotConnect>::New();
>>> VTKConnect->Connect(arrays, vtkCommand::ModifiedEvent,
>>> this, SLOT(onArraysModified()));
>>>
>>> because repeat_command=1 the SLOT will be called every time an element
>>> is modified in the StringVectorProperty
>>> and that will cause a slow excecution if the number of elements in the
>>> StringVectorProperty is to big.
>>> Is there a way around this ?
>>>
>>> Thanks
>>>
>>> 2009/4/9 Nehme Bilal <nehmebilal at gmail.com>:
>>>> Hi All,
>>>>
>>>> I have a StringVectorProperty that I'm trying to link to a Qt SLOT in
>>>> the client side of my plugin. I want the SLOT to be called when the
>>>> StringVectorProperty is modified.
>>>> Is that possible ?
>>>>
>>>> Thanks you
>>>> Nehme
>>>>
>>> _______________________________________________
>>> Powered by www.kitware.com
>>>
>>> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>>>
>>> Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView
>>>
>>> Follow this link to subscribe/unsubscribe:
>>> http://www.paraview.org/mailman/listinfo/paraview
>>>
>>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView
>
> Follow this link to subscribe/unsubscribe:
> http://www.paraview.org/mailman/listinfo/paraview
>
More information about the ParaView
mailing list