tem*_*ema 0 qt multithreading qpixmap drawing2d
我有一个特定的目标:画一个路网.所以我有一些点(x,y),我想连接它们(使用drawLine函数).因为他们的数量(大约2-3百万)我需要在另一个线程中做,所以有一个问题我应该怎么做?我有一个特殊的绘图区域 - QLabel.我试图通过主线程中的QPixmap来做到这一切都很好,但当我尝试通过另一个线程中的信号/插槽来做它没有图像出现:(
实际上,当我将坐标转换为GUI坐标时,它们变为小数,因此我不知道如何绘制它们,因为drawLine函数具有整数参数:(int x1,int y1,int x2,int y2).
这就是我创建另一个线程的方式(我只需要运行一个函数,所以这是我认为最好的方法)
QtConcurrent::run(this,&MainWindow::parseXML)
希望你会帮助我,因为我会变得疯狂%)
PS我读过多线程绘图不支持QPixmap.所以现在我不知道该怎么做.
QPainter can be used in a thread to paint onto QImage, QPrinter, and QPicture paint devices. Painting onto QPixmaps and QWidgets is not supported. On Mac OS X the automatic progress dialog will not be displayed if you are printing from outside the GUI thread.
如果你需要在Qt GUI线程以外的线程中进行绘制,请执行以下操作:
| 归档时间: |
|
| 查看次数: |
1579 次 |
| 最近记录: |