ui/qt/container.cpp

changeset 73
473acef47ddd
parent 68
bd9fb6476b80
child 102
2988f00ed9d6
equal deleted inserted replaced
72:a00b46d92c54 73:473acef47ddd
33 #include <QStackedWidget> 33 #include <QStackedWidget>
34 34
35 /* -------------------- UiBoxContainer -------------------- */ 35 /* -------------------- UiBoxContainer -------------------- */
36 36
37 UiBoxContainer::UiBoxContainer(QBoxLayout* box) { 37 UiBoxContainer::UiBoxContainer(QBoxLayout* box) {
38 this->current = NULL;
39 this->menu = NULL;
38 this->box = box; 40 this->box = box;
39 box->setContentsMargins(QMargins(0,0,0,0)); 41 box->setContentsMargins(QMargins(0,0,0,0));
40 box->setSpacing(0); 42 box->setSpacing(0);
41 43
42 ui_reset_layout(layout); 44 ui_reset_layout(layout);
63 65
64 if(fill) { 66 if(fill) {
65 hasStretchedWidget = true; 67 hasStretchedWidget = true;
66 } 68 }
67 ui_reset_layout(layout); 69 ui_reset_layout(layout);
70 current = widget;
68 } 71 }
69 72
70 UIWIDGET ui_box(UiObject *obj, QBoxLayout::Direction dir) { 73 UIWIDGET ui_box(UiObject *obj, QBoxLayout::Direction dir) {
71 UiContainer *ct = uic_get_current_container(obj); 74 UiContainer *ct = uic_get_current_container(obj);
72 QWidget *widget = new QWidget(); 75 QWidget *widget = new QWidget();
92 95
93 96
94 /* -------------------- UiGridContainer -------------------- */ 97 /* -------------------- UiGridContainer -------------------- */
95 98
96 UiGridContainer::UiGridContainer(QGridLayout* grid) { 99 UiGridContainer::UiGridContainer(QGridLayout* grid) {
100 this->current = NULL;
101 this->menu = NULL;
97 this->grid = grid; 102 this->grid = grid;
98 grid->setContentsMargins(QMargins(0,0,0,0)); 103 grid->setContentsMargins(QMargins(0,0,0,0));
99 grid->setSpacing(0); 104 grid->setSpacing(0);
100 ui_reset_layout(layout); 105 ui_reset_layout(layout);
101 } 106 }
118 123
119 grid->addWidget(widget, y, x); 124 grid->addWidget(widget, y, x);
120 x++; 125 x++;
121 126
122 ui_reset_layout(layout); 127 ui_reset_layout(layout);
128 current = widget;
123 } 129 }
124 130
125 131
126 /* -------------------- UiTabViewContainer -------------------- */ 132 /* -------------------- UiTabViewContainer -------------------- */
127 133
128 UiTabViewContainer::UiTabViewContainer(QTabWidget* tabwidget) { 134 UiTabViewContainer::UiTabViewContainer(QTabWidget* tabwidget) {
135 this->current = NULL;
136 this->menu = NULL;
129 this->tabwidget = tabwidget; 137 this->tabwidget = tabwidget;
130 } 138 }
131 139
132 void UiTabViewContainer::add(QWidget* widget, bool fill) { 140 void UiTabViewContainer::add(QWidget* widget, bool fill) {
133 QString str = QString::fromUtf8(layout.label); 141 QString str = QString::fromUtf8(layout.label);
138 this->stack = stack; 146 this->stack = stack;
139 } 147 }
140 148
141 void UiStackContainer::add(QWidget* widget, bool fill) { 149 void UiStackContainer::add(QWidget* widget, bool fill) {
142 stack->addWidget(widget); 150 stack->addWidget(widget);
151 current = widget;
143 } 152 }
144 153
145 UIWIDGET ui_tabview(UiObject *obj) { 154 UIWIDGET ui_tabview(UiObject *obj) {
146 QStackedWidget *tabwidget = new QStackedWidget(); 155 QStackedWidget *tabwidget = new QStackedWidget();
147 156

mercurial