image viewer

This commit is contained in:
2019-04-03 16:11:22 +02:00
parent 5aa22fbfdd
commit a643810119
7 changed files with 223 additions and 2 deletions
+25
View File
@@ -1,11 +1,13 @@
#include "clabel.h"
#include <QResizeEvent>
#include <QKeyEvent>
cLabel::cLabel(QWidget *parent, Qt::WindowFlags f) :
QLabel(parent, f)
{
installEventFilter(this);
}
cLabel::cLabel(const QString &text, QWidget *parent, Qt::WindowFlags f) :
@@ -23,3 +25,26 @@ void cLabel::resizeEvent(QResizeEvent* e)
QLabel::resizeEvent(e);
setPixmap(QPixmap::fromImage(m_lpImage->scaled(width(), height(), Qt::AspectRatioMode::KeepAspectRatio, Qt::TransformationMode::SmoothTransformation)));
}
void cLabel::keyPressEvent(QKeyEvent* e)
{
switch(e->key())
{
case Qt::Key_Left:
emit imagePrev();
break;
case Qt::Key_Right:
emit imageNext();
break;
case Qt::Key_Home:
emit imageFirst();
break;
case Qt::Key_End:
emit imageLast();
break;
default:
break;
}
QLabel::keyPressEvent(e);
}