Inherit MainWindow class?
-
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
-
Could you show me an example plaease? inheriting MainWindow
-
@class YourClass : public QMainWindow
{
....
};@ -
So the MainWindow class is the same as QMainWindow?
-
which MainWindow class are you talking about?
-
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 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.
-
[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 ?