gwenhywfar 5.10.1
qt5/w_groupbox.cpp
Go to the documentation of this file.
1/***************************************************************************
2 begin : Mon Feb 15 2010
3 copyright : (C) 2010 by Martin Preuss
4 email : martin@libchipcard.de
5
6 ***************************************************************************
7 * Please see toplevel file COPYING for license details *
8 ***************************************************************************/
9
10
11#include <gwen-gui-cpp/cppwidget.hpp>
12
13
15public:
17 }
18
19
20
22 }
23
24
25
26 virtual int setup() {
27 QWidget *qw;
28 uint32_t flags;
29 GWEN_WIDGET *wParent;
30 QLayout *qLayout;
31 QSizePolicy::Policy hpolicy=QSizePolicy::Minimum;
32 QSizePolicy::Policy vpolicy=QSizePolicy::Minimum;
33 const char *s;
34 QString text;
35
37 wParent=GWEN_Widget_Tree_GetParent(_widget);
39 if (s)
40 text=QString::fromUtf8(s);
41
42 qw=new QGroupBox(text);
43 qLayout=new QVBoxLayout(qw);
44
45 /* handle flags */
46 if (flags & GWEN_WIDGET_FLAGS_FILLX)
47 hpolicy=QSizePolicy::Expanding;
48 if (flags & GWEN_WIDGET_FLAGS_FILLY)
49 vpolicy=QSizePolicy::Expanding;
50 qw->setSizePolicy(hpolicy, vpolicy);
51
52
55
56 if (wParent)
58 return 0;
59 }
60
61
62
64 QWidget *qw;
65 QBoxLayout *qLayout;
66 QWidget *qChild;
67
69 assert(qw);
70
72 assert(qLayout);
73
74 qChild=getQWidget(wChild);
75 assert(qChild);
76
77 qChild->setParent(qw);
78 qLayout->addWidget(qChild);
79
80 return 0;
81 }
82
83};
84
85
86
87
88
89
90
GWEN_WIDGET * _widget
Definition: cppwidget.hpp:66
virtual int setup()
int addChildGuiWidget(GWEN_WIDGET *wChild)
Qt5_W_GroupBox(GWEN_WIDGET *w)
static QWidget * getQWidget(GWEN_WIDGET *w)
#define GWEN_WIDGET_FLAGS_FILLY
Definition: dialog.h:62
#define GWEN_WIDGET_FLAGS_FILLX
Definition: dialog.h:61
#define QT5_DIALOG_WIDGET_REAL
#define QT5_DIALOG_WIDGET_LAYOUT
int GWEN_Widget_AddChildGuiWidget(GWEN_WIDGET *w, GWEN_WIDGET *wChild)
Definition: widget.c:828
void GWEN_Widget_SetImplData(GWEN_WIDGET *w, int index, void *ptr)
Store a pointer with the widget.
Definition: widget.c:136
void * GWEN_Widget_GetImplData(const GWEN_WIDGET *w, int index)
Definition: widget.c:122
const char * GWEN_Widget_GetText(const GWEN_WIDGET *w, int idx)
Definition: widget.c:293
uint32_t GWEN_Widget_GetFlags(const GWEN_WIDGET *w)
Definition: widget.c:149
struct GWEN_WIDGET GWEN_WIDGET
Definition: widget_be.h:34