[Paraview] Extending pqAutoGeneratedObjectPanel for custom reader?

Karl König kkoenig11 at web.de
Mon Sep 28 18:46:22 EDT 2009


Hi,

I felt bold today and tried to extend the automatically created panel
for my custom reader. According to
http://www.paraview.org/Wiki/CustomObjectPanels,
http://www.paraview.org/Wiki/Plugin_HowTo#Adding_an_object_panel and
http://www.paraview.org/Wiki/images/8/8a/PV_Vis09_Tut_Plugins.pdf it
shouldn't be too difficult. For the ConePanel example everything worked
as expected, but it seems I'm doing something wrong when porting things
to a custom reader: Its panel isn't altered and the debugger shows that
the extra code is never visited. Hopefully someone can point me into the
right direction.

I changed the CMakeLists.txt (from the tarball in
http://www.paraview.org/pipermail/paraview/2009-September/013719.html,
just in case) to

[...]
IF (PARAVIEW_BUILD_QT_GUI)
    QT4_WRAP_CPP(MOC_SRCS pqFooReaderPanel.h)

    ADD_PARAVIEW_OBJECT_PANEL(IFACES IFACE_SRCS
      CLASS_NAME pqFooReaderPanel
      XML_NAME FooReader # name of SourceProxy in SM xml
      XML_GROUP sources
      )

    ADD_PARAVIEW_PLUGIN(FooReaderPlugin "0.1"
      SERVER_MANAGER_XML FooReaderSM.xml
      SERVER_MANAGER_SOURCES vtkFooReader.cxx
      GUI_INTERFACES ${IFACES}
      GUI_SOURCES ${MOC_SRCS} ${UI_SRCS} ${IFACE_SRCS}
      GUI_RESOURCE_FILES FooReaderGUI.xml
      )
ENDIF (PARAVIEW_BUILD_QT_GUI)
[...]

and added a file pqFooReaderPanel.h with

#ifndef __pqFooReaderPanel_h
#define __pqFooReaderPanel_h
#include "pqAutoGeneratedObjectPanel.h"
#include <QLabel>
#include <QLayout>

/// Custom panel for FooReader source.
/// This panel is only provided to add capabilities to hide/gray out
/// GUI elements in case they do not apply.
class pqFooReaderPanel : public pqAutoGeneratedObjectPanel
{
  Q_OBJECT;
  typedef pqAutoGeneratedObjectPanel Superclass;

public:
  pqFooReaderPanel(pqProxy *proxy, QWidget *p) :
    pqAutoGeneratedObjectPanel(proxy, p)
    {
      this->layout()->addWidget(new QLabel("This is from a plugin", this));
    }
  //virtual ~pqFooReaderPanel();

protected:
};
#endif //__pqFooReaderPanel_h

Having studied Qt/Components/pqClipPanel.cxx and
Qt/Components/pqGlyphPanel.cxx I think I know how to proceed from here,
but I cannot figure out how to tell PV to execute this tiny piece of
code when running my custom reader. I doubt I have to create the panel
from scratch using Qt Designer and providing a complete new *.ui file
for this purpose.

Thanks a lot in advance for any hints.
Karl


More information about the ParaView mailing list