Results 1 to 14 of 14

Thread: Printing QwtPlot on QImage from inside a thread

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Printing QwtPlot on QImage from inside a thread

    Hi, I am new to Qwt,,
    I am facing a problem in which I get crash when I call QwtPlot::replot or QwtPlot::Print from inside a thread. My use case is, I need to send data from a thread, and to speed up things I wanted to print the plot and send the image.
    But when I call replot or print,,, I get the following as attached in the image.
    I guess it is because we cant paint to QPixmap from thread, and I have seen that QwtPlot uses Qpixmap as cache. But i also tried disabling the caching by -
    plot->canvas()->setPaintAttribute(QwtPlotCanvas::PaintCached,fals e); but still getting crash.

    From call stack I see that qwt accesses font metric and -
    In QWidget::metric() --
    HDC gdc = qt_win_display_dc();

    In Q_GUI_EXPORT HDC qt_win_display_dc() // get display DC
    {
    Q_ASSERT(qApp && qApp->thread() == QThread::currentThread());

    Thats where it fails.

    I searched the forum but cudnt get a solution to my problem. I just need the plot in QImage inside the thread. I need it to send to some other client. I am very much stuck and help will be highly appreciated.
    Attached Images Attached Images

Similar Threads

  1. print picture (QImage) from non GUI thread
    By valeron in forum Qt Programming
    Replies: 1
    Last Post: 30th April 2013, 19:35
  2. QwtPlot inside QScrollArea
    By mastupristi in forum Qwt
    Replies: 3
    Last Post: 13th October 2009, 04:28
  3. KDE/QWT doubt on debian sarge
    By hildebrand in forum KDE Forum
    Replies: 13
    Last Post: 25th April 2007, 06:13
  4. Replies: 10
    Last Post: 20th March 2007, 22:19
  5. [QT4] QThread and printing a QList<QPixmap>
    By KShots in forum Qt Programming
    Replies: 3
    Last Post: 24th April 2006, 21:44

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
  •  
Qt is a trademark of The Qt Company.