Obsolete Members for <QtGlobal>

以下成员源于类 <QtGlobal> 已过时。 提供它们是为使旧源代码能继续工作。强烈建议不要在新代码中使用它们。

类型

(obsolete) typedef QtMsgHandler

函数

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

(obsolete) Q_DECL_FINAL
(obsolete) Q_DECL_OVERRIDE
(obsolete) qMove ( x )

类型文档编制

typedef QtMsgHandler

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

这是采用以下签名的函数指针的 typedef:

void myMsgHandler(QtMsgType, const char *);
					

This typedef is deprecated, you should use QtMessageHandler 代替。

另请参阅 QtMsgType , QtMessageHandler , qInstallMsgHandler (),和 qInstallMessageHandler ().

函数文档编制

QtMsgHandler qInstallMsgHandler ( QtMsgHandler handler )

此函数已过时。提供它是为使旧源代码能继续工作。强烈建议不要在新代码中使用它。

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

另请参阅 QtMsgHandler and qInstallMessageHandler ().

int qrand ()

此函数已过时。提供它是为使旧源代码能继续工作。强烈建议不要在新代码中使用它。

Thread-safe version of the standard C++ rand() 函数。

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.

使用 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.

注意: This function is deprecated. In new applications, use QRandomGenerator 代替。

该函数在 Qt 4.2 引入。

另请参阅 qsrand () 和 QRandomGenerator .

void qsrand ( uint seed )

此函数已过时。提供它是为使旧源代码能继续工作。强烈建议不要在新代码中使用它。

Thread-safe version of the standard C++ srand() 函数。

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.

注意: This function is deprecated. In new applications, use QRandomGenerator 代替。

该函数在 Qt 4.2 引入。

另请参阅 qrand () 和 QRandomGenerator .

宏文档编制

Q_DECL_FINAL

此函数已过时。提供它是为使旧源代码能继续工作。强烈建议不要在新代码中使用它。

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
        // ...
    };
					

该函数在 Qt 5.0 引入。

另请参阅 Q_DECL_OVERRIDE .

Q_DECL_OVERRIDE

此函数已过时。提供它是为使旧源代码能继续工作。强烈建议不要在新代码中使用它。

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;
					

该函数在 Qt 5.0 引入。

另请参阅 Q_DECL_FINAL .

qMove ( x )

此函数已过时。提供它是为使旧源代码能继续工作。强烈建议不要在新代码中使用它。

使用 std::move 代替。

It expands to "std::move".

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