|  | Home · All Classes · Main Classes · Grouped Classes · Modules · Functions |

# QAbstractMessageHandler Class Reference
[QtXmlPatterns module]

The QAbstractMessageHandler class provides a callback interface for receiving messages. More...

     #include <QAbstractMessageHandler>

Inherits QObject.

Note: All the functions in this class are thread-safe.

This class was introduced in Qt 4.4.

- List of all members, including inherited members

### Public Functions

- QAbstractMessageHandler ( QObject * parent = 0 )
- virtual ~QAbstractMessageHandler ()
- void message ( QtMsgType type, const QString & description, const QUrl & identifier = QUrl(), const QSourceLocation & sourceLocation = QSourceLocation() )

- 29 public functions inherited from QObject

### Protected Functions

- virtual void handleMessage ( QtMsgType type, const QString & description, const QUrl & identifier, const QSourceLocation & sourceLocation ) = 0

- 7 protected functions inherited from QObject

### Additional Inherited Members

- 1 property inherited from QObject
- 1 public slot inherited from QObject
- 1 signal inherited from QObject
- 5 static public members inherited from QObject

## Detailed Description

The QAbstractMessageHandler class provides a callback interface for receiving messages.

QAbstractMessageHandler is an abstract base class that provides an interface for receiving messages. Typically one subclass QAbstractMessageHandler and implement the handleMessage() function and subsequently pass a pointer to the code that generates the messages.

The user of QAbstractMessageHandler calls message(). message() forwards the arguments on to handleMessage() which the sub-class has implemented, and while doing so seralizes the calls. This means QAbstractMessageHandler is thread safe.

QAbstractMessageHandler isn't tied to a particular use case. This means that the interpretation of the arguments passed to message(), depends on the context in which it is used, and must therefore be specified in that context.

## Member Function Documentation

### QAbstractMessageHandler::QAbstractMessageHandler ( QObject * parent = 0 )

Constructs a QAbstractMessageHandler.

The argument parent is sent to the QObject's constructor.

### QAbstractMessageHandler::~QAbstractMessageHandler () `[virtual]`

Destructs this QAbstractMessageHandler.

### void QAbstractMessageHandler::handleMessage ( QtMsgType type, const QString & description, const QUrl & identifier, const QSourceLocation & sourceLocation ) `[pure virtual protected]`

This function is re-implemented by the sub-class. It's called by message() and receives its arguments, type, description, identifier and sourceLocation from message() unmodified.

### void QAbstractMessageHandler::message ( QtMsgType type, const QString & description, const QUrl & identifier = QUrl(), const QSourceLocation & sourceLocation = QSourceLocation() )

Sends a message to this message handler.

How type and description, its format and content, are interpreted must be defined by the context in which this message handler is used. identifier is a URI that identifies the message, and therefore is the key to how the other arguments should be interpreted.

sourceLocation identifies where the message was generated.

Since identifier is globally unique, messages from arbitrary sources can safely be identified.

It is the caller's responsibility to guarantee that identifier is a valid QUrl, or a default constructed QUrl.

This function unconditionally calls handleMessage().