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) Q_DECL_FINAL
(obsolete) Q_DECL_OVERRIDE
(obsolete) qMove(x)

Type Documentation

typedef QtMsgHandler

This typedef is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

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)

This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

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

See also QtMsgHandler and qInstallMessageHandler().

int qrand()

This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

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 qsrand() and QRandomGenerator.

void qsrand(uint seed)

This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

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

Q_DECL_FINAL

This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

This macro can be used to declare an overriding virtual or a class as "final", with Java semantics. Further-derived classes can then no longer override this virtual function, or inherit from this class, respectively.

It expands to "final".

The macro goes at the end of the function, usually after the const, if any:

    // more-derived classes no longer permitted to override this:
    virtual void MyWidget::paintEvent(QPaintEvent*) final;

For classes, it goes in front of the : in the class definition, if any:

    class QRect final { // cannot be derived from
        // ...
    };

This function was introduced in Qt 5.0.

See also Q_DECL_OVERRIDE.

Q_DECL_OVERRIDE

This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

This macro can be used to declare an overriding virtual function. Use of this markup will allow the compiler to generate an error if the overriding virtual function does not in fact override anything.

It expands to "override".

The macro goes at the end of the function, usually after the const, if any:

    // generate error if this doesn't actually override anything:
    virtual void MyWidget::paintEvent(QPaintEvent*) override;

This function was introduced in Qt 5.0.

See also Q_DECL_FINAL.

qMove(x)

This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

Use std::move instead.

It expands to "std::move".

qMove takes an rvalue reference to its parameter x, and converts it to an xvalue.

© 2020 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.