The function window()->windowHandle(); always returns nullptr in my custom widget.
Solved
General and Desktop
-
I want to obtain the QWindow handler within the constructor of my custom widget, but it always returns a null pointer.
class MyWidget : public QWidget { Q_OBJECT public: MyWidget() { QWindow *win = window()->windowHandle(); std::println("win equals nullptr: {}", win == nullptr); // prints true } };
How can I get the QWindow handler ?
-