42 #ifndef QCOREAPPLICATION_H 43 #define QCOREAPPLICATION_H 45 #include <QtCore/qobject.h> 46 #include <QtCore/qcoreevent.h> 47 #include <QtCore/qeventloop.h> 49 #ifdef QT_INCLUDE_COMPAT 50 #include <QtCore/qstringlist.h> 53 #if defined(Q_WS_WIN) && !defined(tagMSG) 54 typedef struct tagMSG
MSG;
69 #define qApp QCoreApplication::instance() 82 #if !defined(QT3_SUPPORT) 87 #if defined(QT_BUILD_CORE_LIB) || defined(qdoc) 92 #
if !defined(QT_BUILD_CORE_LIB)
109 static void setOrganizationDomain(
const QString &orgDomain);
110 static QString organizationDomain();
111 static void setOrganizationName(
const QString &orgName);
112 static QString organizationName();
113 static void setApplicationName(
const QString &application);
114 static QString applicationName();
115 static void setApplicationVersion(
const QString &version);
116 static QString applicationVersion();
122 static void processEvents(QEventLoop::ProcessEventsFlags flags,
int maxtime);
123 static void exit(
int retcode=0);
127 static void postEvent(
QObject *receiver,
QEvent *event,
int priority);
128 static void sendPostedEvents(
QObject *receiver,
int event_type);
129 static void sendPostedEvents();
130 static void removePostedEvents(
QObject *receiver);
131 static void removePostedEvents(
QObject *receiver,
int eventType);
132 static bool hasPendingEvents();
136 static bool startingUp();
137 static bool closingDown();
139 static QString applicationDirPath();
140 static QString applicationFilePath();
141 static qint64 applicationPid();
143 #ifndef QT_NO_LIBRARY 146 static void addLibraryPath(
const QString &);
147 static void removeLibraryPath(
const QString &);
148 #endif // QT_NO_LIBRARY 150 #ifndef QT_NO_TRANSLATION 151 static void installTranslator(
QTranslator * messageFile);
152 static void removeTranslator(
QTranslator * messageFile);
156 static QString translate(
const char * context,
158 const char * disambiguation = 0,
160 static QString translate(
const char * context,
162 const char * disambiguation,
167 #if defined(QT3_SUPPORT) 168 inline QT3_SUPPORT
void lock() {}
169 inline QT3_SUPPORT
void unlock(
bool =
true) {}
170 inline QT3_SUPPORT
bool locked() {
return false; }
171 inline QT3_SUPPORT
bool tryLock() {
return false; }
173 static inline QT3_SUPPORT
void processOneEvent()
175 static QT3_SUPPORT
int enter_loop();
176 static QT3_SUPPORT
void exit_loop();
177 static QT3_SUPPORT
int loopLevel();
180 #if defined(Q_WS_WIN) 181 virtual bool winEventFilter(
MSG *message,
long *result);
184 #if defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN) 185 static void watchUnixSignal(
int signal,
bool watch);
188 typedef bool (*EventFilter)(
void *message,
long *result);
189 EventFilter setEventFilter(EventFilter
filter);
190 bool filterEvent(
void *message,
long *result);
197 void unixSignal(
int);
208 static bool sendSpontaneousEvent(
QObject *receiver,
QEvent *event);
231 {
if (event)
event->spont =
false;
return self ?
self->
notifyInternal(receiver, event) :
false; }
234 {
if (event)
event->spont =
true;
return self ?
self->notifyInternal(receiver, event) :
false; }
238 #ifdef QT_NO_TRANSLATION 243 #ifndef QT_NO_TEXTCODEC 244 if (encoding == UnicodeUTF8)
254 const char *,
Encoding encoding,
int)
256 #ifndef QT_NO_TEXTCODEC 257 if (encoding == UnicodeUTF8)
267 #define Q_DECLARE_TR_FUNCTIONS(context) \ 269 static inline QString tr(const char *sourceText, const char *disambiguation = 0) \ 270 { return QCoreApplication::translate(#context, sourceText, disambiguation); } \ 271 static inline QString trUtf8(const char *sourceText, const char *disambiguation = 0) \ 272 { return QCoreApplication::translate(#context, sourceText, disambiguation, \ 273 QCoreApplication::UnicodeUTF8); } \ 274 static inline QString tr(const char *sourceText, const char *disambiguation, int n) \ 275 { return QCoreApplication::translate(#context, sourceText, disambiguation, \ 276 QCoreApplication::CodecForTr, n); } \ 277 static inline QString trUtf8(const char *sourceText, const char *disambiguation, int n) \ 278 { return QCoreApplication::translate(#context, sourceText, disambiguation, \ 279 QCoreApplication::UnicodeUTF8, n); } \ 288 #if defined(Q_WS_WIN) && !defined(QT_NO_DEBUG_STREAM) 297 #endif // QCOREAPPLICATION_H The QDebug class provides an output stream for debugging information.
The QApplication class manages the GUI application's control flow and main settings.
Encoding
This enum type defines the 8-bit encoding of character string arguments to translate(): ...
Q_CORE_EXPORT void qRemovePostRoutine(QtCleanUpFunction)
#define QT_END_NAMESPACE
This macro expands to.
Q_CORE_EXPORT QDebug operator<<(QDebug, const MSG &)
Q_CORE_EXPORT QString decodeMSG(const MSG &)
QString organizationDomain
the Internet domain of the organization that wrote this application
#define Q_DISABLE_COPY(Class)
Disables the use of copy constructors and assignment operators for the given Class.
The QString class provides a Unicode character string.
The QObject class is the base class of all Qt objects.
virtual bool event(QEvent *)
This virtual function receives events to an object and should return true if the event e was recogniz...
friend class QCoreApplication
static QString translate(const char *context, const char *key, const char *disambiguation=0, Encoding encoding=CodecForTr)
#define QT_BEGIN_NAMESPACE
This macro expands to.
Q_CORE_EXPORT void qAddPostRoutine(QtCleanUpFunction)
The QStringList class provides a list of strings.
static QString fromUtf8(const char *, int size=-1)
Returns a QString initialized with the first size bytes of the UTF-8 string str.
static bool sendSpontaneousEvent(QObject *receiver, QEvent *event)
QString applicationVersion
the version of this application
static void sendPostedEvents()
Q_CORE_EXPORT QString qAppName()
The QTranslator class provides internationalization support for text output.
The QCoreApplication class provides an event loop for console Qt applications.
static QCoreApplication * instance()
Returns a pointer to the application's QCoreApplication (or QApplication) instance.
QString applicationName
the name of this application
static QString fromLatin1(const char *, int size=-1)
Returns a QString initialized with the first size characters of the Latin-1 string str...
bool qt_sendSpontaneousEvent(QObject *, QEvent *)
bool notifyInternal(QObject *receiver, QEvent *event)
static QReadWriteLock lock
QFuture< void > filter(Sequence &sequence, FilterFunction filterFunction)
Q_CORE_EXPORT QTextStream & flush(QTextStream &s)
#define Q_DECLARE_PRIVATE(Class)
The QTextCodec class provides conversions between text encodings.
The QEvent class is the base class of all event classes.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
void(* QtCleanUpFunction)()
QString organizationName
the name of the organization that wrote this application
#define QT_VERSION
This macro expands a numeric value of the form 0xMMNNPP (MM = major, NN = minor, PP = patch) that spe...