diff options
Diffstat (limited to 'viewer.cpp')
-rw-r--r-- | viewer.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -7,6 +7,7 @@ #include <QDir> #include <QWheelEvent> +#include "helper.h" #include "viewer.h" Viewer::Viewer(QWidget *parent, Qt::WindowFlags f) : QWidget(parent, f), mCurIndex(-1) { @@ -43,7 +44,21 @@ void Viewer::setFile(const QString &file, bool allFiles){ } } +void Viewer::preview(const QString &file){ + mFiles.clear(); + mCurIndex = -1; + QPixmap pm = Helper::preview(file); + mLabel->setPixmap(pm); + QString winTitle = QString(tr("%1 Viewer: [Preview %2]")).arg(qApp->applicationName()).arg(file); + setWindowTitle(winTitle); + adjustSize(); +} + + void Viewer::wheelEvent(QWheelEvent *event){ + if(mCurIndex == -1){ + return; + } QPoint numDeg = event->angleDelta() / 8; if(numDeg.y() < 0){ //this is scrolling down -> next! if(mCurIndex + 1 >= mFiles.count()){ |