[vtkusers] Re: Best vtk / QT package?
Stefan Bruckner
stefan.bruckner at chello.at
Thu Sep 5 18:17:51 EDT 2002
Ok, I included the essential parts of my classes in this mail. It's very
easy.
This requires VTK_QT
(http://wwwipr.ira.uka.de/~kuebler/vtkqt/index.html) in your project.
There are two classes: jzRenderFrame (derived from QFrame), a framed
widget that resizes the vtkRenderWindow when it is resized.
vtkRenderWidget contains a QGridLayout which can contain as many
jzRenderFrames (as well es other elements) as you want.
I hope this helps you!
--
Stefan Bruckner
---------------------
-- jzRenderFrame.h --
---------------------
#ifndef JZRENDERFRAME_H
#define JZRENDERFRAME_H
#include <qwidget.h>
#include <qframe.h>
#include <vtkRenderWindow.h>
#include <vtkQtObjectFactory.h>
/**A single framed VTK window
*@author Stefan Bruckner, Rudolf Seemann
*/
class jzRenderFrame : public QFrame
{
Q_OBJECT
public:
jzRenderFrame(QWidget *parent=0, const char *name=0);
~jzRenderFrame();
/** Returns the associated render window */
vtkRenderWindow* GetRenderWindow();
protected slots: // Protected slots
/** Internally used for the minimize/maximize/restore mechanism when
in attach mode. */
virtual void resizeEvent (QResizeEvent *e);
private: // Private attributes
/** the render window */
vtkRenderWindow *m_pRenderWindow;
};
#endif
----------------------
-- jzRenderFrame.cpp -
----------------------
#include "jzrenderframe.h"
#include <vtkRenderWindow.h>
#include <vtkQtObjectFactory.h>
#include <vtkConeSource.h>
#include <vtkPolyDataMapper.h>
#include <vtkRenderWindowInteractor.h>
#include <qlabel.h>
jzRenderFrame::jzRenderFrame(QWidget *parent, const char *name ) :
QFrame(parent,name)
{
m_pRenderWindow = vtkRenderWindow::New();
vtkQtObjectFactory::SetQtBase(this, NULL);
m_pRenderWindow->Start();
// Set frame style
setFrameStyle( QFrame::StyledPanel );
setLineWidth(3);
setFrameShadow(Sunken);
}
jzRenderFrame::~jzRenderFrame()
{
}
/** Returns the associated render window */
vtkRenderWindow* jzRenderFrame::GetRenderWindow()
{
return m_pRenderWindow;
}
/** Internally used for the minimize/maximize/restore mechanism when in
attach mode. */
void jzRenderFrame::resizeEvent (QResizeEvent *e)
{
QWidget* widget = vtkQtObjectFactory::QtWidget(m_pRenderWindow);
if (widget != NULL)
{
widget->setGeometry(contentsRect());
}
}
---------------------
-- jzrenderwidget.h -
---------------------
#ifndef JZRENDERWIDGET_H
#define JZRENDERWIDGET_H
#include <qframe.h>
#include <qlayout.h>
#include <vector>
#include <vtkRenderWindow.h>
/**This widget contains multipile VTK render windows in a grid layout
*@author Stefan Bruckner, Rudolf Seemann
*/
class jzRenderWidget : public QFrame {
Q_OBJECT
public:
jzRenderWidget(QWidget *parent = 0, const char *name = 0, WFlags f =
0);
~jzRenderWidget();
private: // Private attributes
/** Layout manager for the widget */
QGridLayout *m_pGridLayout;
};
#endif
-----------------------
-- jzrenderwidget.cpp -
-----------------------
#include "jzrenderwidget.h"
#include "jzrenderframe.h"
#include <qpushbutton.h>
jzRenderWidget::jzRenderWidget(QWidget *parent, const char *name, WFlags
f = 0) : QFrame(parent,name,f)
{
// Create a new grid layout
m_pGridLayout = new QGridLayout(this,2,1,5,5,"Grid");
// Add a few render frames
jzRenderFrame *frame1 = new jzRenderFrame(this);
m_pGridLayout->addWidget(frame1,0,0);
jzRenderFrame *frame2 = new jzRenderFrame(this);
m_pGridLayout->addWidget(frame2,1,0);
// Do your own stuff using the jzRenderFrame::GetRenderWindow() method
}
jzRenderWidget::~jzRenderWidget()
{
}
Am Fre, 2002-09-06 um 02.22 schrieb Julien Jomier:
> Thanks !
>
> Could you, by chance, send me your classes ? That would
> help me a lot.
>
> Thanks again
>
> Julien
>
> ----- Original Message -----
> From: "Stefan Bruckner" <stefan.bruckner at chello.at>
> To: "Julien Jomier" <jjomier at cs.unc.edu>
> Sent: Thursday, September 05, 2002 2:18 PM
> Subject: Re: [vtkusers] Re: Best vtk / QT package?
>
>
> > What I did is write a vtkRenderWidget class (using VTK_QT) which resizes
> > the vtkRenderwindow on an resize Event.
> >
> > Another widgets contains a QGridLayout, to which I can add as many
> > vtkRenderWidgets as I want and resize correctly. Works very good ...
> >
> > --
> > Stefan Bruckner
> >
> > > Hi,
> > >
> > > Did anybody succeed in having two VTKRenderWindows in the same Qt window
> ?
> > > (using VTK 4)
> > > if yes I'm very interested :)
> > >
> > > Thanks for your help
> > >
> > > Julien
> > >
> > > ----- Original Message -----
> > > From: "Stefan Bruckner" <stefan.bruckner at chello.at>
> > > To: <vtkusers at public.kitware.com>
> > > Sent: Thursday, September 05, 2002 1:25 PM
> > > Subject: [vtkusers] Re: Best vtk / QT package?
> > >
> > >
> > > > I've examined nearly all of the packages out there, most of them are
> > > > pretty outdated. The best and probably most current (VTK 4, QT 3) is
> > > > VTK_QT by Carsten Kuebler.
> > > >
> > > > Source is provided in an MS Visual Studio project, but I've managed to
> > > > compile it under Linux within minutes without problems.
> > > >
> > > > Download: http://wwwipr.ira.uka.de/~kuebler/vtkqt/index.html
> > > >
> > > > --
> > > > Stefan Bruckner
> > > >
> > > >
> > > > > I am trying to get vtk and qt working properly.
> > > > >
> > > > > Which is the best vtk/qt package available?
> > > > > Which has the best chance of being supported in the future?
> > > > > Which should I avoid altogether? (maybe too old to work with newer
> > > > > versions?)
> > > > >
> > > > > I appreciate all help and opinions!
> > > > >
> > > > > Thanks,
> > > > > Alex Lear
> > > > >
> > > > > _______________________________________________
> > > > > This is the private VTK discussion list.
> > > > > Please keep messages on-topic. Check the FAQ at:
> > > > <http://public.kitware.com/cgi-bin/vtkfaq>
> > > > > Follow this link to subscribe/unsubscribe:
> > > > > http://public.kitware.com/mailman/listinfo/vtkusers
> > > >
> > > >
> > > >
> > > >
> > > > _______________________________________________
> > > > This is the private VTK discussion list.
> > > > Please keep messages on-topic. Check the FAQ at:
> > > <http://public.kitware.com/cgi-bin/vtkfaq>
> > > > Follow this link to subscribe/unsubscribe:
> > > > http://public.kitware.com/mailman/listinfo/vtkusers
> > >
> > > _______________________________________________
> > > This is the private VTK discussion list.
> > > Please keep messages on-topic. Check the FAQ at:
> <http://public.kitware.com/cgi-bin/vtkfaq>
> > > Follow this link to subscribe/unsubscribe:
> > > http://public.kitware.com/mailman/listinfo/vtkusers
> >
> >
>
More information about the vtkusers
mailing list