Back to index

salome-paravis  6.5.0
Public Member Functions | Protected Slots | Protected Attributes
MyView Class Reference

a simple view that shows a QLabel with the display's name in the view More...

#include <MyView.h>

List of all members.

Public Member Functions

 MyView (const QString &viewtypemodule, const QString &group, const QString &name, vtkSMViewProxy *viewmodule, pqServer *server, QObject *p)
 constructor takes a bunch of init stuff and must have this signature to satisfy pqView
 ~MyView ()
bool saveImage (int, int, const QString &)
 don't support save images
vtkImageData * captureImage (int)
vtkImageData * captureImage (const QSize &)
QWidget * getWidget ()
 return the QWidget to give to ParaView's view manager
bool canDisplay (pqOutputPort *opPort) const
 returns whether this view can display the given source
void setBackground (const QColor &col)
 set the background color of this view
QColor background () const

Protected Slots

void onRepresentationAdded (pqRepresentation *)
 helper slots to create labels
void onRepresentationRemoved (pqRepresentation *)

Protected Attributes

QWidget * MyWidget
QMap< pqRepresentation
*, QLabel * > 
Labels

Detailed Description

a simple view that shows a QLabel with the display's name in the view

Definition at line 29 of file MyView.h.


Constructor & Destructor Documentation

MyView::MyView ( const QString &  viewtypemodule,
const QString &  group,
const QString &  name,
vtkSMViewProxy *  viewmodule,
pqServer *  server,
QObject *  p 
)

constructor takes a bunch of init stuff and must have this signature to satisfy pqView

Definition at line 32 of file MyView.cxx.

 : pqView(viewmoduletype, group, name, viewmodule, server, p)
{
  // our view is just a simple QWidget
  this->MyWidget = new QWidget;
  this->MyWidget->setAutoFillBackground(true);
  new QVBoxLayout(this->MyWidget);

  // connect to display creation so we can show them in our view
  this->connect(this, SIGNAL(representationAdded(pqRepresentation*)),
    SLOT(onRepresentationAdded(pqRepresentation*)));
  this->connect(this, SIGNAL(representationRemoved(pqRepresentation*)),
    SLOT(onRepresentationRemoved(pqRepresentation*)));
}

Here is the call graph for this function:

Definition at line 52 of file MyView.cxx.

{
  delete this->MyWidget;
}

Member Function Documentation

QColor MyView::background ( ) const

Definition at line 91 of file MyView.cxx.

{
  return this->MyWidget->palette().color(QPalette::Window);
}
bool MyView::canDisplay ( pqOutputPort *  opPort) const

returns whether this view can display the given source

Definition at line 96 of file MyView.cxx.

{
  pqPipelineSource* source = opPort? opPort->getSource() : 0;
  // check valid source and server connections
  if(!source ||
     this->getServer()->GetConnectionID() !=
     source->getServer()->GetConnectionID())
    {
    return false;
    }

  // we can show MyExtractEdges as defined in the server manager xml
  if(QString("MyExtractEdges") == source->getProxy()->GetXMLName())
    {
    return true;
    }

  return false;
}
vtkImageData* MyView::captureImage ( int  ) [inline]

Definition at line 45 of file MyView.h.

{ return NULL; }
vtkImageData* MyView::captureImage ( const QSize &  ) [inline]

Definition at line 46 of file MyView.h.

{ return NULL; }
QWidget * MyView::getWidget ( )

return the QWidget to give to ParaView's view manager

Definition at line 58 of file MyView.cxx.

{
  return this->MyWidget;
}
void MyView::onRepresentationAdded ( pqRepresentation *  d) [protected, slot]

helper slots to create labels

Definition at line 63 of file MyView.cxx.

{
  // add a label with the display id
  QLabel* l = new QLabel(
    QString("Display (%1)").arg(d->getProxy()->GetSelfIDAsString()), 
    this->MyWidget);
  this->MyWidget->layout()->addWidget(l);
  this->Labels.insert(d, l);
}

Here is the caller graph for this function:

void MyView::onRepresentationRemoved ( pqRepresentation *  d) [protected, slot]

Definition at line 73 of file MyView.cxx.

{
  // remove the label
  QLabel* l = this->Labels.take(d);
  if(l)
    {
    this->MyWidget->layout()->removeWidget(l);
    delete l;
    }
}

Here is the caller graph for this function:

bool MyView::saveImage ( int  ,
int  ,
const QString &   
) [inline]

don't support save images

Definition at line 44 of file MyView.h.

{ return false; }
void MyView::setBackground ( const QColor &  col)

set the background color of this view

Definition at line 84 of file MyView.cxx.

{
  QPalette p = this->MyWidget->palette();
  p.setColor(QPalette::Window, c);
  this->MyWidget->setPalette(p);
}

Member Data Documentation

QMap<pqRepresentation*, QLabel*> MyView::Labels [protected]

Definition at line 66 of file MyView.h.

QWidget* MyView::MyWidget [protected]

Definition at line 65 of file MyView.h.


The documentation for this class was generated from the following files: