软件开发-专业英语(主Qt-help)

QIODevice Class 的一段描述:
Certain subclasses of QIODevice, such as QTcpSocket and QProcess, are asynchronous. This means that I/O functions such as write() or read() always return immediately, while communication with the device itself may happen when control goes back to the event loop. QIODevice provides functions that allow you to force these operations to be performed immediately, while blocking the calling thread and without entering the event loop. This allows QIODevice subclasses to be used without an event loop, or in a separate thread:

qiodevice的某些子类(如qtcpsocket和qprocess)是异步的。这意味着I/O函数(如write()或read())总是立即返回,而当控制权返回到事件循环时,可能会发生与设备本身的通信(该处没理解…)。qiodevice提供的函数允许您强制–立即执行这些操作,同时阻止调用线程,而不进入事件循环。这允许在没有事件循环或单独线程的情况下使用qiodevice子类: waitForReadyRead() / waitForBytesWritten() -
异步函数是不能保证操作同步的,如在设备(不要局限于socket,还有file甚至自定义的设备),还没有准备好前就read,此时又没有loop,则过去就过去了,不能再次执行。但是若有了阻塞模式,则即使没有loop也能实现数据同步读取。

Reimplement this function to provide a blocking API for a custom device. The default implementation does nothing, and returns false.

Warning: Calling this function from the main (GUI) thread might cause your user interface to freeze.

QHash provides very similar functionality to QMap. The differences are:

  • QHash provides faster lookups than QMap. (See Algorithmic Complexity(算法复杂度)for details.)
  • When iterating over a QMap, the items are always sorted by key. With QHash, the items are arbitrarily(任意的) ordered.

你可能感兴趣的:(其他,Qt帮助文档解读)