calling mainwindow in constructor
-
Hi,
i am kind of new to c++ syntax, so my question is:
- I have a mainwindow running
- i create an object called graph in mainwindow
- this "graph" has to use the graphicsscene of my mainwindow
I tried it this way:
In graph.cppgraph::graph(MainWindow w){ this->mainW = w; }
In graph.h
class graph { public: graph(MainWindow w); ~graph(); typedef map<int, vertex *> vmap; vmap work; MainWindow mainW;
I get the following error
C:\Users\Nutzer\Documents\BlossomAlgorithm\graph.h:54: Fehler: expected ')' before 'w' graph(MainWindow w); ^ C:\Users\Nutzer\Documents\BlossomAlgorithm\graph.h:59: Error: 'MainWindow' does not name a type MainWindow mainW; ^
So how do i use it correctly?
PS: Sry for newbie question :)
[edit:koahnig] code tags added
-
Did you follow one of the examples e.g. the application example?
For your example possibly you have not included the header where you define your derived MainWindow class. Possibly you need to add #include "MainWindow.h" in "graph.h" However, this depends on more things e.g. filenaming and others. So it is a kind of wild guess.