ImageView: Modernize

modernize-*

Change-Id: I7fcffa4b455355cbcdc91f7e671e0a88f1091042
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Alessandro Portale
2018-11-11 12:24:06 +01:00
parent 901b2be036
commit 7d56d89f25
10 changed files with 49 additions and 49 deletions

View File

@@ -107,9 +107,7 @@ ImageView::ImageView(ImageViewerFile *file)
setBackgroundBrush(tilePixmap);
}
ImageView::~ImageView()
{
}
ImageView::~ImageView() = default;
void ImageView::reset()
{
@@ -164,7 +162,7 @@ QImage ImageView::renderSvg(const QSize &imageSize) const
QPainter painter;
painter.begin(&image);
#ifndef QT_NO_SVG
QGraphicsSvgItem *svgItem = qgraphicsitem_cast<QGraphicsSvgItem *>(m_imageItem);
auto svgItem = qgraphicsitem_cast<QGraphicsSvgItem *>(m_imageItem);
QTC_ASSERT(svgItem, return image);
svgItem->renderer()->render(&painter, QRectF(QPointF(), QSizeF(imageSize)));
#endif
@@ -209,7 +207,7 @@ QSize ImageView::svgSize() const
void ImageView::exportImage()
{
#ifndef QT_NO_SVG
QGraphicsSvgItem *svgItem = qgraphicsitem_cast<QGraphicsSvgItem *>(m_imageItem);
auto svgItem = qgraphicsitem_cast<QGraphicsSvgItem *>(m_imageItem);
QTC_ASSERT(svgItem, return);
const QFileInfo origFi = m_file->filePath().toFileInfo();
@@ -280,7 +278,7 @@ void ImageView::doScale(qreal factor)
scale(actualFactor, actualFactor);
emitScaleFactor();
if (QGraphicsPixmapItem *pixmapItem = dynamic_cast<QGraphicsPixmapItem *>(m_imageItem))
if (auto pixmapItem = dynamic_cast<QGraphicsPixmapItem *>(m_imageItem))
pixmapItem->setTransformationMode(
transform().m11() < 1 ? Qt::SmoothTransformation : Qt::FastTransformation);
}