QCoreApplication 过时成员

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

公共类型

(obsolete) enum 编码 { UnicodeUTF8 }

静态公共成员

(obsolete) void flush ()
(obsolete) bool hasPendingEvents ()
(obsolete) QString translate (const char * context , const char * key , const char * disambiguation , Encoding encoding , int n = -1)

成员类型文档编制

enum QCoreApplication:: 编码

This enum type used to define the 8-bit encoding of character string arguments to translate (). This enum is now obsolete and UTF-8 will be used in all cases.

常量 描述
QCoreApplication::UnicodeUTF8 0 UTF-8. UTF-8.

另请参阅 QObject::tr () 和 QString::fromUtf8 ().

成员函数文档编制

[static] void QCoreApplication:: flush ()

此函数相当于调用 QCoreApplication::eventDispatcher()->flush() ,其也被弃用,见 QAbstractEventDispatcher::flush ()。使用 sendPostedEvents () 和 processEvents () 代替为更细粒度事件循环控制。

在过去,此函数用于刷新特定平台本机事件队列。

另请参阅 sendPostedEvents (), processEvents (),和 QAbstractEventDispatcher::flush ().

[static] bool QCoreApplication:: hasPendingEvents ()

此函数返回 true 若有待决事件;否则返回 false 。待决事件可以来自窗口系统或张贴事件使用 postEvent ().

注意: 此函数不是线程安全的。才可以在主线程中调用它仅当应用程序中没有其他线程在运行时 (包括 Qt 为自身目的而启动的线程)。

另请参阅 QAbstractEventDispatcher::hasPendingEvents ().

[static] QString QCoreApplication:: translate (const char * context , const char * key , const char * disambiguation , 编码 encoding , int n = -1)