gwenhywfar 5.12.0
qt4dialogbox.cpp
Go to the documentation of this file.
1/***************************************************************************
2 begin : Tue Feb 16 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#ifdef HAVE_CONFIG_H
11# include <config.h>
12#endif
13
14
15
16#include "qt4dialogbox.hpp"
17#include "qt4_gui_dialog.hpp"
18
19#include <QCloseEvent>
20
21#include <gwenhywfar/debug.h>
22
23
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
39
40
41
43 QDialog::accept();
44}
45
46
47
49 QDialog::reject();
50}
51
52
53
55 return exec();
56}
57
58
59
60void QT4_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
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
218
219#include "qt4dialogbox.moc"
220
221
222
#define NULL
Definition binreloc.c:300
void slotValueChanged()
QT4_GuiDialog * _dialog
QT4_DialogBox(QT4_GuiDialog *dialog, QWidget *parent=0, bool modal=FALSE, Qt::WindowFlags f=0)
void closeEvent(QCloseEvent *e)
virtual ~QT4_DialogBox()
void unlinkFromDialog()
#define DBG_INFO(dbg_logger, format,...)
Definition debug.h:181
GWEN_WIDGET * GWEN_Dialog_FindWidgetByImplData(const GWEN_DIALOG *dlg, int index, const void *ptr)
Definition dialog.c:605
int GWEN_Dialog_EmitSignal(GWEN_DIALOG *dlg, GWEN_DIALOG_EVENTTYPE t, const char *sender)
Definition dialog.c:321
@ GWEN_DialogEvent_TypeValueChanged
Definition dialog.h:101
@ GWEN_DialogEvent_TypeClose
Definition dialog.h:105
@ GWEN_DialogEvent_TypeActivated
Definition dialog.h:102
@ GWEN_DialogEvent_ResultAccept
Definition dialog.h:122
@ GWEN_DialogEvent_ResultNotHandled
Definition dialog.h:121
@ GWEN_DialogEvent_ResultReject
Definition dialog.h:123
#define GWEN_LOGDOMAIN
Definition logger.h:35
#define QT4_DIALOG_WIDGET_REAL
const char * GWEN_Widget_GetName(const GWEN_WIDGET *w)
Definition widget.c:320
const char * GWEN_Widget_Type_toString(GWEN_WIDGET_TYPE t)
Definition widget.c:452
GWEN_DIALOG * GWEN_Widget_GetDialog(const GWEN_WIDGET *w)
Definition widget.c:92
GWEN_WIDGET_TYPE GWEN_Widget_GetType(const GWEN_WIDGET *w)
Definition widget.c:185
struct GWEN_WIDGET GWEN_WIDGET
Definition widget_be.h:34
@ GWEN_Widget_TypeTabBook
Definition widget_be.h:67
@ GWEN_Widget_TypeNone
Definition widget_be.h:51
@ GWEN_Widget_TypeComboBox
Definition widget_be.h:56
@ GWEN_Widget_TypeTabPage
Definition widget_be.h:68
@ GWEN_Widget_TypeRadioButton
Definition widget_be.h:57
@ GWEN_Widget_TypeHLayout
Definition widget_be.h:62
@ GWEN_Widget_TypeLineEdit
Definition widget_be.h:54
@ GWEN_Widget_TypeWidgetStack
Definition widget_be.h:70
@ GWEN_Widget_TypeScrollArea
Definition widget_be.h:71
@ GWEN_Widget_TypeLabel
Definition widget_be.h:52
@ GWEN_Widget_TypeGroupBox
Definition widget_be.h:59
@ GWEN_Widget_TypeDialog
Definition widget_be.h:66
@ GWEN_Widget_TypePushButton
Definition widget_be.h:53
@ GWEN_Widget_TypeCheckBox
Definition widget_be.h:69
@ GWEN_Widget_TypeTextBrowser
Definition widget_be.h:74
@ GWEN_Widget_TypeHSpacer
Definition widget_be.h:60
@ GWEN_Widget_TypeHLine
Definition widget_be.h:72
@ GWEN_Widget_TypeTextEdit
Definition widget_be.h:55
@ GWEN_Widget_TypeGridLayout
Definition widget_be.h:64
@ GWEN_Widget_TypeVLayout
Definition widget_be.h:63
@ GWEN_Widget_TypeProgressBar
Definition widget_be.h:58
@ GWEN_Widget_TypeSpinBox
Definition widget_be.h:75
@ GWEN_Widget_TypeVSpacer
Definition widget_be.h:61
@ GWEN_Widget_TypeUnknown
Definition widget_be.h:50
@ GWEN_Widget_TypeVLine
Definition widget_be.h:73
@ GWEN_Widget_TypeListBox
Definition widget_be.h:65