Results 1 to 2 of 2

Thread: Threads and QwtPainter::drawText

  1. #1

    Default Threads and QwtPainter::drawText

    Hello, I'm trying to run the 'drawCanvas' function in a seperate thread. However, QwtPainter::drawText has been a show stopper for me.

    Q_ASSERT(qApp && qApp->thread() == QThread::currentThread());

    I'm confronted with this debug error shower above. Which I'm assuming its complaining that the GUI thread is not calling this, but I don't understand why.

    Going up the call stack eventually leads to this:

    QNativeImage *mask = drawGDIGlyph(font, glyph, 0, xform);

    And going further up stops me at QwtPainter::drawText of course... specifically this one

    void QwtPainter::drawText(QPainter *painter, int x, int y,
    const QString &text)

    my painter's device is a QImage.

    If anyone has any ideas or solutions, I would be thankful!

  2. #2

    Default Re: Threads and QwtPainter::drawText

    Sorry for double post, I couldn't find the edit button if there is one.

    I believe this is a problem of using fonts/text outside of the main thread. I have read about using QPainterPaths as a work around but it would require alot of subclassing.
    And even if you used QPainterPaths you must create them in the GUI which is also inconvient.

    I'm hoping to find a more ideal solution if possible.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.