Logo Search packages:      
Sourcecode: qt4-x11 version File versions  Download package

Public Types | Public Slots | Signals | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | Properties | Private Member Functions | Static Private Member Functions | Static Private Attributes | Friends | Related Functions

QCoreApplication Class Reference

The QCoreApplication class provides an event loop for console Qt applications. More...

Inheritance diagram for QCoreApplication:
Inheritance graph
[legend]
Collaboration diagram for QCoreApplication:
Collaboration graph
[legend]

List of all members.

Public Types

enum  Encoding { CodecForTr, UnicodeUTF8, DefaultCodec = CodecForTr }
typedef bool(* EventFilter )(void *message, long *result)

Public Slots

void deleteLater ()
static void quit ()

Signals

void aboutToQuit ()
void destroyed (QObject *=0)
void unixSignal (int)

Public Member Functions

bool blockSignals (bool b)
const QObjectListchildren () const
bool connect (const QObject *sender, const char *signal, const char *member, Qt::ConnectionType type=Qt::AutoConnection) const
bool disconnect (const char *signal=0, const QObject *receiver=0, const char *member=0)
bool disconnect (const QObject *receiver, const char *member=0)
void dumpObjectInfo ()
void dumpObjectTree ()
QList< QByteArraydynamicPropertyNames () const
virtual bool eventFilter (QObject *, QEvent *)
bool filterEvent (void *message, long *result)
template<typename T >
findChild (const QString &aName=QString()) const
template<typename T >
QList< T > findChildren (const QString &aName=QString()) const
template<typename T >
QList< T > findChildren (const QRegExp &re) const
bool inherits (const char *classname) const
void installEventFilter (QObject *)
bool isWidgetType () const
void killTimer (int id)
void moveToThread (QThread *thread)
virtual bool notify (QObject *, QEvent *)
QString objectName () const
QObjectparent () const
QVariant property (const char *name) const
 QCoreApplication (int &argc, char **argv)
void removeEventFilter (QObject *)
EventFilter setEventFilter (EventFilter filter)
void setObjectName (const QString &name)
void setParent (QObject *)
bool setProperty (const char *name, const QVariant &value)
void setUserData (uint id, QObjectUserData *data)
bool signalsBlocked () const
int startTimer (int interval)
QThreadthread () const
QObjectUserDatauserData (uint id) const
 ~QCoreApplication ()

Static Public Member Functions

static void addLibraryPath (const QString &)
static QString applicationDirPath ()
static QString applicationFilePath ()
static QString applicationName ()
static qint64 applicationPid ()
static QString applicationVersion ()
static QStringList arguments ()
static bool closingDown ()
static bool connect (const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
static bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *member)
static int exec ()
static void exit (int retcode=0)
static void flush ()
static bool hasPendingEvents ()
static void installTranslator (QTranslator *messageFile)
static QCoreApplicationinstance ()
static QStringList libraryPaths ()
static QString organizationDomain ()
static QString organizationName ()
static void postEvent (QObject *receiver, QEvent *event, int priority)
static void postEvent (QObject *receiver, QEvent *event)
static void processEvents (QEventLoop::ProcessEventsFlags flags, int maxtime)
static void processEvents (QEventLoop::ProcessEventsFlags flags=QEventLoop::AllEvents)
static uint registerUserData ()
static void removeLibraryPath (const QString &)
static void removePostedEvents (QObject *receiver, int eventType)
static void removePostedEvents (QObject *receiver)
static void removeTranslator (QTranslator *messageFile)
static bool sendEvent (QObject *receiver, QEvent *event)
static void sendPostedEvents ()
static void sendPostedEvents (QObject *receiver, int event_type)
static void setApplicationName (const QString &application)
static void setApplicationVersion (const QString &version)
static void setAttribute (Qt::ApplicationAttribute attribute, bool on=true)
static void setLibraryPaths (const QStringList &)
static void setOrganizationDomain (const QString &orgDomain)
static void setOrganizationName (const QString &orgName)
static bool startingUp ()
static bool testAttribute (Qt::ApplicationAttribute attribute)
static QString translate (const char *context, const char *key, const char *disambiguation=0, Encoding encoding=CodecForTr)
static QString translate (const char *context, const char *key, const char *disambiguation, Encoding encoding, int n)

Protected Member Functions

virtual void childEvent (QChildEvent *)
virtual bool compressEvent (QEvent *, QObject *receiver, QPostEventList *)
virtual void connectNotify (const char *signal)
virtual void customEvent (QEvent *)
virtual void disconnectNotify (const char *signal)
bool event (QEvent *)
 QCoreApplication (QCoreApplicationPrivate &p)
int receivers (const char *signal) const
QObjectsender () const
virtual void timerEvent (QTimerEvent *)

Protected Attributes

QObjectDatad_ptr

Static Protected Attributes

static const QMetaObject staticQtMetaObject

Properties

QString applicationName
 the name of this application
QString applicationVersion
 the version of this application
QString objectName
 the name of this object
QString organizationDomain
 the Internet domain of the organization that wrote this application
QString organizationName
 the name of the organization that wrote this application

Private Member Functions

void init ()
bool notifyInternal (QObject *receiver, QEvent *event)

Static Private Member Functions

static bool sendSpontaneousEvent (QObject *receiver, QEvent *event)

Static Private Attributes

static QCoreApplicationself = 0

Friends

class Q3AccelManager
class QApplication
class QApplicationPrivate
Q_CORE_EXPORT QString qAppName ()
class QClassFactory
class QCoreApplication
class QCoreApplicationPrivate
class QETWidget
class QEventDispatcherUNIXPrivate
struct QMetaObject
class QShortcutMap
bool qt_sendSpontaneousEvent (QObject *, QEvent *)
class QThreadData
class QWidget
class QWidgetPrivate

Related Functions

(Note that these are not member functions.)


void qAddPostRoutine (QtCleanUpFunction ptr)
qFindChild (const QObject *obj, const QString &name)
qFindChildqFindChildren (const QObject *obj, const QString &name=QString(), T dummy=0)()
QList< T > qFindChildren (const QObject *obj, const QString &name)
QList< T > qFindChildrenqFindChildren (const QObject *obj, const QString &name=QString(), T dummy=0)()
QList< T > qFindChildrenqFindChildren (const QObject *obj, const QRegExp &regExp)()
T * qobject_cast (QObject *object)
 QObjectList
void * qt_find_obj_child (QObject *parent, const char *type, const QString &name)
 removePostedEvents

Detailed Description

The QCoreApplication class provides an event loop for console Qt applications.

This class is used by non-GUI applications to provide their event loop. For non-GUI application that uses Qt, there should be exactly one QCoreApplication object. For GUI applications, see QApplication.

QCoreApplication contains the main event loop, where all events from the operating system (e.g., timer and network events) and other sources are processed and dispatched. It also handles the application's initialization and finalization, as well as system-wide and application-wide settings.

The command line arguments which QCoreApplication's constructor should be called with are accessible using arguments(). The event loop is started with a call to exec(). Long running operations can call processEvents() to keep the application responsive.

Some Qt classes, such as QString, can be used without a QCoreApplication object. However, in general, we recommend that you create a QCoreApplication or a QApplication object in your main() function as early as possible. The application will enter the event loop when exec() is called. exit() will not return until the event loop exits, e.g., when quit() is called.

An application has an applicationDirPath() and an applicationFilePath(). Translation files can be added or removed using installTranslator() and removeTranslator(). Application strings can be translated using translate(). The QObject::tr() and QObject::trUtf8() functions are implemented in terms of translate().

The class provides a quit() slot and an aboutToQuit() signal.

Several static convenience functions are also provided. The QCoreApplication object is available from instance(). Events can be sent or posted using sendEvent(), postEvent(), and sendPostedEvents(). Pending events can be removed with removePostedEvents() or flushed with flush(). Library paths (see QLibrary) can be retrieved with libraryPaths() and manipulated by setLibraryPaths(), addLibraryPath(), and removeLibraryPath().

On Unix/Linux Qt is configured to use the system local settings by default. This can cause a conflict when using POSIX functions, for instance, when converting between data types such as floats and strings, since the notation may differ between locales. To get around this problem call the POSIX function setlocale(LC_NUMERIC,"C") right after initializing QApplication or QCoreApplication to reset the locale that is used for number formatting to "C"-locale.

See also:
QApplication, QAbstractEventDispatcher, QEventLoop, {Semaphores Example}, {Wait Conditions Example}

Definition at line 71 of file qcoreapplication.h.


The documentation for this class was generated from the following files:

Generated by  Doxygen 1.6.0   Back to index