|  | Home · All Classes · Modules

# QtCore Module

The QtCore module contains core non-GUI functionality. More...

### Types

- class QAbstractEventDispatcher
- class QAbstractFileEngine
- class QAbstractFileEngineHandler
- class QAbstractFileEngineIterator
- class QAbstractItemModel
- class QAbstractListModel
- class QAbstractTableModel
- class QBasicTimer
- class QBitArray
- class QBuffer
- class QByteArray
- class QByteArrayMatcher
- class QChar
- class QChildEvent
- class QCoreApplication
- class QCryptographicHash
- class QDataStream
- class QDate
- class QDateTime
- class QDir
- class QDirIterator
- class QDynamicPropertyChangeEvent
- class QEvent
- class QEventLoop
- class QFile
- class QFileInfo
- class QFileSystemWatcher
- class QFSFileEngine
- class QGenericArgument
- class QGenericReturnArgument
- class QIODevice
- class QLatin1Char
- class QLatin1String
- class QLibrary
- class QLibraryInfo
- class QLine
- class QLineF
- class QLocale
- class QMetaClassInfo
- class QMetaEnum
- class QMetaMethod
- class QMetaObject
- class QMetaProperty
- class QMetaType
- class QMimeData
- class QModelIndex
- class QMutex
- class QMutexLocker
- class QObject
- class QObjectCleanupHandler
- class QPersistentModelIndex
- class QPluginLoader
- class QPoint
- class QPointF
- class QProcess
- class QReadLocker
- class QReadWriteLock
- class QRect
- class QRectF
- class QRegExp
- class QResource
- class QRunnable
- class QSemaphore
- class QSettings
- class QSharedMemory
- class QSignalMapper
- class QSize
- class QSizeF
- class QSocketNotifier
- class QString
- class QStringList
- class QStringMatcher
- class QStringRef
- class QSysInfo
- class QSystemLocale
- class QSystemSemaphore
- class Qt
- class QTemporaryFile
- class QTextBoundaryFinder
- class QTextCodec
- class QTextDecoder
- class QTextEncoder
- class QTextStream
- class QThread
- class QThreadPool
- class QTime
- class QTimeLine
- class QTimer
- class QTimerEvent
- enum QtMsgType { QtDebugMsg, QtWarningMsg, QtCriticalMsg, QtFatalMsg, QtSystemMsg }
- class QTranslator
- class QUrl
- class QUuid
- class QVariant
- class QWaitCondition
- class QWriteLocker
- class QXmlStreamAttribute
- class QXmlStreamAttributes
- class QXmlStreamEntityDeclaration
- class QXmlStreamEntityResolver
- class QXmlStreamNamespaceDeclaration
- class QXmlStreamNotationDeclaration
- class QXmlStreamReader
- class QXmlStreamWriter

### Module Functions

- QTextStream bin (QTextStream s)
- QTextStream bom (QTextStream s)
- QTextStream center (QTextStream s)
- QTextStream dec (QTextStream s)
- QTextStream endl (QTextStream s)
- QTextStream fixed (QTextStream s)
- QTextStream flush (QTextStream s)
- QTextStream forcepoint (QTextStream s)
- QTextStream forcesign (QTextStream s)
- QTextStream hex (QTextStream s)
- QTextStream left (QTextStream s)
- QTextStream lowercasebase (QTextStream s)
- QTextStream lowercasedigits (QTextStream s)
- QTextStream noforcepoint (QTextStream s)
- QTextStream noforcesign (QTextStream s)
- QTextStream noshowbase (QTextStream s)
- QTextStream oct (QTextStream s)
- pyqtRemoveInputHook ()
- pyqtRestoreInputHook ()
- object pyqtSignature ( signature, result = None)
- object pyqtSlot ( signature, result = None)
- object Q_ARG (object type, object data)
- object Q_ENUMS (...)
- object Q_FLAGS (...)
- object Q_RETURN_ARG (object type)
- float qAbs (float t)
- qAddPostRoutine (callable)
- unsigned long qChecksum (str s)
- QByteArray qCompress (QByteArray data, int compressionLevel = -1)
- qCritical ()
- qDebug ()
- qErrnoWarning (int code, msg)
- qErrnoWarning ( msg)
- qFatal ()
- bool qFuzzyCompare (float p1, float p2)
- float qInf ()
- callable qInstallMsgHandler (callable)
- bool qIsFinite (float d)
- bool qIsInf (float d)
- bool qIsNaN (float d)
- bool qIsNull (float d)
- float qQNaN ()
- int qrand ()
- bool qRegisterResourceData (int, str, str, str)
- qRemovePostRoutine (callable)
- int qRound (float d)
- long qRound64 (float d)
- QTextStreamManipulator qSetFieldWidth (int width)
- QTextStreamManipulator qSetPadChar (QChar ch)
- QTextStreamManipulator qSetRealNumberPrecision (int precision)
- bool qSharedBuild ()
- float qSNaN ()
- qsrand (unsigned long seed)
- qSwap (QBitArray value1, QBitArray value2)
- qSwap (QByteArray value1, QByteArray value2)
- qSwap (QString value1, QString value2)
- qSwap (QUrl value1, QUrl value2)
- qSwap (QVariant value1, QVariant value2)
- object QT_TR_NOOP (object)
- object QT_TR_NOOP_UTF8 (object)
- object QT_TRANSLATE_NOOP (object, object)
- QByteArray qUncompress (QByteArray data)
- bool qUnregisterResourceData (int, str, str, str)
- qVersion ()
- qWarning ()
- QTextStream reset (QTextStream s)
- QTextStream right (QTextStream s)
- QTextStream scientific (QTextStream s)
- QTextStream showbase (QTextStream s)
- object SIGNAL ()
- object SLOT ()
- QTextStream uppercasebase (QTextStream s)
- QTextStream uppercasedigits (QTextStream s)
- QTextStream ws (QTextStream s)

### Module Members

- int PYQT_VERSION
- PYQT_VERSION_STR
- int QT_VERSION
- QT_VERSION_STR

## Detailed Description

The QtCore module contains non-GUI functionality.

All other PyQt modules rely on this module. To import the module use, for example, the following statement:

    from PyQt4 import QtCore

## Type Documentation

### QtMsgType

This enum describes the messages that can be sent to a message handler (QtMsgHandler). You can use the enum to identify and associate the various message types with the appropriate actions.

Constant | Value | Description
--- | --- | ---
`QtDebugMsg` | `0` | A message generated by the qDebug() function.
`QtWarningMsg` | `1` | A message generated by the qWarning() function.
`QtCriticalMsg` | `2` | A message generated by the qCritical() function.
`QtFatalMsg` | `3` | A message generated by the qFatal() function.
`QtSystemMsg` | `QtCriticalMsg` |

See also QtMsgHandler and qInstallMsgHandler().

## Function Documentation

### QTextStream bin (QTextStream s)

Calls QTextStream.setIntegerBase(2) on stream and returns stream.

See also oct(), dec(), hex(), and QTextStream manipulators.

### QTextStream bom (QTextStream s)

Toggles insertion of the Byte Order Mark on stream when QTextStream is used with a UTF codec.

See also QTextStream.setGenerateByteOrderMark() and QTextStream manipulators.

### QTextStream center (QTextStream s)

Calls QTextStream.setFieldAlignment(QTextStream.AlignCenter) on stream and returns stream.

See also left(), right(), and QTextStream manipulators.

### QTextStream dec (QTextStream s)

Calls QTextStream.setIntegerBase(10) on stream and returns stream.

See also bin(), oct(), hex(), and QTextStream manipulators.

### QTextStream endl (QTextStream s)

Writes '\n' to the stream and flushes the stream.

Equivalent to

     stream << '\n' << flush;

Note: On Windows, all '\n' characters are written as '\r\n' if QTextStream's device or string is opened using the QIODevice.Text flag.

See also flush(), reset(), and QTextStream manipulators.

### QTextStream fixed (QTextStream s)

Calls QTextStream.setRealNumberNotation(QTextStream.FixedNotation) on stream and returns stream.

See also scientific() and QTextStream manipulators.

### QTextStream flush (QTextStream s)

Flushes any buffered data waiting to be written to the device.

If QTextStream operates on a string, this function does nothing.

### QTextStream forcepoint (QTextStream s)

Calls QTextStream.setNumberFlags(QTextStream.numberFlags() | QTextStream.ForcePoint) on stream and returns stream.

See also noforcepoint(), forcesign(), showbase(), and QTextStream manipulators.

### QTextStream forcesign (QTextStream s)

Calls QTextStream.setNumberFlags(QTextStream.numberFlags() | QTextStream.ForceSign) on stream and returns stream.

See also noforcesign(), forcepoint(), showbase(), and QTextStream manipulators.

### QTextStream hex (QTextStream s)

Calls QTextStream.setIntegerBase(16) on stream and returns stream.

Note: The hex modifier can only be used for writing to streams.

See also bin(), oct(), dec(), and QTextStream manipulators.

### QTextStream left (QTextStream s)

Calls QTextStream.setFieldAlignment(QTextStream.AlignLeft) on stream and returns stream.

See also right(), center(), and QTextStream manipulators.

### QTextStream lowercasebase (QTextStream s)

Calls QTextStream.setNumberFlags(QTextStream.numberFlags() & ~QTextStream.UppercaseBase) on stream and returns stream.

See also uppercasebase(), lowercasedigits(), and QTextStream manipulators.

### QTextStream lowercasedigits (QTextStream s)

Calls QTextStream.setNumberFlags(QTextStream.numberFlags() & ~QTextStream.UppercaseDigits) on stream and returns stream.

See also uppercasedigits(), lowercasebase(), and QTextStream manipulators.

### QTextStream noforcepoint (QTextStream s)

Calls QTextStream.setNumberFlags(QTextStream.numberFlags() & ~QTextStream.ForcePoint) on stream and returns stream.

See also forcepoint(), noforcesign(), noshowbase(), and QTextStream manipulators.

### QTextStream noforcesign (QTextStream s)

Calls QTextStream.setNumberFlags(QTextStream.numberFlags() & ~QTextStream.ForceSign) on stream and returns stream.

See also forcesign(), noforcepoint(), noshowbase(), and QTextStream manipulators.

### QTextStream noshowbase (QTextStream s)

Calls QTextStream.setNumberFlags(QTextStream.numberFlags() & ~QTextStream.ShowBase) on stream and returns stream.

See also showbase(), noforcesign(), noforcepoint(), and QTextStream manipulators.

### QTextStream oct (QTextStream s)

Calls QTextStream.setIntegerBase(8) on stream and returns stream.

See also bin(), dec(), hex(), and QTextStream manipulators.

### pyqtRemoveInputHook ()

When the QtCore module is imported for the first time it installs a Python input hook (ie. it sets the value of Python's PyOS_InputHook variable). This allows commands to be entered at the interpreter prompt while the application is running. It is then possible to dynamically create new Qt objects and call the methods of any existing Qt object.

The input hook can cause problems for certain types of application, particularly those that provide a similar facility through different means. This function removes the input hook installed by PyQt.

The input hook can be restored using the pyqtRestoreInputHook() function.

### pyqtRestoreInputHook ()

When the QtCore module is imported for the first time it installs a Python input hook (ie. it sets the value of Python's PyOS_InputHook variable). This allows commands to be entered at the interpreter prompt while the application is running. It is then possible to dynamically create new Qt objects and call the methods of any existing Qt object.

The input hook can cause problems for certain types of application, particularly those that provide a similar facility through different means, and so the pyqtRemoveInputHook() function is provided to remove it.

This function will restore the input hook if it has been removed.

### object pyqtSignature ( signature, result = None)

### object pyqtSlot ( signature, result = None)

### object Q_ARG (object type, object data)

### object Q_ENUMS (...)

### object Q_FLAGS (...)

### object Q_RETURN_ARG (object type)

### float qAbs (float t)

Compares value to the 0 of type T and returns the absolute value. Thus if T is double, then value is compared to (double) 0.

Example:

     int absoluteValue;
     int myValue = -4;

     absoluteValue = qAbs(myValue);
     // absoluteValue == 4

### qAddPostRoutine (callable)

### unsigned long qChecksum (str s)

Returns the CRC-16 checksum of the first len bytes of data.

The checksum is independent of the byte order (endianness).

Note: This function is a 16-bit cache conserving (16 entry table) implementation of the CRC-16-CCITT algorithm.

### QByteArray qCompress (QByteArray data, int compressionLevel = -1)

Compresses the data byte array and returns the compressed data in a new byte array.

The compressionLevel parameter specifies how much compression should be used. Valid values are between 0 and 9, with 9 corresponding to the greatest compression (i.e. smaller compressed data) at the cost of using a slower algorithm. Smaller values (8, 7, ..., 1) provide successively less compression at slightly faster speeds. The value 0 corresponds to no compression at all. The default value is -1, which specifies zlib's default compression.

See also qUncompress().

### qCritical ()

Calls the message handler with the critical message msg. If no message handler has been installed, the message is printed to stderr. Under Windows, the message is sent to the debugger.

This function takes a format string and a list of arguments, similar to the C printf() function. The format should be a Latin-1 string.

Example:

     void load(const QString &fileName)
     {
         QFile file(fileName);
         if (!file.exists())
             qCritical("File '%s' does not exist!", qPrintable(fileName));
     }

If you include <QtDebug>, a more convenient syntax is also available:

     qCritical() << "Brush:" << myQBrush << "Other
     value:" << i;

A space is inserted between the items, and a newline is appended at the end.

To supress the output at runtime, install your own message handler with qInstallMsgHandler().

See also qDebug(), qWarning(), qFatal(), qInstallMsgHandler(), and Debugging Techniques.

### qDebug ()

Calls the message handler with the debug message msg. If no message handler has been installed, the message is printed to stderr. Under Windows, the message is sent to the console, if it is a console application; otherwise, it is sent to the debugger. This function does nothing if `QT_NO_DEBUG_OUTPUT` was defined during compilation.

If you pass the function a format string and a list of arguments, it works in similar way to the C printf() function. The format should be a Latin-1 string.

Example:

     qDebug("Items in list: %d", myList.size());

If you include `<QtDebug>`, a more convenient syntax is also available:

     qDebug() << "Brush:" << myQBrush << "Other value:" << i;

With this syntax, the function returns a QDebug object that is configured to use the QtDebugMsg message type. It automatically puts a single space between each item, and outputs a newline at the end. It supports many C++ and Qt types.

To suppress the output at run-time, install your own message handler with qInstallMsgHandler().

See also qWarning(), qCritical(), qFatal(), qInstallMsgHandler(), and Debugging Techniques.

### qErrnoWarning (int code, msg)

### qErrnoWarning ( msg)

### qFatal ()

Calls the message handler with the fatal message msg. If no message handler has been installed, the message is printed to stderr. Under Windows, the message is sent to the debugger.

If you are using the default message handler this function will abort on Unix systems to create a core dump. On Windows, for debug builds, this function will report a _CRT_ERROR enabling you to connect a debugger to the application.

This function takes a format string and a list of arguments, similar to the C printf() function.

Example:

     int divide(int a, int b)
     {
         if (b == 0)                                // program error
             qFatal("divide: cannot divide by zero");
         return a / b;
     }

To supress the output at runtime, install your own message handler with qInstallMsgHandler().

See also qDebug(), qCritical(), qWarning(), qInstallMsgHandler(), and Debugging Techniques.

### bool qFuzzyCompare (float p1, float p2)

Compares the floating point value p1 and p2 and returns `true` if they are considered equal, otherwise `false`.

Note that comparing values where either p1 or p2 is 0.0 will not work. The solution to this is to compare against values greater than or equal to 1.0.

             // Instead of comparing with 0.0
                     qFuzzyCompare(0.0,1.0e-200); // This will return false
             // Compare adding 1 to both values will fix the problem
                     qFuzzyCompare(1 + 0.0, 1 + 1.0e-200); // This will return true

The two numbers are compared in a relative way, where the exactness is stronger the smaller the numbers are.

Note: This function is thread-safe.

This function was introduced in Qt 4.4.

### float qInf ()

### callable qInstallMsgHandler (callable)

The callable argument may also be None.

Installs a Qt message handler which has been defined previously. Returns a pointer to the previous message handler (which may be 0).

The message handler is a function that prints out debug messages, warnings, critical and fatal error messages. The Qt library (debug mode) contains hundreds of warning messages that are printed when internal errors (usually invalid function arguments) occur. Qt built in release mode also contains such warnings unless QT_NO_WARNING_OUTPUT and/or QT_NO_DEBUG_OUTPUT have been set during compilation. If you implement your own message handler, you get total control of these messages.

The default message handler prints the message to the standard output under X11 or to the debugger under Windows. If it is a fatal message, the application aborts immediately.

Only one message handler can be defined, since this is usually done on an application-wide basis to control debug output.

To restore the message handler, call `qInstallMsgHandler(0)`.

Example:

     #include <qapplication.h>
     #include <stdio.h>
     #include <stdlib.h>

     void myMessageOutput(QtMsgType type, const char *msg)
     {
         switch (type) {
         case QtDebugMsg:
             fprintf(stderr, "Debug: %s\n", msg);
             break;
         case QtWarningMsg:
             fprintf(stderr, "Warning: %s\n", msg);
             break;
         case QtCriticalMsg:
             fprintf(stderr, "Critical: %s\n", msg);
             break;
         case QtFatalMsg:
             fprintf(stderr, "Fatal: %s\n", msg);
             abort();
         }
     }

     int main(int argc, char **argv)
     {
         qInstallMsgHandler(myMessageOutput);
         QApplication app(argc, argv);
         ...
         return app.exec();
     }

See also qDebug(), qWarning(), qCritical(), qFatal(), QtMsgType, and Debugging Techniques.

### bool qIsFinite (float d)

### bool qIsInf (float d)

### bool qIsNaN (float d)

### bool qIsNull (float d)

### float qQNaN ()

### int qrand ()

Thread-safe version of the standard C++ `rand()` function.

Returns a value between 0 and `RAND_MAX` (defined in `<cstdlib>` and `<stdlib.h>`), the next number in the current sequence of pseudo-random integers.

Use `qsrand()` to initialize the pseudo-random number generator with a seed value.

This function was introduced in Qt 4.2.

See also qsrand().

### bool qRegisterResourceData (int, str, str, str)

### qRemovePostRoutine (callable)

### int qRound (float d)

Rounds value to the nearest integer.

Example:

     qreal valueA = 2.3;
     qreal valueB = 2.7;

     int roundedValueA = qRound(valueA);
     // roundedValueA = 2
     int roundedValueB = qRound(valueB);
     // roundedValueB = 3

### long qRound64 (float d)

Rounds value to the nearest 64-bit integer.

Example:

     qreal valueA = 42949672960.3;
     qreal valueB = 42949672960.7;

     int roundedValueA = qRound(valueA);
     // roundedValueA = 42949672960
     int roundedValueB = qRound(valueB);
     // roundedValueB = 42949672961

### QTextStreamManipulator qSetFieldWidth (int width)

Equivalent to QTextStream.setFieldWidth(width).

### QTextStreamManipulator qSetPadChar (QChar ch)

Equivalent to QTextStream.setPadChar(ch).

### QTextStreamManipulator qSetRealNumberPrecision (int precision)

Equivalent to QTextStream.setRealNumberPrecision(precision).

### bool qSharedBuild ()

### float qSNaN ()

### qsrand (unsigned long seed)

Thread-safe version of the standard C++ `srand()` function.

Sets the argument seed to be used to generate a new random number sequence of pseudo random integers to be returned by qrand().

If no seed value is provided, qrand() is automatically seeded with a value of 1.

The sequence of random numbers generated is deterministic per thread. For example, if two threads call qsrand(1) and subsequently calls qrand(), the threads will get the same random number sequence.

This function was introduced in Qt 4.2.

See also qrand().

### qSwap (QBitArray value1, QBitArray value2)

### qSwap (QByteArray value1, QByteArray value2)

### qSwap (QString value1, QString value2)

### qSwap (QUrl value1, QUrl value2)

### qSwap (QVariant value1, QVariant value2)

### object QT_TR_NOOP (object)

Marks the string literal sourceText for dynamic translation in the current context (class), i.e the stored sourceText will not be altered.

The macro expands to sourceText.

Example:

     QString FriendlyConversation.greeting(int type)
     {
     static const char *greeting_strings[] = {
         QT_TR_NOOP("Hello"),
         QT_TR_NOOP("Goodbye")
     };
     return tr(greeting_strings[type]);
     }

The macro QT_TR_NOOP_UTF8() is identical except that it tells lupdate that the source string is encoded in UTF-8. Corresponding variants exist in the QT_TRANSLATE_NOOP() family of macros, too. Note that using these macros is not required if `CODECFORTR` is already set to UTF-8 in the qmake project file.

See also QT_TRANSLATE_NOOP() and Internationalization with Qt.

### object QT_TR_NOOP_UTF8 (object)

### object QT_TRANSLATE_NOOP (object, object)

Marks the string literal sourceText for dynamic translation in the given context, i.e the stored sourceText will not be altered. The context is typically a class and also needs to be specified as string literal.

The macro expands to sourceText.

Example:

     static const char *greeting_strings[] = {
         QT_TRANSLATE_NOOP("FriendlyConversation", "Hello"),
         QT_TRANSLATE_NOOP("FriendlyConversation", "Goodbye")
     };

     QString FriendlyConversation.greeting(int type)
     {
         return tr(greeting_strings[type]);
     }

     QString global_greeting(int type)
     {
         return qApp->translate("FriendlyConversation",
                greeting_strings[type]);
     }

See also QT_TR_NOOP(), QT_TRANSLATE_NOOP3(), and Internationalization with Qt.

### QByteArray qUncompress (QByteArray data)

Uncompresses the data byte array and returns a new byte array with the uncompressed data.

Returns an empty QByteArray if the input data was corrupt.

This function will uncompress data compressed with qCompress() from this and any earlier Qt version, back to Qt 3.1 when this feature was added.

Note: If you want to use this function to uncompress external data compressed using zlib, you first need to prepend four bytes to the byte array that contain the expected length (as an unsigned integer) of the uncompressed data encoded in big-endian order (most significant byte first).

See also qCompress().

### bool qUnregisterResourceData (int, str, str, str)

### qVersion ()

Returns the version number of Qt at run-time as a string (for example, "4.1.2"). This may be a different version than the version the application was compiled against.

See also QT_VERSION_STR.

### qWarning ()

Calls the message handler with the warning message msg. If no message handler has been installed, the message is printed to stderr. Under Windows, the message is sent to the debugger. This function does nothing if `QT_NO_WARNING_OUTPUT` was defined during compilation; it exits if the environment variable `QT_FATAL_WARNINGS` is defined.

This function takes a format string and a list of arguments, similar to the C printf() function. The format should be a Latin-1 string.

Example:

     void f(int c)
     {
         if (c > 200)
             qWarning("f: bad argument, c == %d", c);
     }

If you include <QtDebug>, a more convenient syntax is also available:

     qWarning() << "Brush:" << myQBrush << "Other value:"
     << i;

This syntax inserts a space between each item, and appends a newline at the end.

To supress the output at runtime, install your own message handler with qInstallMsgHandler().

See also qDebug(), qCritical(), qFatal(), qInstallMsgHandler(), and Debugging Techniques.

### QTextStream reset (QTextStream s)

Resets QTextStream's formatting options, bringing it back to its original constructed state. The device, string and any buffered data is left untouched.

### QTextStream right (QTextStream s)

Calls QTextStream.setFieldAlignment(QTextStream.AlignRight) on stream and returns stream.

See also left(), center(), and QTextStream manipulators.

### QTextStream scientific (QTextStream s)

Calls QTextStream.setRealNumberNotation(QTextStream.ScientificNotation) on stream and returns stream.

See also fixed() and QTextStream manipulators.

### QTextStream showbase (QTextStream s)

Calls QTextStream.setNumberFlags(QTextStream.numberFlags() | QTextStream.ShowBase) on stream and returns stream.

See also noshowbase(), forcesign(), forcepoint(), and QTextStream manipulators.

### object SIGNAL ()

### object SLOT ()

### QTextStream uppercasebase (QTextStream s)

Calls QTextStream.setNumberFlags(QTextStream.numberFlags() | QTextStream.UppercaseBase) on stream and returns stream.

See also lowercasebase(), uppercasedigits(), and QTextStream manipulators.

### QTextStream uppercasedigits (QTextStream s)

Calls QTextStream.setNumberFlags(QTextStream.numberFlags() | QTextStream.UppercaseDigits) on stream and returns stream.

See also lowercasedigits(), uppercasebase(), and QTextStream manipulators.

### QTextStream ws (QTextStream s)

Calls skipWhiteSpace() on stream and returns stream.

See also QTextStream manipulators.

## Member Documentation

### int PYQT_VERSION

This member should be treated as a constant.

### PYQT_VERSION_STR

This member should be treated as a constant.

### int QT_VERSION

This member should be treated as a constant.

### QT_VERSION_STR

This member should be treated as a constant.