Qyoto
4.0.5
Qyoto is a C# language binding for Qt
|
The QDebug class provides an output stream for debugging information. More...
Public Member Functions | |
virtual void | CreateProxy () |
new void | Dispose () |
Protected Member Functions | |
QDebug (System.Type dummy) | |
Protected Attributes | |
SmokeInvocation | interceptor |
Properties | |
virtual System.IntPtr | SmokeObject [get, set] |
The QDebug class provides an output stream for debugging information.
QDebug is used whenever the developer needs to write out debugging or tracing information to a device, file, string or console.
Basic Use
In the common case, it is useful to call the qDebug() function to obtain a default QDebug object to use for writing debugging information.
qDebug() << "Date:" << QDate::currentDate();
qDebug() << "Types:" << QString("String") << QChar('x') << QRect(0, 10, 50, 40);
qDebug() << "Custom coordinate type:" << coordinate;
This constructs a QDebug object using the constructor that accepts a QtMsgType value of QtDebugMsg. Similarly, the qWarning(), qCritical() and qFatal() functions also return QDebug objects for the corresponding message types.
The class also provides several constructors for other situations, including a constructor that accepts a QFile or any other QIODevice subclass that is used to write debugging information to files and other devices. The constructor that accepts a QString is used to write to a string for display or serialization.
Writing Custom Types to a Stream
Many standard types can be written to QDebug objects, and Qt provides support for most Qt value types. To add support for custom types, you need to implement a streaming operator, as in the following example:
QDebug operator<<(QDebug dbg, const Coordinate &c)
{
dbg.nospace() << "(" << c.x() << ", " << c.y() << ")";
return dbg.space();
}
This is described in the Debugging Techniques and Creating Custom Qt Types documents.
|
protected |
|
virtual |
new void QtCore.QDebug.Dispose | ( | ) |
|
protected |
|
getset |