[vtkusers] vtkInteractorStyleImage and QT Widget

David Doria daviddoria at gmail.com
Tue Sep 4 09:06:46 EDT 2012


On Tue, Sep 4, 2012 at 8:57 AM, Ale <notinmyhead at gmail.com> wrote:
> sorry I miss the attachment...
> #ifndef CUSTOMWIDGET_H
> #define CUSTOMWIDGET_H
>
> #include <QWidget>
>
> /* include custom Interactor */
> #include "custominteractorstyle.h"
>
> namespace Ui {
>     class CustomWidget;
> }
>
> class CustomWidget : public QWidget
> {
>     Q_OBJECT
>
> public:
>     explicit CustomWidget(QWidget *parent = 0, vtkImageData * image = NULL, QString wtitle = QString::null);
>
>     ~CustomWidget();
>
>   ...
>
> public slots:
>   ...
>
> protected:
>    ...
>
> private:
>     Ui::CustomWidget *ui;
>
>   ....
>
> };
>
> #endif //CUSTOMWIDGET_H
>
>
> #ifndef CUSTOMINTERACTORSTYLE_H
> #define CUSTOMINTERACTORSTYLE_H
>
> #include <QWidget>
>
> #include "customwidget.h"
>
> class CustomInteractorStyle : public vtkInteractorStyleImage
> {
> public:
>     CustomInteractorStyle ();
>
>     static CustomInteractorStyle * New();
>     vtkTypeMacro(CustomInteractorStyle, vtkInteractorStyleImage)
>
> protected:
>
>     std::vector < CustomWidget * > widgets;
>
> public:
>     ...
>
> private:
>    ...
>
> protected:
>     virtual void OnKeyDown();
>     virtual void OnMouseWheelBackward();
>     virtual void OnMouseWheelForward();
>     virtual void OnRightButtonDown();
> };
>
> vtkStandardNewMacro(CustomInteractorStyle)
>
> #endif // CUSTOMINTERACTORSTYLE_H

In CustomInteractorStyle.h, you should forward declare CustomWidget.
That is, replace this line:

#include "customwidget.h"

with

class CustomWidget;

Let us know if it works. If it does not, please provide a minimal
compilable example so we can reproduce the error (a single file that
we can copy+paste+compile).

David



More information about the vtkusers mailing list