问题标签 [qiodevice]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
2 回答
127 浏览

c++ - 有效载荷中的 C++/Qt 字符串终止符

在通过 IPC、串行、以太网等通信接口发送字符串时,程序员如何处理字符串终止...

仅保留字符串终止并因此仅在有效负载缓冲区中附加多个字符串是否合法?

或者是否有一条规则说不,你不通过通信接口发送字符串终止?

谢谢

0 投票
3 回答
26971 浏览

c++ - readyRead() 在 Qt 中是如何工作的?

这是我在这个网站上的第一个问题!

我从一个 COM 端口读取数据时遇到了一些问题,我从另一个 COM 端口发送了一条完整的消息,当我用 Qt 接收它时,它总是被分成多个子消息。

发送的消息是 25 或 27 字节长,如果我使用 Putty 或超级终端来阅读它们,我没有问题。此外,如果我使用 2 个仿真串行端口 COM 进行通信,我没有这个问题......它只发生在 Qt 读取系统和 2 个物理 COM 端口......

我想我没有得到 readyRead 信号准确发出的时间......

我很困惑,提前感谢您的帮助!

0 投票
2 回答
183 浏览

python - 如何更改 qtwebkit 中的 POST 数据?

要更改 qtwebkit 中的 POST 变量,需要更改或替换 createRequest(...) 中的输出数据。如何创建自己的<PyQt4.QtCore.QIODevice object at 0x03BA...>不是 QFile 或 QByteArray。正是 QIODevice 对象!创建可写设备需要它。或者如何转换<PyQt4.QtCore.QBuffer object at 0x03BA...><PyQt4.QtCore.QIODevice object at 0x03BA...>.
QNetworkAccessManager中最常用的这个设备:
https ://qt.gitorious.org/qt/webkit/source/7647fdaf9a4b526581e02fbd0e87c41a96cbfebb:src/network/access/qnetworkaccessmanager.cpp#L941

更新:调用此方法后:

脚本挂了……

0 投票
0 回答
310 浏览

python - 如何创建具有此类属性的顺序 PyQt4.QtCore.QIODevice?

请向我展示如何创建 -PyQt4.QtCore.QIODevice使用顺序访问的示例。这必须是这样的 QIODevice:

打印目录(数据)
打印 - ['Append','NotOpen','OpenMode','OpenModeFlag','ReadOnly','ReadWrite','Text','Truncate','Unbuffered','WriteOnly',''、' delattr '、' dict '、' doc '、' format '、' getattr '、' getattribute '、' hash '、' init '、' module '、' new '、' reduce '、' reduce_ex '、 '代表','setattr ', ' sizeof ', ' str ', ' subclasshook ', ' weakref','aboutToClose','atEnd','blockSignals','bytesAvailable','bytesToWrite','bytesWritten','canReadLine','childEvent','children','close','connect','connectNotify', 'customEvent'、'deleteLater'、'destroyed'、'disconnect'、'disconnectNotify'、'dumpObjectInfo'、'dumpObjectTree'、'dynamicPropertyNames'、'emit'、'errorString'、'event'、'eventFilter'、'findChild ','findChildren','getChar','inherits','installEventFilter','isOpen','isReadable','isSequential','isTextModeEnabled','isWidgetType','isWritable','killTimer','metaObject', 'moveToThread','objectName','open','openMode','parent','peek','pos','property','putChar','pyqtConfigure','read','readAll','readChannelFinished' ,'readData','readLine','readLineData','readyRead','receivers','removeEventFilter','reset','seek','sender','senderSignalIndex','setErrorString','setObjectName',' setOpenMode'、'setParent'、'setProperty'、'setTextModeEnabled'、'signalsBlocked'、'size'、'startTimer'、'staticMetaObject'、'thread'、'timerEvent'、'tr'、'trUtf8'、'ungetChar' , 'waitForBytesWritten', 'waitForReadyRead','write','writeData']

0 投票
1 回答
1705 浏览

qt - How to write a raw QByteArray or manipulate the QByteArray

I defined a QIODevice (especially a QTcpSocket) and would like to write a string as raw format. I describe my wishes with the following example:

If I open the Output.txt in the Hex Editor I get the following result:

But thats not what I want. Is it possible to cut the lenth from 4bytes to just 2bytes? Or is it possible to grab just the string and define my own length of 2bytes instead?

The reason why I am asking is that I would like to send a message to a server. But the server accepts just packets in the following format:

Any help would be great =)

0 投票
1 回答
211 浏览

encryption - 连接 QMediaPlayer 和 QIODevice

我正在开发一个创建安全视频播放器的项目。我想在使用 QMediaPlayer 类时即时实现视频加密。有人可以帮我实现这一目标吗?将解密的数据写入 QIODevice 并从 QIODevice 读取是否正确?如果是这样,我可以获得一个示例实现吗?

提前致谢

0 投票
0 回答
187 浏览

c++ - 如何确定我处于 QIODevice 的“末端”?

我正在尝试提出一种算法来检测何时QIODevice达到 a 的“结束”(这意味着将不再有数据可供读取)。目前,我的算法看起来像这样:

但是,文档atEnd()包含以下警告:

对于某些设备,即使有更多数据要读取,atEnd() 也可以返回 true。这种特殊情况仅适用于生成数据以直接响应您调用 read() 的设备(例如,Unix 和 OS X 上的 /dev 或 /proc 文件,或所有平台上的控制台输入 /stdin)。

这就是我的算法崩溃的地方。我的下一个想法是不断检查bytesAvailable()从常规文件读取时的值。这产生了一些非常奇怪的结果/dev/zero:在我调用之前bytesAvailable()返回,此时它表明还有字节剩余。0read(amount)16384 - amount

是否有任何“正确”的方法来确定是否仍有数据可从 a 中读取QIODevice

0 投票
1 回答
1501 浏览

c++ - Qt 中是否有进程内本地管道?

Qt 是否有一QIODevice对可用于进程点对点通信?

可以使用具体的QTCPSocketor QLocalSocket,但是服务器端的连接 API 有点麻烦,并且通过操作系统强制数据似乎很浪费。

0 投票
0 回答
123 浏览

qt - QtextStream::readAll() 是否刷新我的 QTextStream 对象?

QtextStream textStream已经填满了我的对象。当它不以“}”结尾时,我想在这种情况下附加一个“}”:

但在此之后,我的 TextStream 只是 "}" 吗?那么 readAll 会刷新 TextStream 吗?否则我怎么能解决这个问题?

0 投票
1 回答
149 浏览

qt - Qt 4.8 Why my QIODevice not output a text in this code?

If used QTextStream console(stdout) - all work just fine, but if I wrote custom IODevice, after qInstallMsgHandler() no text in console

main.cpp #include "remoteconsole.h"

my IODevice implementation in file remoteconsole.h .cpp

In future I want to expand this code with QTCPServer, that send debug outputs to client connected to the device by telnet or nc.