QQuickPaintedItem not update whole area.
Solved
QML and Qt Quick
-
Hi
I create class inherit form QQuickPaintedItem class.
and write void paint(QPainter painter);*
like below...
// set image data to display on QQuickItem void QuickImageItem::setImage(const QImage &image) { this->current_image = image.mirrored(this->_flipHorizontally, !this->_flipVertically); update(); } ... // here is paint funciton void QuickImageItem::paint(QPainter *painter) { if (this->image().isNull() != true) { QRectF bounding_rect = boundingRect(); // do something... if (this->_cropWidth != -1 && this->_cropHeight != -1) { int imageWidth = this->image().width(); int imageHeight = this->image().height(); pixmap = pixmap.copy((imageHeight - this->_cropHeight) / 2, (imageWidth - this->_cropWidth) / 2, this->_cropHeight, this->_cropWidth); } painter->setRenderHints(QPainter::HighQualityAntialiasing | QPainter::SmoothPixmapTransform, true); // draw image painter->drawPixmap(0, 0, drawWidth, drawHeight, pixmap); } }
first set image was darwed very well.
but after change this->current_image it update partially.
Like above image.
The black area in red rectangle is I changed image and this size is same with person image.
I chnaged current_image variable and call update(). but not update whole image area.
Is there something I missing?