| 58 box->setSpacing(0); |
58 box->setSpacing(0); |
| 59 |
59 |
| 60 ui_reset_layout(layout); |
60 ui_reset_layout(layout); |
| 61 } |
61 } |
| 62 |
62 |
| 63 void UiBoxContainer::add(QWidget* widget, bool fill) { |
63 void UiBoxContainer::add(QWidget* widget) { |
| 64 if(layout.fill != UI_LAYOUT_UNDEFINED) { |
64 bool fill = layout.fill; |
| 65 fill = ui_lb2bool(layout.fill); |
|
| 66 } |
|
| 67 |
|
| 68 if(hasStretchedWidget && fill) { |
65 if(hasStretchedWidget && fill) { |
| 69 fill = false; |
66 fill = false; |
| 70 fprintf(stderr, "UiError: container has 2 filled widgets"); |
67 fprintf(stderr, "UiError: container has 2 filled widgets"); |
| 71 } |
68 } |
| 72 |
69 |
| 73 box->addWidget(widget, fill); |
70 box->addWidget(widget); |
| 74 |
71 |
| 75 if(!hasStretchedWidget) { |
72 if(!hasStretchedWidget) { |
| 76 QSpacerItem *newspace = new QSpacerItem(0, 0, QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); |
73 QSpacerItem *newspace = new QSpacerItem(0, 0, QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); |
| 77 box->removeItem(space); |
74 box->removeItem(space); |
| 78 box->addSpacerItem(newspace); |
75 box->addSpacerItem(newspace); |
| 91 UI_APPLY_LAYOUT(ctn->layout, args); |
88 UI_APPLY_LAYOUT(ctn->layout, args); |
| 92 |
89 |
| 93 QWidget *widget = new QWidget(); |
90 QWidget *widget = new QWidget(); |
| 94 QBoxLayout *box = new QBoxLayout(dir); |
91 QBoxLayout *box = new QBoxLayout(dir); |
| 95 widget->setLayout(box); |
92 widget->setLayout(box); |
| 96 ctn->add(widget, true); |
93 ctn->add(widget); |
| 97 |
94 |
| 98 ui_container_add(obj, new UiBoxContainer(box)); |
95 ui_container_add(obj, new UiBoxContainer(box)); |
| 99 |
96 |
| 100 return widget; |
97 return widget; |
| 101 } |
98 } |
| 131 grid->setHorizontalSpacing(columnspacing); |
128 grid->setHorizontalSpacing(columnspacing); |
| 132 grid->setVerticalSpacing(rowspacing); |
129 grid->setVerticalSpacing(rowspacing); |
| 133 ui_reset_layout(layout); |
130 ui_reset_layout(layout); |
| 134 } |
131 } |
| 135 |
132 |
| 136 void UiGridContainer::add(QWidget* widget, bool fill) { |
133 void UiGridContainer::add(QWidget* widget) { |
| 137 if(layout.newline) { |
134 if(layout.newline) { |
| 138 x = 0; |
135 x = 0; |
| 139 y++; |
136 y++; |
| 140 } |
137 } |
| 141 |
138 |
| 142 int hexpand = false; |
139 bool fill = layout.fill; |
| 143 int vexpand = false; |
140 bool hexpand = false; |
| 144 int hfill = false; |
141 bool vexpand = false; |
| 145 int vfill = false; |
142 bool hfill = false; |
| |
143 bool vfill = false; |
| 146 if(!layout.override_defaults) { |
144 if(!layout.override_defaults) { |
| 147 if(def_hexpand) { |
145 if(def_hexpand) { |
| 148 hexpand = true; |
146 hexpand = true; |
| 149 hfill = true; |
147 hfill = true; |
| 150 } else if(def_hfill) { |
148 } else if(def_hfill) { |
| 238 UI_APPLY_LAYOUT(ctn->layout, args); |
233 UI_APPLY_LAYOUT(ctn->layout, args); |
| 239 |
234 |
| 240 QWidget *widget = new QWidget(); |
235 QWidget *widget = new QWidget(); |
| 241 QGridLayout *grid = new QGridLayout(); |
236 QGridLayout *grid = new QGridLayout(); |
| 242 widget->setLayout(grid); |
237 widget->setLayout(grid); |
| 243 ctn->add(widget, true); |
238 ctn->add(widget); |
| 244 |
239 |
| 245 ui_container_add(obj, new UiGridContainer( |
240 ui_container_add(obj, new UiGridContainer( |
| 246 grid, |
241 grid, |
| 247 args->margin, |
242 args->margin, |
| 248 args->columnspacing, |
243 args->columnspacing, |