Provide more lifetime management in Qt bindings also for Qt4

This commit is contained in:
Matthias Koefferlein 2023-03-26 22:51:06 +02:00
parent acd9d6b8c5
commit 80987a6408
7 changed files with 31 additions and 1 deletions

View File

@ -635,11 +635,26 @@ drop_method "Qimage", /Qimage::text\(const\s+QString/ # clashes with const char
rename "QDialogButtonBox", /QDialogButtonBox::QDialogButtonBox\(QFlags/, "new_buttons"
rename "QIcon", /QIcon::pixmap\(int\s+extent/, "pixmap_ext"
rename "QKeySequence", /QKeySequence::QKeySequence\(QKeySequence::StandardKey/, "new_std"
# TODO: basically, the layout object only takes ownership over the objects when
# it has a QWidget parent itself. This is not reflected in the following simple scheme
keep_arg "QBoxLayout", /::addLayout/, 0 # will take ownership of layout
keep_arg "QBoxLayout", /::addSpacerItem/, 0 # will take ownership of item
keep_arg "QBoxLayout", /::addWidget/, 0 # will take ownership of item
keep_arg "QBoxLayout", /::insertItem/, 1 # will take ownership of item
keep_arg "QBoxLayout", /::insertLayout/, 1 # will take ownership of item
keep_arg "QBoxLayout", /::insertSpacerItem/, 1 # will take ownership of item
keep_arg "QBoxLayout", /::insertWidget/, 1 # will take ownership of item
keep_arg "QGridLayout", /::addLayout/, 0 # will take ownership of layout
keep_arg "QWidget", /::setLayout\s*\(/, 0 # will take ownership of layout
keep_arg "QGridLayout", /::addItem/, 0 # will take ownership of layout
keep_arg "QGridLayout", /::addWidget/, 0 # will take ownership of layout
keep_arg "QLayout", /::addChildLayout/, 0 # will take ownership of layout
keep_arg "QLayout", /::addItem/, 0 # will take ownership of item
keep_arg "QLayout", /::addWidget/, 0 # will take ownership of item
keep_arg "QStackedLayout", /::addWidget/, 0 # will take ownership of item
keep_arg "QStackedLayout", /::insertWidget/, 1 # will take ownership of item
keep_arg "QWidget", /::setLayout\s*\(/, 0 # will take ownership of layout
keep_arg "QTreeWidgetItem", /::addChild\(/, 0 # will take ownership of the child
keep_arg "QTreeWidgetItem", /::addChildren\(/, 0 # will take ownership of the children
keep_arg "QTreeWidgetItem", /::insertChild\(/, 1 # will take ownership of the child

View File

@ -119,6 +119,7 @@ static void _call_f_addSpacerItem_1708 (const qt_gsi::GenericMethod * /*decl*/,
__SUPPRESS_UNUSED_WARNING(args);
tl::Heap heap;
QSpacerItem *arg1 = gsi::arg_reader<QSpacerItem * >() (args, heap);
qt_gsi::qt_keep (arg1);
__SUPPRESS_UNUSED_WARNING(ret);
((QBoxLayout *)cls)->addSpacerItem (arg1);
}
@ -203,6 +204,7 @@ static void _call_f_addWidget_4616 (const qt_gsi::GenericMethod * /*decl*/, void
__SUPPRESS_UNUSED_WARNING(args);
tl::Heap heap;
QWidget *arg1 = gsi::arg_reader<QWidget * >() (args, heap);
qt_gsi::qt_keep (arg1);
int arg2 = args ? gsi::arg_reader<int >() (args, heap) : gsi::arg_maker<int >() (0, heap);
QFlags<Qt::AlignmentFlag> arg3 = args ? gsi::arg_reader<QFlags<Qt::AlignmentFlag> >() (args, heap) : gsi::arg_maker<QFlags<Qt::AlignmentFlag> >() (0, heap);
__SUPPRESS_UNUSED_WARNING(ret);
@ -309,6 +311,7 @@ static void _call_f_insertLayout_2659 (const qt_gsi::GenericMethod * /*decl*/, v
tl::Heap heap;
int arg1 = gsi::arg_reader<int >() (args, heap);
QLayout *arg2 = gsi::arg_reader<QLayout * >() (args, heap);
qt_gsi::qt_keep (arg2);
int arg3 = args ? gsi::arg_reader<int >() (args, heap) : gsi::arg_maker<int >() (0, heap);
__SUPPRESS_UNUSED_WARNING(ret);
((QBoxLayout *)cls)->insertLayout (arg1, arg2, arg3);
@ -333,6 +336,7 @@ static void _call_f_insertSpacerItem_2367 (const qt_gsi::GenericMethod * /*decl*
tl::Heap heap;
int arg1 = gsi::arg_reader<int >() (args, heap);
QSpacerItem *arg2 = gsi::arg_reader<QSpacerItem * >() (args, heap);
qt_gsi::qt_keep (arg2);
__SUPPRESS_UNUSED_WARNING(ret);
((QBoxLayout *)cls)->insertSpacerItem (arg1, arg2);
}
@ -406,6 +410,7 @@ static void _call_f_insertWidget_5275 (const qt_gsi::GenericMethod * /*decl*/, v
tl::Heap heap;
int arg1 = gsi::arg_reader<int >() (args, heap);
QWidget *arg2 = gsi::arg_reader<QWidget * >() (args, heap);
qt_gsi::qt_keep (arg2);
int arg3 = args ? gsi::arg_reader<int >() (args, heap) : gsi::arg_maker<int >() (0, heap);
QFlags<Qt::AlignmentFlag> arg4 = args ? gsi::arg_reader<QFlags<Qt::AlignmentFlag> >() (args, heap) : gsi::arg_maker<QFlags<Qt::AlignmentFlag> >() (0, heap);
__SUPPRESS_UNUSED_WARNING(ret);
@ -1686,6 +1691,7 @@ static void _call_fp_insertItem_2399 (const qt_gsi::GenericMethod * /*decl*/, vo
tl::Heap heap;
int arg1 = gsi::arg_reader<int >() (args, heap);
QLayoutItem *arg2 = gsi::arg_reader<QLayoutItem * >() (args, heap);
qt_gsi::qt_keep (arg2);
__SUPPRESS_UNUSED_WARNING(ret);
((QBoxLayout_Adaptor *)cls)->fp_QBoxLayout_insertItem_2399 (arg1, arg2);
}

View File

@ -85,6 +85,7 @@ static void _call_f_addItem_7018 (const qt_gsi::GenericMethod * /*decl*/, void *
__SUPPRESS_UNUSED_WARNING(args);
tl::Heap heap;
QLayoutItem *arg1 = gsi::arg_reader<QLayoutItem * >() (args, heap);
qt_gsi::qt_keep (arg1);
int arg2 = gsi::arg_reader<int >() (args, heap);
int arg3 = gsi::arg_reader<int >() (args, heap);
int arg4 = args ? gsi::arg_reader<int >() (args, heap) : gsi::arg_maker<int >() (1, heap);
@ -176,6 +177,7 @@ static void _call_f_addWidget_1315 (const qt_gsi::GenericMethod * /*decl*/, void
__SUPPRESS_UNUSED_WARNING(args);
tl::Heap heap;
QWidget *arg1 = gsi::arg_reader<QWidget * >() (args, heap);
qt_gsi::qt_keep (arg1);
__SUPPRESS_UNUSED_WARNING(ret);
((QGridLayout *)cls)->addWidget (arg1);
}
@ -202,6 +204,7 @@ static void _call_f_addWidget_5275 (const qt_gsi::GenericMethod * /*decl*/, void
__SUPPRESS_UNUSED_WARNING(args);
tl::Heap heap;
QWidget *arg1 = gsi::arg_reader<QWidget * >() (args, heap);
qt_gsi::qt_keep (arg1);
int arg2 = gsi::arg_reader<int >() (args, heap);
int arg3 = gsi::arg_reader<int >() (args, heap);
QFlags<Qt::AlignmentFlag> arg4 = args ? gsi::arg_reader<QFlags<Qt::AlignmentFlag> >() (args, heap) : gsi::arg_maker<QFlags<Qt::AlignmentFlag> >() (0, heap);
@ -235,6 +238,7 @@ static void _call_f_addWidget_6593 (const qt_gsi::GenericMethod * /*decl*/, void
__SUPPRESS_UNUSED_WARNING(args);
tl::Heap heap;
QWidget *arg1 = gsi::arg_reader<QWidget * >() (args, heap);
qt_gsi::qt_keep (arg1);
int arg2 = gsi::arg_reader<int >() (args, heap);
int arg3 = gsi::arg_reader<int >() (args, heap);
int arg4 = gsi::arg_reader<int >() (args, heap);

View File

@ -1033,6 +1033,7 @@ static void _call_fp_insertItem_2399 (const qt_gsi::GenericMethod * /*decl*/, vo
tl::Heap heap;
int arg1 = gsi::arg_reader<int >() (args, heap);
QLayoutItem *arg2 = gsi::arg_reader<QLayoutItem * >() (args, heap);
qt_gsi::qt_keep (arg2);
__SUPPRESS_UNUSED_WARNING(ret);
((QHBoxLayout_Adaptor *)cls)->fp_QHBoxLayout_insertItem_2399 (arg1, arg2);
}

View File

@ -110,6 +110,7 @@ static void _call_f_addWidget_1315 (const qt_gsi::GenericMethod * /*decl*/, void
__SUPPRESS_UNUSED_WARNING(args);
tl::Heap heap;
QWidget *arg1 = gsi::arg_reader<QWidget * >() (args, heap);
qt_gsi::qt_keep (arg1);
__SUPPRESS_UNUSED_WARNING(ret);
((QLayout *)cls)->addWidget (arg1);
}

View File

@ -95,6 +95,7 @@ static void _call_f_addWidget_1315 (const qt_gsi::GenericMethod * /*decl*/, void
__SUPPRESS_UNUSED_WARNING(args);
tl::Heap heap;
QWidget *arg1 = gsi::arg_reader<QWidget * >() (args, heap);
qt_gsi::qt_keep (arg1);
ret.write<int > ((int)((QStackedLayout *)cls)->addWidget (arg1));
}
@ -162,6 +163,7 @@ static void _call_f_insertWidget_1974 (const qt_gsi::GenericMethod * /*decl*/, v
tl::Heap heap;
int arg1 = gsi::arg_reader<int >() (args, heap);
QWidget *arg2 = gsi::arg_reader<QWidget * >() (args, heap);
qt_gsi::qt_keep (arg2);
ret.write<int > ((int)((QStackedLayout *)cls)->insertWidget (arg1, arg2));
}

View File

@ -1033,6 +1033,7 @@ static void _call_fp_insertItem_2399 (const qt_gsi::GenericMethod * /*decl*/, vo
tl::Heap heap;
int arg1 = gsi::arg_reader<int >() (args, heap);
QLayoutItem *arg2 = gsi::arg_reader<QLayoutItem * >() (args, heap);
qt_gsi::qt_keep (arg2);
__SUPPRESS_UNUSED_WARNING(ret);
((QVBoxLayout_Adaptor *)cls)->fp_QVBoxLayout_insertItem_2399 (arg1, arg2);
}