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:
parent
db0477b80b
commit
6fd6df90c8
@ -61,13 +61,16 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
QPointer<T> m_widget;
|
QPointer<T> m_widget;
|
||||||
QWidget *m_parentConnected; // Track which parent we've connected to
|
QWidget *m_parentConnected; // Track which parent we've connected to
|
||||||
|
virtual void onParentDisconnect() {}
|
||||||
|
virtual void afterWidgetCreated() {}
|
||||||
|
|
||||||
void ensureWidget() {
|
void ensureWidget() {
|
||||||
if (!m_widget) {
|
if (!m_widget) {
|
||||||
m_widget = createWidget();
|
m_widget = createWidget();
|
||||||
m_widget->setAttribute(Qt::WA_DeleteOnClose, false);
|
afterWidgetCreated();
|
||||||
m_widget->setAttribute(Qt::WA_QuitOnClose, false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Connect to the widget's current parent to unparent before deletion
|
// Connect to the widget's current parent to unparent before deletion
|
||||||
// This prevents cross-DLL heap corruption when Qt tries to delete our widget
|
// This prevents cross-DLL heap corruption when Qt tries to delete our widget
|
||||||
void connectToParentIfNeeded() {
|
void connectToParentIfNeeded() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user