gwenhywfar  5.14.1
qt5/w_spinbox.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_SpinBox: public Qt5_W_Widget {
12 public:
14  }
15 
16 
17 
19  }
20 
21 
22 
23  virtual int setup() {
24  QSpinBox *qw;
25  uint32_t flags;
26  GWEN_WIDGET *wParent;
27  QSizePolicy::Policy hpolicy=QSizePolicy::Minimum;
28  QSizePolicy::Policy vpolicy=QSizePolicy::Minimum;
29  QT5_GuiDialog *qtDialog;
30 
32  wParent=GWEN_Widget_Tree_GetParent(_widget);
33 
34  qw=new QSpinBox();
35 
36  /* handle flags */
37  if (flags & GWEN_WIDGET_FLAGS_FILLX)
38  hpolicy=QSizePolicy::Expanding;
39  if (flags & GWEN_WIDGET_FLAGS_FILLY)
40  vpolicy=QSizePolicy::Expanding;
41  qw->setSizePolicy(hpolicy, vpolicy);
42 
44 
45  qtDialog=dynamic_cast<QT5_GuiDialog*>(getDialog());
46  assert(qtDialog);
47 
48  qw->connect(qw, SIGNAL(valueChanged(int)),
49  qtDialog->getMainWindow(),
50  SLOT(slotValueChanged()));
51 
52 
53  if (wParent)
55  return 0;
56  }
57 
58 
59 
61  int index,
62  int value,
63  int doSignal) {
64  QSpinBox *qw;
65 
67  assert(qw);
68 
69  switch(prop) {
71  qw->setValue(value);
72  return 0;
73 
75  qw->setMinimum(value);
76  return 0;
77 
79  qw->setMaximum(value);
80  return 0;
81 
82  default:
83  return Qt5_W_Widget::setIntProperty(prop, index, value, doSignal);
84  }
85  };
86 
87 
88 
90  int index,
91  int defaultValue) {
92  QSpinBox *qw;
93 
95  assert(qw);
96 
97  switch(prop) {
99  return qw->value();
100 
102  return qw->minimum();
103 
105  return qw->maximum();
106 
107  default:
108  return Qt5_W_Widget::getIntProperty(prop, index, defaultValue);
109  }
110  };
111 
112 
113 };
114 
115 
116 
117 
118 
119 
120 
Qt5_W_SpinBox(GWEN_WIDGET *w)
int getIntProperty(GWEN_DIALOG_PROPERTY prop, int index, int defaultValue)
int setIntProperty(GWEN_DIALOG_PROPERTY prop, int index, int value, int doSignal)
GWEN_DIALOG_PROPERTY
Definition: dialog.h:260
uint32_t GWEN_Widget_GetFlags(const GWEN_WIDGET *w)
Definition: widget.c:149
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
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
QT5_DialogBox * getMainWindow()
#define GWEN_WIDGET_FLAGS_FILLX
Definition: dialog.h:61
int setIntProperty(GWEN_DIALOG_PROPERTY prop, GWEN_UNUSED int index, int value, GWEN_UNUSED int doSignal)
virtual int setup()
CppDialog * getDialog()
Definition: cppwidget.cpp:174
GWEN_WIDGET * _widget
Definition: cppwidget.hpp:66
int getIntProperty(GWEN_DIALOG_PROPERTY prop, GWEN_UNUSED int index, int defaultValue)
#define QT5_DIALOG_WIDGET_REAL