QImage DImg::copyQImage(int x, int y, int w, int h) const { if (isNull()) { return QImage(); } DImg img = copy(x, y, w, h); if (img.sixteenBit()) { img.convertDepth(32); } return img.copyQImage(); }
void Canvas::slotCopy() { QRect sel = d->core->getSelectedArea(); if (sel.size().isNull()) // No current selection. { return; } QApplication::setOverrideCursor(Qt::WaitCursor); DImg selDImg = d->core->getImgSelection(); QImage selImg = selDImg.copyQImage(); QMimeData* const mimeData = new QMimeData(); mimeData->setImageData(selImg); QApplication::clipboard()->setMimeData(mimeData, QClipboard::Clipboard); QApplication::restoreOverrideCursor(); }
void PanIconWidget::setImage(int previewWidth, int previewHeight, const DImg& image) { DImg img = DImg(image).smoothScale(previewWidth, previewHeight, Qt::KeepAspectRatio); setImage(img.copyQImage(), image.size()); }