Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
IVT
src
gui
Qt
QtApplicationHandler.cpp
Go to the documentation of this file.
1
// ****************************************************************************
2
// Filename: QtApplicationHandler.cpp
3
// Author: Florian Hecht
4
// Date: 2008
5
// ****************************************************************************
6
7
8
#include "
QtApplicationHandler.h
"
9
10
#include <qapplication.h>
11
12
static
char
app_name
[] =
"IVT_APPLICATION\0"
;
13
static
int
my_argc
= 1;
14
static
char
*
my_argv
[2] = {
app_name
, NULL};
15
16
CQtApplicationHandler
*
CQtApplicationHandler::m_pQtApplicationHandler
= NULL;
17
18
CQtApplicationHandler::CQtApplicationHandler
(
int
argc,
char
**argv)
19
{
20
m_pApplication
= 0;
21
m_bExit
=
false
;
22
23
if
(argc == 0 && argv == NULL)
24
{
25
m_pApplication
=
new
QApplication(
my_argc
,
my_argv
);
26
}
27
else
28
{
29
my_argc
= argc;
30
m_pApplication
=
new
QApplication(
my_argc
, argv);
31
}
32
33
m_pApplication
->connect(
m_pApplication
, SIGNAL(lastWindowClosed()),
this
, SLOT(
Exit
()));
34
35
m_pQtApplicationHandler
=
this
;
36
37
// undo the setting of the locale by Qt
38
// this makes dialogs appear in english on any system
39
// but it doesn't screw with sscanf and fscanf, which
40
// is more important to us
41
setlocale(LC_ALL,
"C"
);
42
}
43
44
CQtApplicationHandler::~CQtApplicationHandler
()
45
{
46
if
(
m_pApplication
)
47
delete
m_pApplication
;
48
49
m_pQtApplicationHandler
= NULL;
50
}
51
52
bool
CQtApplicationHandler::ProcessEventsAndGetExit
()
53
{
54
#ifdef QT_THREAD_SUPPORT
55
56
m_pApplication
->lock();
57
m_pApplication
->processEvents();
58
m_pApplication
->unlock();
59
60
#else
61
62
m_pApplication
->processEvents();
63
64
#endif
65
66
return
m_bExit
;
67
}
68
69
void
CQtApplicationHandler::Reset
()
70
{
71
if
(!
m_pApplication
)
72
{
73
m_pApplication
=
new
QApplication(
my_argc
,
my_argv
);
74
m_pApplication
->connect(
m_pApplication
, SIGNAL(lastWindowClosed()),
this
, SLOT(
Exit
()));
75
}
76
77
m_bExit
=
false
;
78
}
CQtApplicationHandler::m_pQtApplicationHandler
static CQtApplicationHandler * m_pQtApplicationHandler
Definition:
QtApplicationHandler.h:54
CQtApplicationHandler::~CQtApplicationHandler
~CQtApplicationHandler()
Definition:
QtApplicationHandler.cpp:44
CQtApplicationHandler::m_bExit
bool m_bExit
Definition:
QtApplicationHandler.h:52
CQtApplicationHandler::m_pApplication
QApplication * m_pApplication
Definition:
QtApplicationHandler.h:55
CQtApplicationHandler::Exit
void Exit()
Definition:
QtApplicationHandler.h:49
QtApplicationHandler.h
my_argc
static int my_argc
Definition:
QtApplicationHandler.cpp:13
CQtApplicationHandler::CQtApplicationHandler
CQtApplicationHandler(int argc=0, char **argv=0)
Definition:
QtApplicationHandler.cpp:18
CQtApplicationHandler
Definition:
QtApplicationHandler.h:32
CQtApplicationHandler::ProcessEventsAndGetExit
bool ProcessEventsAndGetExit()
Definition:
QtApplicationHandler.cpp:52
my_argv
static char * my_argv[2]
Definition:
QtApplicationHandler.cpp:14
CQtApplicationHandler::Reset
void Reset()
Definition:
QtApplicationHandler.cpp:69
app_name
static char app_name[]
Definition:
QtApplicationHandler.cpp:12
asr_ivt
Author(s): Allgeyer Tobias, Hutmacher Robin, Kleinert Daniel, Meißner Pascal, Scholz Jonas, Stöckle Patrick
autogenerated on Mon Dec 2 2019 03:47:28