-
Notifications
You must be signed in to change notification settings - Fork 0
/
loadwidget.cpp
39 lines (35 loc) · 987 Bytes
/
loadwidget.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include "loadwidget.h"
#include "ui_loadwidget.h"
#include <QFileDialog>
#include <QDir>
#include <QDebug>
LoadWidget::LoadWidget(QWidget *parent) :
QWidget(parent),
ui(new Ui::LoadWidget),
src(new std::string)
{
ui->setupUi(this);
connect(ui->fileBtn, &QPushButton::clicked, this, &LoadWidget::loadFile);
connect(ui->modeBtn, &QPushButton::clicked, this, &LoadWidget::shift2Vdo);
}
LoadWidget::~LoadWidget()
{
delete ui;
}
void LoadWidget::loadFile(){
QString dir = QFileDialog::getOpenFileName(this,
"Image to Load",
QDir::homePath(),
"Images(*.png *.jpg *.jpeg)");
*src = dir.toStdString();
if(src->empty()){
qDebug() << "Image Load Failed.";
}
else{
ui->lineEdit->setText(dir);
emit imageLoadReady();
}
}
std::string* LoadWidget::getSrcDir(){
return src;
}