ui/qt/container.cpp

changeset 108
77254bd6dccb
parent 103
6606616eca9f
child 109
c3dfcb8f0be7
--- a/ui/qt/container.cpp	Sat Apr 05 17:57:04 2025 +0200
+++ b/ui/qt/container.cpp	Sun Jul 20 22:04:39 2025 +0200
@@ -60,17 +60,14 @@
     ui_reset_layout(layout);
 }
 
-void UiBoxContainer::add(QWidget* widget, bool fill) {
-    if(layout.fill != UI_LAYOUT_UNDEFINED) {
-        fill = ui_lb2bool(layout.fill);
-    }
-    
+void UiBoxContainer::add(QWidget* widget) {
+    bool fill = layout.fill;
     if(hasStretchedWidget && fill) {
         fill = false;
         fprintf(stderr, "UiError: container has 2 filled widgets");
     }
     
-    box->addWidget(widget, fill);
+    box->addWidget(widget);
     
     if(!hasStretchedWidget) {
         QSpacerItem *newspace = new QSpacerItem(0, 0, QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
@@ -86,25 +83,25 @@
     current = widget;
 }
 
-UIWIDGET ui_box(UiObject *obj, UiContainerArgs args, QBoxLayout::Direction dir) {
+UIWIDGET ui_box(UiObject *obj, UiContainerArgs *args, QBoxLayout::Direction dir) {
     UiContainerPrivate *ctn = (UiContainerPrivate*)ui_obj_container(obj);
     UI_APPLY_LAYOUT(ctn->layout, args);
     
     QWidget *widget = new QWidget();
     QBoxLayout *box = new QBoxLayout(dir);
     widget->setLayout(box);
-    ctn->add(widget, true);
+    ctn->add(widget);
     
     ui_container_add(obj, new UiBoxContainer(box));
     
     return widget;
 }
 
-UIWIDGET ui_vbox_create(UiObject *obj, UiContainerArgs args) {
+UIWIDGET ui_vbox_create(UiObject *obj, UiContainerArgs *args) {
     return ui_box(obj, args, QBoxLayout::TopToBottom);
 }
 
-UIWIDGET ui_hbox_create(UiObject *obj, UiContainerArgs args) {
+UIWIDGET ui_hbox_create(UiObject *obj, UiContainerArgs *args) {
     return ui_box(obj, args, QBoxLayout::LeftToRight);
 }
 
@@ -133,16 +130,17 @@
     ui_reset_layout(layout);
 }
 
-void UiGridContainer::add(QWidget* widget, bool fill) {
+void UiGridContainer::add(QWidget* widget) {
     if(layout.newline) {
         x = 0;
         y++;
     }
     
-    int hexpand = false;
-    int vexpand = false;
-    int hfill = false;
-    int vfill = false;
+    bool fill = layout.fill;
+    bool hexpand = false;
+    bool vexpand = false;
+    bool hfill = false;
+    bool vfill = false;
     if(!layout.override_defaults) {
         if(def_hexpand) {
             hexpand = true;
@@ -158,9 +156,6 @@
         }
     }
     
-    if(layout.fill != UI_LAYOUT_UNDEFINED) {
-        fill = ui_lb2bool(layout.fill);
-    }
     if(layout.hexpand) {
         hexpand = true;
         //hfill = true;
@@ -233,24 +228,24 @@
     }
 }
 
-UIEXPORT UIWIDGET ui_grid_create(UiObject *obj, UiContainerArgs args) {
+UIEXPORT UIWIDGET ui_grid_create(UiObject *obj, UiContainerArgs *args) {
     UiContainerPrivate *ctn = (UiContainerPrivate*)ui_obj_container(obj);
     UI_APPLY_LAYOUT(ctn->layout, args);
     
     QWidget *widget = new QWidget();
     QGridLayout *grid = new QGridLayout();
     widget->setLayout(grid);
-    ctn->add(widget, true);
+    ctn->add(widget);
     
     ui_container_add(obj, new UiGridContainer(
             grid,
-            args.margin,
-            args.columnspacing,
-            args.rowspacing,
-            args.def_hexpand,
-            args.def_vexpand,
-            args.def_hfill,
-            args.def_vfill));
+            args->margin,
+            args->columnspacing,
+            args->rowspacing,
+            args->def_hexpand,
+            args->def_vexpand,
+            args->def_hfill,
+            args->def_vfill));
     
     return widget;
 }

mercurial