Initial commit
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
#include "mainwindow.h"
|
||||
#include <QScrollArea>
|
||||
#include <QDir>
|
||||
#include <QKeyEvent>
|
||||
#include <QDebug>
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent),
|
||||
loading(false),
|
||||
queued(0)
|
||||
{
|
||||
m_image = new ImageScrollArea(this);
|
||||
setCentralWidget(m_image);
|
||||
resize(800, 600);
|
||||
|
||||
setWindowTitle(tr("Image Selector"));
|
||||
|
||||
m_ringList = new ImageRingList(this);
|
||||
connect(m_ringList, SIGNAL(pixmapLoaded(QPixmap)), this, SLOT(pixmapLoaded(QPixmap)));
|
||||
|
||||
m_ringList->setDir("/home/nou/Obrázky/jap/dusan-jpg");
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
{
|
||||
}
|
||||
|
||||
void MainWindow::keyPressEvent(QKeyEvent *event)
|
||||
{
|
||||
if(!loading)
|
||||
{
|
||||
switch (event->key())
|
||||
{
|
||||
case Qt::Key_Left:
|
||||
m_ringList->decrement();
|
||||
break;
|
||||
case Qt::Key_Right:
|
||||
m_ringList->increment();
|
||||
break;
|
||||
default:
|
||||
event->ignore();
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
event->ignore();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::keyReleaseEvent(QKeyEvent *event)
|
||||
{
|
||||
event->ignore();
|
||||
}
|
||||
|
||||
void MainWindow::pixmapLoaded(QPixmap pix)
|
||||
{
|
||||
m_image->setImage(pix);
|
||||
}
|
||||
Reference in New Issue
Block a user