[vtkusers] vtkInteractorStyleImage and QT Widget

David Doria daviddoria at gmail.com
Tue Sep 4 09:44:51 EDT 2012


> If I do so, I get (as I would expect) an error like that: error: invalid use of incomplete type 'struct CustomWidget' each time the code point to a public member of the CustomWidget...
>
> I'd like to provide you a compilable file but they are extracted from a very huge project so unfortunately it'll take time...
>
> Alessandro


It should work as long as you are just storing a pointer of one class
in the other (which you are). This is the pattern:

class ClassB;

class ClassA
{
  ClassB* classB;
};

class ClassB
{
  int data;
};

int main(int argc, char *argv[])
{
  ClassA classA;
  ClassB classB;

  return 0;
}

Also, why are you declaring CustomWidget inside of Ui as well as outside of Ui :

namespace Ui {
    class CustomWidget;
}

class CustomWidget : public QWidget
{
    Q_OBJECT
...

?

David



More information about the vtkusers mailing list