C++ (Qt)#include <QtGui/QApplication>#include <QFuture>#include <QtConcurrentRun> void hello(){ qDebug() << "Hello from thread " << QThread::currentThread();} int main(int argc, char *argv[]){ QApplication a(argc, argv); QFuture<void> future = QtConcurrent::run(hello); qDebug() << "hello from GUI thread " << QThread::currentThread(); future.waitForFinished(); return 0; }
C++ (Qt)void QOutputDev::startPage (int pageNum, GfxState *state){ m_pageNum=pageNum; m_image = new QImage((int)state-> getPageWidth( ),(int)state-> getPageHeight( ),QImage::Format_ARGB32); m_painter = new QPainter (m_image ); m_painter->setBrush(QBrush(Qt::white)); QPainterPath path; //path.addRoundedRect(0,0,m_image->width(),m_image->height(),20,20); path.addRect(0,0,m_image->width(),m_image->height()); m_painter->drawPath(path);}
C++ (Qt)void QOutputDev::endPage(){ paint(); m_painter->end(); delete m_image; delete m_painter;}