Qt 5.11 | Qt Core | Obsolete Members for <QtGlobal>

Qt 5.11.3 Reference Documentation

# Obsolete Members for <QtGlobal>

The following members of class <QtGlobal> are obsolete. They are provided to keep old source code working. We strongly advise against using them in new code.

## Types

`(obsolete)` typedef | QtMsgHandler

## Functions

`(obsolete)` QtMsgHandler | qInstallMsgHandler(QtMsgHandler handler)
`(obsolete)` int | qrand()
`(obsolete)` void | qsrand(uint seed)

## Macros

`(obsolete)` | QABS(n)
`(obsolete)` | QMAX(x, y)
`(obsolete)` | QMIN(x, y)

## Type Documentation

### typedef QtMsgHandler

This is a typedef for a pointer to a function with the following signature:

      void myMsgHandler(QtMsgType, const char *);

This typedef is deprecated, you should use QtMessageHandler instead.

See also QtMsgType, QtMessageHandler, qInstallMsgHandler(), and qInstallMessageHandler().

## Function Documentation

### QtMsgHandler qInstallMsgHandler(QtMsgHandler handler)

Installs a Qt message handler which has been defined previously. This method is deprecated, use qInstallMessageHandler instead.

See also QtMsgHandler and qInstallMessageHandler().

### 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. Seeding must be performed at least once on each thread. If that step is skipped, then the sequence will be pre-seeded with a constant value.

Note: This function is deprecated. In new applications, use QRandomGenerator instead.

This function was introduced in Qt 4.2.

See also qrand() and QRandomGenerator.

### void qsrand(uint 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().

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

Note: This function is deprecated. In new applications, use QRandomGenerator instead.

This function was introduced in Qt 4.2.

See also qrand() and QRandomGenerator.

## Macro Documentation

### QABS(n)

Use qAbs(n) instead.

See also QMIN() and QMAX().

### QMAX(x, y)

Use qMax(x, y) instead.

See also QMIN() and QABS().

### QMIN(x, y)

Use qMin(x, y) instead.

See also QMAX() and QABS().