QPointer only works on QObject. On the other hand, you talk about parents and children which suggests you are using QObjects. You can access the parent outside constructor via QObject::parent().
QPointer only works on QObject. On the other hand, you talk about parents and children which suggests you are using QObjects. You can access the parent outside constructor via QObject::parent().
J-P Nurmi
Ok, but I cannot acces custom methods of class via parent() call. Why??
Qt 5.3 Opensource & Creator 3.1.2
Because parent() returns a pointer to QObject. QObject does not offer those custom methods. You could cast the pointer to appropriate type, but I would recommend using signals and slots instead.
J-P Nurmi
Ok, jpn, I see this problem of mine is more design than coding question. Let me show you big picture: I have class CMerchandizeWindow, which interacts with database and shows merchandize pictures in wdiget. Then I have COperationWindow, which is this "parent" of CMerchandizeWindow, because CMerchandizeWindow widget (inhertihs QWidget) is created in COpeation WIndow. In COperationWindow I also have QTextEdit and bunch of buttons. Now, how do I transfer collected data from database (only CMerchandizeWindows interacts with database) from CMerchandizeWindow to QTextEdit (which is declared in COperationWindow)?
Qt 5.3 Opensource & Creator 3.1.2
Bookmarks