feat(framework): add overridable hooks to TUWidgetLayoutViewBase

- `onParentDisconnect` -> called after the containing widget is destroyed and disconnected from its parent
- `afterWidgetCreated` -> called after the view's widget is (re)created
This commit is contained in:
☙◦ The Tablet ❀ GamerGirlandCo ◦❧ 2026-01-14 23:40:03 -05:00
parent db0477b80b
commit 6fd6df90c8
Signed by: tablet
GPG Key ID: 924A5F6AF051E87C

View File

@ -61,13 +61,16 @@ public:
protected:
QPointer<T> m_widget;
QWidget *m_parentConnected; // Track which parent we've connected to
virtual void onParentDisconnect() {}
virtual void afterWidgetCreated() {}
void ensureWidget() {
if (!m_widget) {
m_widget = createWidget();
m_widget->setAttribute(Qt::WA_DeleteOnClose, false);
m_widget->setAttribute(Qt::WA_QuitOnClose, false);
afterWidgetCreated();
}
}
// Connect to the widget's current parent to unparent before deletion
// This prevents cross-DLL heap corruption when Qt tries to delete our widget
void connectToParentIfNeeded() {