Solved Pointer type conversion
-
Hello, what is the base class of the UI class?I want to take the UI base class pointer as a function parameter and use qobject_cast to convert the base class pointer inside the function into a subclass pointer, but the following error is indicated:
-
Hi
Its a plain class. Its not QObject based so u cant use qobject_castclass Ui_MainWindow { public: QWidget *centralWidget; QHBoxLayout *horizontalLayout; QTabWidget *tabWidget; QWidget *tab;
-
@mrjj
static_cast,dynamic_cast,reinterpret_cast are all wrong with it. Is there any other way? -
Hi
Since its just a plain type.
Im not sure what you are trying to do . There is nothing to cast it to.
Its not even a QWidget.
So what are you trying to do ?
Its very rarely needed to send that private class to anyone. Its internal detail. -
@canid
Show some minimal code. Its very hard to reason about code we cannot see.