remove fill parameter from Container add method (QT)

Fri, 18 Jul 2025 21:54:33 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Fri, 18 Jul 2025 21:54:33 +0200
changeset 672
1b08ba076b65
parent 671
0ab4c7a18660
child 673
90a32d739b8e

remove fill parameter from Container add method (QT)

ui/qt/button.cpp file | annotate | diff | comparison | revisions
ui/qt/container.cpp file | annotate | diff | comparison | revisions
ui/qt/container.h file | annotate | diff | comparison | revisions
ui/qt/entry.cpp file | annotate | diff | comparison | revisions
ui/qt/label.cpp file | annotate | diff | comparison | revisions
ui/qt/list.cpp file | annotate | diff | comparison | revisions
ui/qt/text.cpp file | annotate | diff | comparison | revisions
ui/qt/widget.cpp file | annotate | diff | comparison | revisions
--- a/ui/qt/button.cpp	Fri Jul 18 21:49:29 2025 +0200
+++ b/ui/qt/button.cpp	Fri Jul 18 21:54:33 2025 +0200
@@ -43,7 +43,7 @@
         button->connect(button, SIGNAL(destroyed()), event, SLOT(destroy()));
     }
     
-    ctn->add(button, false);
+    ctn->add(button);
     
     return button;
 }
@@ -88,7 +88,7 @@
         i->set = ui_togglebutton_set;
     }
     
-    ctn->add(button, false);
+    ctn->add(button);
     
     return button;
 }
@@ -147,7 +147,7 @@
         i->set = ui_checkbox_set;
     }
     
-    ctn->add(checkbox, false);
+    ctn->add(checkbox);
     
     return checkbox;
 }
@@ -208,7 +208,7 @@
     button->connect(button, SIGNAL(clicked()), event, SLOT(slot()));
     button->connect(button, SIGNAL(destroyed()), event, SLOT(destroy()));
     
-    ctn->add(button, false);
+    ctn->add(button);
     
     return button;
 }
--- a/ui/qt/container.cpp	Fri Jul 18 21:49:29 2025 +0200
+++ b/ui/qt/container.cpp	Fri Jul 18 21:54:33 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);
@@ -93,7 +90,7 @@
     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));
     
@@ -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;
@@ -240,7 +235,7 @@
     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,
--- a/ui/qt/container.h	Fri Jul 18 21:49:29 2025 +0200
+++ b/ui/qt/container.h	Fri Jul 18 21:54:33 2025 +0200
@@ -81,7 +81,7 @@
     UiLayout layout; 
     UIWIDGET current;
 
-    virtual void add(QWidget *widget, bool fill) = 0;
+    virtual void add(QWidget *widget) = 0;
     virtual void end() {}
 };
 
@@ -93,7 +93,7 @@
     
     UiBoxContainer(QBoxLayout *box);
     
-    virtual void add(QWidget *widget, bool fill);
+    virtual void add(QWidget *widget);
 };
 
 class UiGridContainer : public UiContainerPrivate {
@@ -120,7 +120,7 @@
             bool def_hfill,
             bool def_vfill);
     
-    virtual void add(QWidget *widget, bool fill);
+    virtual void add(QWidget *widget);
     virtual void end();
 };
 
--- a/ui/qt/entry.cpp	Fri Jul 18 21:49:29 2025 +0200
+++ b/ui/qt/entry.cpp	Fri Jul 18 21:54:33 2025 +0200
@@ -126,7 +126,7 @@
     }
     
     
-    ctn->add(widget, false);
+    ctn->add(widget);
     return widget;
 }
 
--- a/ui/qt/label.cpp	Fri Jul 18 21:49:29 2025 +0200
+++ b/ui/qt/label.cpp	Fri Jul 18 21:54:33 2025 +0200
@@ -47,7 +47,7 @@
     }
     widget->setAlignment(align);
     
-    ctn->add(widget, false);
+    ctn->add(widget);
     
     return widget;
 }
--- a/ui/qt/list.cpp	Fri Jul 18 21:49:29 2025 +0200
+++ b/ui/qt/list.cpp	Fri Jul 18 21:54:33 2025 +0200
@@ -84,7 +84,7 @@
             SLOT(selectionChanged(const QItemSelection &, const QItemSelection &)));
     
     
-    ctn->add(view, false);
+    ctn->add(view);
     
     return view;
 }
@@ -124,7 +124,7 @@
             SLOT(selectionChanged(const QItemSelection &, const QItemSelection &)));
     
     
-    ctn->add(view, false);
+    ctn->add(view);
     
     return view;
 }
--- a/ui/qt/text.cpp	Fri Jul 18 21:49:29 2025 +0200
+++ b/ui/qt/text.cpp	Fri Jul 18 21:54:33 2025 +0200
@@ -62,7 +62,7 @@
     UI_APPLY_LAYOUT(ctn->layout, args);
     
     QTextEdit *textarea = new QTextEdit();
-    ctn->add(textarea, true);
+    ctn->add(textarea);
     
     QTextDocument *document = nullptr;
     
@@ -215,7 +215,7 @@
     UI_APPLY_LAYOUT(ctn->layout, args);
     
     QLineEdit *textfield = new QLineEdit();
-    ctn->add(textfield, false);
+    ctn->add(textfield);
     
     if(password) {
         textfield->setEchoMode(QLineEdit::Password);
--- a/ui/qt/widget.cpp	Fri Jul 18 21:49:29 2025 +0200
+++ b/ui/qt/widget.cpp	Fri Jul 18 21:54:33 2025 +0200
@@ -35,7 +35,7 @@
     UIWIDGET widget = create_widget(obj, args, userdata);
     UiContainerPrivate *ctn = ui_obj_container(obj);
     UI_APPLY_LAYOUT(ctn->layout, args);
-    ctn->add(widget, false);
+    ctn->add(widget);
     return widget;
 }
 
@@ -47,7 +47,7 @@
     UiContainerPrivate *ctn = ui_obj_container(obj);
     UI_APPLY_LAYOUT(ctn->layout, args);
     
-    ctn->add(separator, false);
+    ctn->add(separator);
     
     return separator;
 }

mercurial