How to manipulate with Canvas image in C++ code?

  • Hello!
    I have used Qt 4.8.4 and have had C++ component which have been derived from QDeclarativeItem with my method "void paint(QPainter *p, const QStyleOptionGraphicsItem *s, QWidget *w);"
    I moved my project to Qt 5 and there was a lot of lags and I tried to use new QML item "Canvas" with "renderStrategy: Canvas.Threaded"/ It works really good for me but now I have problem...
    I have a lot of C++ code which manipulate with pixels of my "old item" and i don't want to move it in QML.
    How can I get Image in C++ from QML Canvas element?
    I have tried to send "CanvasImageData" and "" elements from my canvas's context (canvas.context.getImageData) but it was failed ((
    Please, help me
    PS. I really need to get image data in C++ code. Don't advise me to move my C++ code to QML.


    bool save(string filename)

    Save the current canvas content into an image file filename. The saved image format is automatically decided by the filename's suffix.

    Note: calling this method will force painting the whole canvas, not just the current canvas visible window.

  • This method is bad for me because there is some lags while saving...

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.