写入 GUI 问题
所以我有一个设置,其中两个 imac,imac_1 和 imac_2,通过火线连接。 imac_1 向 imac_2 发送一些调试信息,在 imac_2 上,我有一个 C++ 程序可以捕获调试信息。(见下图)
现在的问题是,如果我直接将调试信息写入 GUI(使用 QT 创建),速度会非常慢,慢是指 GUI 需要时间来加载数据。所以我所做的是将调试信息写入缓冲区,然后将该缓冲区转储到 GUI 中,但这也很慢,因为 GUI 需要时间来加载数据。
我正在考虑将调试信息写入文件,然后将其加载到图形用户界面中。因此,我会将前 10,000 行加载到 GUI 中,然后当用户向下滚动时,我将加载接下来的 10,000 行。
imac_1(发射器)--->火线(中)--> imac_2(接收者)
有什么想法或建议吗???
我正在使用: Mac OS X, 代码, 伊玛克
So i have a setup where two imacs, imac_1 and imac_2, are connected through firewire. imac_1 sends some debugging information to imac_2 and on imac_2 i have a program in c++ that captures debugging information.(see illustration below)
Now the problem is that if i write the debugging info to the GUI (created using QT) directly its very slow, by slow i mean that the GUI takes time to load the data. So what i did was to write the debugging info to a buffer and then dump that buffer into the GUI but that was also slow because the GUI takes time to load the data.
I was thinking of writing the debugging info to a file and then loading that into the gui. So i would load the first 10,000 lines into the gui and then when the user scrolls down i would load next 10,000 lines.
imac_1(transmitter) --->FireWire (medium) --> imac_2 (receiver)
any ideas or suggestions????
i am using:
Mac OS X,
XCode,
imac
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
听起来您的问题与两台计算机的通信无关,而可能是您的 GUI 应用程序。
我建议您尝试您提到的文件方法,即使只是为了将网络组件与讨论分开。然后努力让你的 GUI 更快。
如果一次添加一行文本,这可能会导致速度变慢,但 10,000 行实际上并不算多。
其他方法可能包括在加载文本文件时关闭重绘或类似的操作。
It sounds like your problem has nothing to do with the two computers communicating, but may instead be your GUI application.
I would suggest you try the file approach you mention, if only to isolate the network component from the discussion. Then work on making your GUI faster.
If you are adding the lines of text one at a time, that might account for some of the slowness, but 10,000 lines isn't really that many.
Other approaches might include turning off redrawing or something similar while you are loading in the text file.