gwenhywfar  5.10.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;
135  /* nothing to do for these types */
136  ;
137  }
138 
140  accept();
141  }
142  else if (rv==GWEN_DialogEvent_ResultReject) {
143  reject();
144  }
145  }
146 }
147 
148 
149 
151  const QObject *snd;
152 
153  snd=sender();
154  if (snd) {
155  GWEN_WIDGET *w;
156  const char *wname;
158 
160  if (w==NULL) {
161  DBG_INFO(0, "Widget not found");
162  return;
163  }
164  wname=GWEN_Widget_GetName(w);
165 
166  DBG_INFO(GWEN_LOGDOMAIN, "ValueChanged for [%s] (type: %s)",
167  wname?wname:"(unnamed)",
169 
170  switch(GWEN_Widget_GetType(w)) {
173  break;
174 
186  break;
187 
204  /* nothing to do for these types */
205  ;
206  }
207 
209  accept();
210  }
211  else if (rv==GWEN_DialogEvent_ResultReject) {
212  reject();
213  }
214  }
215 }
216 
217 #include "qt5dialogbox.moc"
void slotValueChanged()
GWEN_WIDGET_TYPE GWEN_Widget_GetType(const GWEN_WIDGET *w)
Definition: widget.c:185
QT5_DialogBox(QT5_GuiDialog *dialog, QWidget *parent=0, bool modal=false, Qt::WindowFlags f=0)
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:35
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, args...)
Definition: debug.h:181
const char * GWEN_Widget_Type_toString(GWEN_WIDGET_TYPE t)
Definition: widget.c:452
#define QT5_DIALOG_WIDGET_REAL