#include "openfile.h"

 #include <QFileDialog>
#include <QMouseEvent>

OpenFile::OpenFile(QWidget* parent): QPushButton(parent)
{

}


void OpenFile::mousePressEvent(QMouseEvent* e)
{
        // ignorujeme dvojkliky jiným než pravým tlačítkem myši
        if(e->buttons() != Qt::LeftButton)
                return;

        QString fileName = QFileDialog::getOpenFileName(this, tr("Nacti obraz"),
                                                           "",
                                                           tr("JPEG (*.jpg *.jpeg);;PNG (*.png);;Image (*.jpg *.png)"));

        emit file_selected(fileName);

}



