gwenhywfar  5.14.1
qt5/w_textedit.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 
12 public:
14  }
15 
16 
17 
19  }
20 
21 
22 
23  virtual int setup() {
24  QTextEdit *qw;
25  uint32_t flags;
26  GWEN_WIDGET *wParent;
27  QSizePolicy::Policy hpolicy=QSizePolicy::Minimum;
28  QSizePolicy::Policy vpolicy=QSizePolicy::Minimum;
29  const char *s;
30  QString text;
31  /*QT5_GuiDialog *qtDialog;*/
32 
34  wParent=GWEN_Widget_Tree_GetParent(_widget);
36  if (s)
37  text=QString::fromUtf8(s);
38 
39  qw=new QTextEdit(text);
40 
41  /* handle flags */
42  if (flags & GWEN_WIDGET_FLAGS_FILLX)
43  hpolicy=QSizePolicy::Expanding;
44  if (flags & GWEN_WIDGET_FLAGS_FILLY)
45  vpolicy=QSizePolicy::Expanding;
46  qw->setSizePolicy(hpolicy, vpolicy);
47 
49 
50 #if 0
51 
56  qtDialog=dynamic_cast<QT5_GuiDialog*>(getDialog());
57  assert(qtDialog);
58 
59  qw->connect(qw, SIGNAL(returnPressed()),
60  qtDialog->getMainWindow(),
61  SLOT(slotActivated()));
62 #endif
63 
64  if (wParent)
66  return 0;
67  }
68 
69 
70 
72  GWEN_UNUSED int index,
73  const char *value,
74  GWEN_UNUSED int doSignal) {
75  QTextEdit *qw;
76  QString text;
77 
79  assert(qw);
80 
81  if (value)
82  text=QString::fromUtf8(value);
83 
84  switch(prop) {
86  qw->setText(text);
87  return 0;
88  default:
89  break;
90  }
91 
93  "Function is not appropriate for this type of widget (%s)",
95  return GWEN_ERROR_INVALID;
96  };
97 
98 
99 
101  GWEN_UNUSED int index,
102  const char *defaultValue) {
103  QTextEdit *qw;
104  QString str;
105 
107  assert(qw);
108 
109  switch(prop) {
111  str=qw->toPlainText();
112  if (str.isEmpty())
113  return defaultValue;
114  else {
117  }
118  break;
119 
120  default:
121  break;
122  }
123 
125  "Function is not appropriate for this type of widget (%s)",
127  return defaultValue;
128  };
129 
130 };
131 
132 
133 
134 
135 
136 
137 
GWEN_WIDGET_TYPE GWEN_Widget_GetType(const GWEN_WIDGET *w)
Definition: widget.c:185
int setCharProperty(GWEN_DIALOG_PROPERTY prop, GWEN_UNUSED int index, const char *value, GWEN_UNUSED int doSignal)
void GWEN_Widget_SetText(GWEN_WIDGET *w, int idx, const char *s)
Definition: widget.c:304
#define GWEN_ERROR_INVALID
Definition: error.h:67
Qt5_W_TextEdit(GWEN_WIDGET *w)
virtual int setup()
GWEN_DIALOG_PROPERTY
Definition: dialog.h:260
uint32_t GWEN_Widget_GetFlags(const GWEN_WIDGET *w)
Definition: widget.c:149
#define GWEN_LOGDOMAIN
Definition: logger.h:32
void GWEN_Widget_SetImplData(GWEN_WIDGET *w, int index, void *ptr)
Store a pointer with the widget.
Definition: widget.c:136
#define DBG_WARN(dbg_logger, format,...)
Definition: debug.h:125
void * GWEN_Widget_GetImplData(const GWEN_WIDGET *w, int index)
Definition: widget.c:122
struct GWEN_WIDGET GWEN_WIDGET
Definition: widget_be.h:34
int GWEN_Widget_AddChildGuiWidget(GWEN_WIDGET *w, GWEN_WIDGET *wChild)
Definition: widget.c:836
#define GWEN_WIDGET_FLAGS_FILLY
Definition: dialog.h:62
#define GWEN_WIDGET_FLAGS_FILLX
Definition: dialog.h:61
#define QT5_DIALOG_STRING_TITLE
const char * getCharProperty(GWEN_DIALOG_PROPERTY prop, GWEN_UNUSED int index, const char *defaultValue)
const char * GWEN_Widget_Type_toString(GWEN_WIDGET_TYPE t)
Definition: widget.c:456
CppDialog * getDialog()
Definition: cppwidget.cpp:174
GWEN_WIDGET * _widget
Definition: cppwidget.hpp:66
#define QT5_DIALOG_WIDGET_REAL
const char * GWEN_Widget_GetText(const GWEN_WIDGET *w, int idx)
Definition: widget.c:293
#define GWEN_UNUSED