diff options
| author | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2018-09-16 10:47:33 +0000 |
|---|---|---|
| committer | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2018-09-16 10:47:33 +0000 |
| commit | b7c2393ecb906cb529c16e23e62550ebf09fb2ef (patch) | |
| tree | 725ead31c506a17ea2bf66a7000b1c3e39aa30d6 /src/qmmpui/coverviewer.cpp | |
| parent | ad93adc50b21179c082da72c63812a2316587277 (diff) | |
| download | qmmp-b7c2393ecb906cb529c16e23e62550ebf09fb2ef.tar.gz qmmp-b7c2393ecb906cb529c16e23e62550ebf09fb2ef.tar.bz2 qmmp-b7c2393ecb906cb529c16e23e62550ebf09fb2ef.zip | |
partial cover editor form implementation
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@8296 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/qmmpui/coverviewer.cpp')
| -rw-r--r-- | src/qmmpui/coverviewer.cpp | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/qmmpui/coverviewer.cpp b/src/qmmpui/coverviewer.cpp index a27702244..5de87cbf3 100644 --- a/src/qmmpui/coverviewer.cpp +++ b/src/qmmpui/coverviewer.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2017 by Ilya Kotov * + * Copyright (C) 2017-2018 by Ilya Kotov * * forkotov02@ya.ru * * * * This program is free software; you can redistribute it and/or modify * @@ -42,14 +42,9 @@ void CoverViewer::setPixmap(const QPixmap &pixmap) update(); } -void CoverViewer::paintEvent(QPaintEvent *) +bool CoverViewer::hasPixmap() const { - if(!m_pixmap.isNull()) - { - QPainter paint(this); - QPixmap pixmap = m_pixmap.scaled(size().width() - 20, size().height() - 20, Qt::KeepAspectRatio, Qt::SmoothTransformation); - paint.drawPixmap((width() - pixmap.width()) / 2, (height() - pixmap.height()) / 2, pixmap); - } + return !m_pixmap.isNull(); } void CoverViewer::saveAs() @@ -61,3 +56,13 @@ void CoverViewer::saveAs() if (!path.isEmpty()) m_pixmap.save(path); } + +void CoverViewer::paintEvent(QPaintEvent *) +{ + if(!m_pixmap.isNull()) + { + QPainter paint(this); + QPixmap pixmap = m_pixmap.scaled(size().width() - 10, size().height() - 10, Qt::KeepAspectRatio, Qt::SmoothTransformation); + paint.drawPixmap((width() - pixmap.width()) / 2, (height() - pixmap.height()) / 2, pixmap); + } +} |
