gwenhywfar  5.14.1
qt5dialogbox.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  begin : Tue Feb 16 2010
3  copyright : (C) 2010 by Martin Preuss
4  (C) 2016 by Christian David
5  email : martin@libchipcard.de
6  christian-david@web.de
7 
8  ***************************************************************************
9  * Please see toplevel file COPYING for license details *
10  ***************************************************************************/
11 
12 #ifdef HAVE_CONFIG_H
13 # include <config.h>
14 #endif
15 
16 
17 
18 #include "qt5dialogbox.hpp"
19 #include "qt5_gui_dialog.hpp"
20 
21 #include <QCloseEvent>
22 
23 #include <gwenhywfar/debug.h>
24 
25 
27  QWidget *parent,
28  bool modal,
29  Qt::WindowFlags f)
30  :QDialog(parent, f)
31  ,_dialog(dialog) {
32  setModal(modal);
33 }
34 
35 
36 
38 }
39 
40 
41 
43  QDialog::accept();
44 }
45 
46 
47 
49  QDialog::reject();
50 }
51 
52 
53 
55  return exec();
56 }
57 
58 
59 
60 void QT5_DialogBox::closeEvent(QCloseEvent *e) {
61  if (_dialog) {
62  int rv;
63 
66  e->accept();
67  }
68  }
69  else {
70  e->accept();
71  }
72 }
73 
74 
75 
77  _dialog=NULL;
78 }
79 
80 
81 
83  const QObject *snd;
84 
85  snd=sender();
86  if (snd) {
87  GWEN_WIDGET *w;
88  const char *wname;
90 
92  if (w==NULL) {
93  DBG_INFO(0, "Widget not found");
94  return;
95  }
96  wname=GWEN_Widget_GetName(w);
97 
98  DBG_INFO(GWEN_LOGDOMAIN, "Command for [%s] (type: %s)",
99  wname?wname:"(unnamed)",
101 
102  switch(GWEN_Widget_GetType(w)) {
105  break;
106 
118  break;
137  /* nothing to do for these types */
138  ;
139  }
140 
142  accept();
143  }
144  else if (rv==GWEN_DialogEvent_ResultReject) {
145  reject();
146  }
147  }
148 }
149 
150 
151 
153  const QObject *snd;
154 
155  snd=sender();
156  if (snd) {
157  GWEN_WIDGET *w;
158  const char *wname;
160 
162  if (w==NULL) {
163  DBG_INFO(0, "Widget not found");
164  return;
165  }
166  wname=GWEN_Widget_GetName(w);
167 
168  DBG_INFO(GWEN_LOGDOMAIN, "ValueChanged for [%s] (type: %s)",
169  wname?wname:"(unnamed)",
171 
172  switch(GWEN_Widget_GetType(w)) {
175  break;
176 
188  break;
189 
208  /* nothing to do for these types */
209  ;
210  }
211 
213  accept();
214  }
215  else if (rv==GWEN_DialogEvent_ResultReject) {
216  reject();
217  }
218  }
219 }
220 
221 #include "qt5dialogbox.moc"
void slotValueChanged()
GWEN_WIDGET_TYPE GWEN_Widget_GetType(const GWEN_WIDGET *w)
Definition: widget.c:185
const char * GWEN_Widget_GetName(const GWEN_WIDGET *w)
Definition: widget.c:320
#define NULL
Definition: binreloc.c:300
void unlinkFromDialog()
#define GWEN_LOGDOMAIN
Definition: logger.h:32
void slotActivated()
GWEN_DIALOG * getCInterface()
Definition: cppdialog.cpp:162
QT5_GuiDialog * _dialog
GWEN_WIDGET * GWEN_Dialog_FindWidgetByImplData(const GWEN_DIALOG *dlg, int index, const void *ptr)
Definition: dialog.c:605
GWEN_DIALOG * GWEN_Widget_GetDialog(const GWEN_WIDGET *w)
Definition: widget.c:92
virtual ~QT5_DialogBox()
void closeEvent(QCloseEvent *e)
struct GWEN_WIDGET GWEN_WIDGET
Definition: widget_be.h:34
int GWEN_Dialog_EmitSignal(GWEN_DIALOG *dlg, GWEN_DIALOG_EVENTTYPE t, const char *sender)
Definition: dialog.c:321
#define DBG_INFO(dbg_logger, format,...)
Definition: debug.h:181
const char * GWEN_Widget_Type_toString(GWEN_WIDGET_TYPE t)
Definition: widget.c:456
#define QT5_DIALOG_WIDGET_REAL
QT5_DialogBox(QT5_GuiDialog *dialog, QWidget *parent=0, bool modal=false, Qt::WindowFlags f={})