[Paraview] Creating a PV 3 Plugin - qrc File

Clinton Stimpson clinton at elemtech.com
Wed Feb 20 19:49:52 EST 2008


You can create an instance of a vtkEventQtSlotConnect, and connect to 
the vtkSMProperty's ModifiedEvent for NumberOfSlices, and have it call a 
slot you make in your panel.
In that slot, you can call pqSMAdaptor::getElementProperty() and set 
that value on the QLabel.

pqProxyPanel has an example of using the vtkEventQtSlotConnect, and 
pqCalculatorPanel has an example of getElementProperty(), and setting it 
on a Qt widget.

It should be relatively simple since you're doing a read-only thing.

Clint

Mike Jackson wrote:
> Is there some sort of client/Qt code that I can implement in my GUI
> class to hook these up? I am looking at the pqExodusIIReader file and
> it looks like I should be able to do something... This is all new
> territory for me so I have no idea what I am looking at. Is possibly
> any sample code to look at that takes an int property from something
> and displays it in a QLabel on the GUI?
>
> thanks
> mike
>
> On Wed, Feb 20, 2008 at 7:04 PM,  <clinton at elemtech.com> wrote:
>   
>> If everything else went find, its probably because ParaView is looking for
>> a "textChanged()" signal on the QLabel, and its not there, so the link isn't
>> created.
>> I think we can bypass that for information properties, and otherwise spit out
>> a warning if the expected signal isn't found.
>>
>> You can verify that is what is happening by debugging in
>> pqNamedWidgets::propertyInformation().
>>
>> Clint
>>
>>
>> On Wednesday 20 February 2008 4:38:19 pm Mike Jackson wrote:
>>     
>>> OK. I got my VOI working and it seems to work because what I think are
>>> two reasons:
>>>
>>> 1) It is a Settable property
>>> 2) The values come from QLineEdits
>>>
>>> I have a bunch of other QLabels that are just "getters" to display
>>> some information that the reader gathers during RequestInformation.
>>> These values are NOT doing anything in the GUI.
>>>
>>> Here is a typical example:
>>>
>>> In the Server Manager XML file I have:
>>>
>>>       <IntVectorProperty name="NumberOfSlices"
>>>         command="GetNumberOfSlices" number_of_elements="1"
>>>         default_values="-1" information_only="1" >
>>>                 <SimpleIntInformationHelper />
>>>          </IntVectorProperty>
>>>
>>> In the Header of my Custom Reader I have:
>>> vtkGetMacro(NumberOfSlices, vtkTypeInt32);
>>>
>>> and in my .ui file that QLabel is named:
>>> NumberOfSlices.
>>>
>>> The default value doesn't even get used from the Server Manager XML.
>>> And turning on Debug for my custom reader tells me that the "Get***"
>>> Methods are never being called.
>>>
>>> So where did I screw this up?
>>>
>>> Thanks
>>> Mike
>>>
>>> On Wed, Feb 20, 2008 at 3:47 PM,  <clinton at elemtech.com> wrote:
>>>       
>>>> You have have multiple Qt widgets connected to one server manager
>>>> property. If you want the connection made between your widgets and the
>>>> server manager automatically, then suffix the Qt widget names with _0,
>>>> _1, _2 for which index of the property they are connected with.  If
>>>> you're going to set/get the values yourself, then you can name them
>>>> another way.
>>>>
>>>> Or if you want to make separate server manager properties, and have one
>>>> Qt widget for each, you'll have to have corresponding properties on your
>>>> filter.
>>>>
>>>> Clint
>>>>
>>>> On Wednesday 20 February 2008 12:59:10 pm Mike Jackson wrote:
>>>>         
>>>>> >From the ParaView wiki:
>>>>>
>>>>> "pqLoadedFormObjectPanel - if you want to design your form in the Qt
>>>>> Designer, you get a .ui file as a result. You can use this class to
>>>>> load the .ui file. If the names of widgets created in the Qt Designer
>>>>> correspond with server manager objects, they will automatically be
>>>>> hooked up"
>>>>>
>>>>> So, basically I need ServerManager XML for each "thing" I want to
>>>>> display in the gui?
>>>>>
>>>>> So I have a VOI that I am setting from the GUI. The QLineEdits are
>>>>> named "VOIXMin, VOIXMax.... ".
>>>>>
>>>>> Based on that I would need some xml in my server manager file
>>>>> like this:
>>>>>
>>>>>
>>>>>   <IntVectorProperty name="VOIXMin" command="SetVOIXMin"
>>>>>         number_of_elements="1" default_values="0" />
>>>>>
>>>>> ---
>>>>> Mike
>>>>>
>>>>> On Wed, Feb 20, 2008 at 2:33 PM, Mike Jackson <imikejackson at gmail.com>
>>>>>           
>>>> wrote:
>>>>         
>>>>>> On Wed, Feb 20, 2008 at 1:49 PM,  <clinton at elemtech.com> wrote:
>>>>>>             
>>>>>>> On Wednesday 20 February 2008 11:40:00 am Mike Jackson wrote:
>>>>>>>               
>>>>>>>> I was able to get plugins working on windows so I'll just work in
>>>>>>>> that env for a bit.
>>>>>>>>
>>>>>>>> Question: In my .qrc file I am not really sure what I should be
>>>>>>>> putting in there.
>>>>>>>>
>>>>>>>> Currently I have:
>>>>>>>>
>>>>>>>> <RCC>
>>>>>>>>     <qresource prefix="/ClientPlugin" >
>>>>>>>>         <file>pqH5RoboMetReader.ui</file>
>>>>>>>>     </qresource>
>>>>>>>> </RCC>
>>>>>>>>
>>>>>>>> The layout of my project is:
>>>>>>>>
>>>>>>>> PVRoboMet
>>>>>>>>   src
>>>>>>>>     ClientPlugin
>>>>>>>>        Resources
>>>>>>>>           pqH5RoboMetReader.qrc
>>>>>>>>           pqH5RoboMetReader.ui
>>>>>>>>
>>>>>>>>
>>>>>>>> I am not really sure what I should be putting for "qresource
>>>>>>>> prefix" ?
>>>>>>>>                 
>>>>>>> If you use pqLoadedFormObjectPanel in your plugin, it doesn't
>>>>>>> matter what your prefix is.
>>>>>>>
>>>>>>>               
>>>>>>>> When I try to load my plugin ParaView gives back a dialog that
>>>>>>>> says the plugin failed to load. ( Some actual text in that dialog
>>>>>>>> box would be useful)
>>>>>>>>                 
>>>>>>> Update your code.  Its been fixed in CVS today, so you'll get the
>>>>>>> reason for failure.
>>>>>>>
>>>>>>> Clint
>>>>>>>               
>>>>>> Things are working now. I just need to start hooking up my widgets to
>>>>>> start getting values from the server side. At least this all works on
>>>>>> windows. I have no idea what the deal on my OS X machine is (Either
>>>>>> 10.4 or 10.5).
>>>>>>
>>>>>>
>>>>>>
>>>>>> ---
>>>>>>             



More information about the ParaView mailing list