[Paraview] Re : Problem -> How to display informations in a plugin GUI ?
R M
mlokida at yahoo.fr
Mon Dec 20 11:22:57 EST 2010
Hi,
I have not yet found the solution.I have followed this example:
http://www.paraview.org/pipermail/paraview/2008-November/010217.html but still
have problems.
In my plugin xml file I have this:
<DoubleVectorProperty
show="1"
name="Result"
label="Result
command="GetResult"
number_of_elements="1"
default_values="0"
information_only="1">
<SimpleDoubleInformationHelper />
</DoubleVectorProperty>
In my plugin source file, I have this:
double GetResult()
{
return m_result;
}
I have a class that inherit from pqAutoGeneratedObjectPanel:
#include "MyPluginPanel.h"
#include <QLineEdit>
#include "vtkSMDoubleVectorProperty.h"
#include "vtkSMProperty.h"
#include "vtkSMProxy.h"
MyPluginPanel::MyPluginPanel(pqProxy* object_proxy, QWidget* _parent)
:pqAutoGeneratedObjectPanel(object_proxy, _parent)
{
p_resultWidget = this->findChild<QLineEdit*>("Result");
if( this->findChild<QLineEdit*>("Resylt") )
{
qWarning() << "NULL Widget Pointer";
return;
}
p_resultWidget->setReadOnly(true);
}
MyPluginPanel::~MyPluginPanel()
{}
void MyPluginPanel::updateInformationAndDomains()
{
pqAutoGeneratedObjectPanel::updateInformationAndDomains();
updateDoubleValue(p_resultWidget, "Result", 0);
}
void MyPluginPanel::updateDoubleValue(QLineEdit* qLineEdit, QString property,
qint32 index)
{
vtkSMProperty* smProperty = this->proxy()->GetProperty(property.toAscii());
if (!smProperty)
{
qWarning() << "SMProperty [double] was NULL for " << property.toAscii();
return;
}
vtkSMDoubleVectorProperty* dvp =
vtkSMDoubleVectorProperty::SafeDownCast(smProperty);
double value = dvp->GetElement(index);
qLineEdit->setText(QString::number(value));
}
The problem is that the widget resultWidget is always NULL. But I can have the
good result.
So, what's wrong with my code ?
Why the widget doesn't appear in the GUI plugin in Paraview ?
Thank you for your attention and your advice.
________________________________
De : R M <mlokida at yahoo.fr>
À : paraview at paraview.org
Envoyé le : Mer 15 décembre 2010, 10h 12min 20s
Objet : [Paraview] Problem -> How to display informations in a plugin GUI ?
Hi,
I develop a plugin that and in its corresponding xml file, I have a
doubleVectorProperty in which I would like to write the result of my filter and
I don't want to make it editable.
So, I am looking for some examples of doing this beacause I really don't know
how to do this and that make a while I want to make it. I have found nothing
about this in the Paraview Guide book.
Here's what I have written in the plugin xml file:
<DoubleVectorProperty
name="GetResult"
command="GetResult"
information_only="1">
<SimpleDoubleInformationHelper/>
</DoubleVectorProperty>
<DoubleVectorProperty
name="Result"
command="SetResult
number_of_elements="1"
default_values="0.0"
information_property="GetResult">
</DoubleVectorProperty>
and the code in the source is:
double GetResult()
{
return m_result;
}
void SetResult(double value)
{
m_result = value;
}
Then, in my code, when I would like to update this lineedit in the plugin GUI I
call SetResult(myResult). But nothing happen and the lineedit in the plugin GUI
is editable (which I don't want).
Thank you for your advise.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20101220/0fdfbb52/attachment-0001.htm>
More information about the ParaView
mailing list