Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Whats the difference between the parent widget and the owner window?

owner parent widget window
0
Posted

Whats the difference between the parent widget and the owner window?

0

There are two kinds of relationships, parent->child, and owner->owned. For all except the root widget, a parent->child relationship exists. When a parent is destroyed, the parent it its turn destroys the children. In the case of owner->owned, the relationship cuts across the widget tree. In most cases, the programmer needs to make explicit arrangements for owners to delete the objects that they own. For example, a toolbar shell and a main window are on equal levels in the widget tree (both directly under root), but there is an owned/owner relationship also. So the main window must explicitly delete the toolbar shell. It sounds complicated, but the problem really only occurs for top-level windows, i.e. dialogs owned by main window, and so on. Even in pretty large applications, only a handful of such objects typically exist. Think of those owned widgets as icons and fonts, which also must be explicitly destroyed.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.