Fluent-Qt

Foundations

Widget ownership

Know whether a container deletes the widgets you give it.

Ownership modes

Containers that host your widgets, such as Expander::setContentWidget(), Field::setEditor(), SplitView::addPane(), and Accordion::addItem(), have an overload that takes a WidgetOwnership. Borrowed: the widget becomes parentless when released and is never deleted by the host. Reparented: the widget returns to its original parent. Owned: the host deletes it. Without the argument, Expander, Field, and Accordion borrow, while SplitView::addPane() takes ownership.

#include <FluentQt/Layout.h>

expander->setContentWidget(editor, fluent::WidgetOwnership::Borrowed);
// Later, detach without destroying:
QWidget* taken = expander->takeContentWidget();

PySide6

PySide6 adds explicit methods such as setBorrowedContentWidget(), setOwnedContentWidget(), and setBorrowedEditor(). Keep a Python reference to a borrowed widget without a parent while it is in use.

API reference