Inherit MainWindow class?
-
wrote on 10 Oct 2013, 08:10 last edited by
How does one inherit MainWindow class into another class? It is labled as explicit.
Is there a workaround?
-
Hi,
Simply by inheriting it like any other class.
The explicit keyword doesn't forbid that at all
-
wrote on 11 Oct 2013, 05:54 last edited by
Could you show me an example plaease? inheriting MainWindow
-
wrote on 11 Oct 2013, 06:25 last edited by
@class YourClass : public QMainWindow
{
....
};@ -
wrote on 11 Oct 2013, 09:18 last edited by
So the MainWindow class is the same as QMainWindow?
-
wrote on 11 Oct 2013, 09:52 last edited by
which MainWindow class are you talking about?
-
wrote on 11 Oct 2013, 11:55 last edited by
No, MainWindow is just a class name. Usually it's the name that QtCreator makes for you when you generate a new QtGui project. The MainWindow class will inherit the QMainWindow.
-
wrote on 11 Oct 2013, 21:45 last edited by
[quote author="Jeroentje@home" date="1381492543"]No, MainWindow is just a class name. Usually it's the name that QtCreator makes for you when you generate a new QtGui project. The MainWindow class will inherit the QMainWindow.
[/quote]Right, that MainWindow class that QtGui generates is the class I want to inherit. How do I inherit MainWindow class?
-
The same way Jeroentje@home described.
Based on your questions ( "e.g. this thread":https://qt-project.org/forums/viewthread/33488/ ), I would recommend you to have a look at Qt's example/demos/tutorials and documentation as well as a good book on C++. This will help you get started.
-
wrote on 11 Oct 2013, 23:18 last edited by
[quote author="SGaist" date="1381528496"]The same way Jeroentje@home described.
Based on your questions ( "e.g. this thread":https://qt-project.org/forums/viewthread/33488/ ), I would recommend you to have a look at Qt's example/demos/tutorials and documentation as well as a good book on C++. This will help you get started.[/quote]
I know how to inherit in C++ but for some reason I get errors when I inherit MainWindow class.
-
What errors are you getting ?
1/11