gwenhywfar  5.10.1
qt5/w_dialog.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 class Qt5_W_Dialog: public Qt5_W_Widget {
12 public:
14  }
15 
16 
17 
19  }
20 
21 
22 
23  virtual int setup() {
24  QWidget *qw;
25  uint32_t flags;
26  GWEN_WIDGET *wParent;
27  QLayout *qLayout;
28  QSizePolicy::Policy hpolicy=QSizePolicy::Minimum;
29  QSizePolicy::Policy vpolicy=QSizePolicy::Minimum;
30 
32  wParent=GWEN_Widget_Tree_GetParent(_widget);
33 
34  qw=new QT5_DialogBox(dynamic_cast<QT5_GuiDialog*>(getDialog()), QApplication::activeModalWidget());
35  qLayout=new QVBoxLayout(qw);
36 
37  /* handle flags */
38  if (flags & GWEN_WIDGET_FLAGS_FILLX)
39  hpolicy=QSizePolicy::Expanding;
40  if (flags & GWEN_WIDGET_FLAGS_FILLY)
41  vpolicy=QSizePolicy::Expanding;
42  qw->setSizePolicy(hpolicy, vpolicy);
43 
44 
47 
48  if (wParent)
50  return 0;
51  }
52 
53 
54 
56  QWidget *qw;
57  QBoxLayout *qLayout;
58  QWidget *qChild;
59 
61  assert(qw);
62 
64  assert(qLayout);
65 
66  qChild=getQWidget(wChild);
67  assert(qChild);
68 
69  qChild->setParent(qw);
70  qLayout->addWidget(qChild);
71 
72  return 0;
73  }
74 
75 
76 
78  GWEN_UNUSED int index,
79  const char *value,
80  GWEN_UNUSED int doSignal) {
81  QWidget *qw;
82 
84  assert(qw);
85 
86  switch(prop) {
88  qw->setWindowTitle(QString::fromUtf8(value));
89  return 0;
90  default:
91  break;
92  }
93 
95  "Function is not appropriate for this type of widget (%s)",
97  return GWEN_ERROR_INVALID;
98  };
99 
100 
101 
103  GWEN_UNUSED int index,
104  const char *defaultValue) {
105  QWidget *qw;
106  QString str;
107 
109  assert(qw);
110 
111  switch(prop) {
113  str=qw->windowTitle();
114  if (str.isEmpty())
115  return defaultValue;
116  else {
119  }
120  break;
121 
122  default:
123  break;
124  }
125 
127  "Function is not appropriate for this type of widget (%s)",
129  return defaultValue;
130  };
131 
132 };
133 
134 
135 
136 
137 
138 
139 
GWEN_WIDGET_TYPE GWEN_Widget_GetType(const GWEN_WIDGET *w)
Definition: widget.c:185
void GWEN_Widget_SetText(GWEN_WIDGET *w, int idx, const char *s)
Definition: widget.c:304
#define GWEN_ERROR_INVALID
Definition: error.h:67
GWEN_DIALOG_PROPERTY
Definition: dialog.h:260
virtual int setup()
uint32_t GWEN_Widget_GetFlags(const GWEN_WIDGET *w)
Definition: widget.c:149
const char * getCharProperty(GWEN_DIALOG_PROPERTY prop, GWEN_UNUSED int index, const char *defaultValue)
#define DBG_WARN(dbg_logger, format, args...)
Definition: debug.h:125
Qt5_W_Dialog(GWEN_WIDGET *w)
#define GWEN_LOGDOMAIN
Definition: logger.h:35
void GWEN_Widget_SetImplData(GWEN_WIDGET *w, int index, void *ptr)
Store a pointer with the widget.
Definition: widget.c:136
int addChildGuiWidget(GWEN_WIDGET *wChild)
void * GWEN_Widget_GetImplData(const GWEN_WIDGET *w, int index)
Definition: widget.c:122
#define QT5_DIALOG_WIDGET_LAYOUT
struct GWEN_WIDGET GWEN_WIDGET
Definition: widget_be.h:34
int GWEN_Widget_AddChildGuiWidget(GWEN_WIDGET *w, GWEN_WIDGET *wChild)
Definition: widget.c:828
#define GWEN_WIDGET_FLAGS_FILLY
Definition: dialog.h:62
#define GWEN_WIDGET_FLAGS_FILLX
Definition: dialog.h:61
#define QT5_DIALOG_STRING_TITLE
static QWidget * getQWidget(GWEN_WIDGET *w)
const char * GWEN_Widget_Type_toString(GWEN_WIDGET_TYPE t)
Definition: widget.c:452
CppDialog * getDialog()
Definition: cppwidget.cpp:174
GWEN_WIDGET * _widget
Definition: cppwidget.hpp:66
int setCharProperty(GWEN_DIALOG_PROPERTY prop, GWEN_UNUSED int index, const char *value, GWEN_UNUSED int doSignal)
#define QT5_DIALOG_WIDGET_REAL
const char * GWEN_Widget_GetText(const GWEN_WIDGET *w, int idx)
Definition: widget.c:293
#define GWEN_UNUSED