Inheritance forms with QUiLoader
-
wrote on 17 May 2014, 02:20 last edited by
How do inheritance forms, using QUiLoader?
@ class MainWindow : public WidgetGeneratedByLoader
{public: explicit MainWindow(QWidget *parent = 0); }
@
-
I'm not sure what you mean, but c++ is statically typed language. This means a concept of classes or inheritance is compiled away (apart from rtti and Qt meta system).
QUiLoader loads Uis at runtime and only instantiates already defined classes. Inheriting from dynamically loaded class would mean dynamically creating new type, which, again, c++ doesn't do. -
wrote on 17 May 2014, 12:21 last edited by
I already suspected that.
Thus, there is no way to inherit forms when using QUiLoader.
Correct?
-
It's not clear to me what you want to do. QUiLoader creates instances of a class. You can't inherit an instance.
You can define a custom class and create instances of it using loader.
You can't load arbitrary .ui file with class names unknown to your program at compile time. -
wrote on 17 May 2014, 14:00 last edited by
Ok,
Thanks for the clarification
1/5