ui/qt/label.cpp

changeset 521
6e3e1fa6dfcc
parent 516
4b31c74666d7
child 544
d241dcb2cbb5
equal deleted inserted replaced
520:ea1bba55de44 521:6e3e1fa6dfcc
27 */ 27 */
28 28
29 #include "label.h" 29 #include "label.h"
30 #include "container.h" 30 #include "container.h"
31 #include "toolkit.h" 31 #include "toolkit.h"
32 #include "ui/display.h"
32 33
34
35 UIWIDGET ui_label_create(UiObject* obj, UiLabelArgs args) {
36 UiContainerPrivate *ctn = ui_obj_container(obj);
37 UI_APPLY_LAYOUT(ctn->layout, args);
38
39 QString str = QString::fromUtf8(args.label);
40 QLabel *widget = new QLabel(str);
41
42 Qt::AlignmentFlag align = Qt::AlignCenter;
43 if(args.align == UI_ALIGN_LEFT) {
44 align = Qt::AlignLeft;
45 } else if(args.align == UI_ALIGN_RIGHT) {
46 align = Qt::AlignRight;
47 }
48 widget->setAlignment(align);
49
50 ctn->add(widget, false);
51
52 return widget;
53 }
54
55 UIWIDGET ui_llabel_create(UiObject* obj, UiLabelArgs args) {
56 args.align = UI_ALIGN_LEFT;
57 return ui_label_create(obj, args);
58 }
59
60 UIWIDGET ui_rlabel_create(UiObject* obj, UiLabelArgs args) {
61 args.align = UI_ALIGN_RIGHT;
62 return ui_label_create(obj, args);
63 }

mercurial