-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlistfiledialog.cpp
executable file
·78 lines (49 loc) · 1.39 KB
/
listfiledialog.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#include "listfiledialog.h"
#include "ui_listfiledialog.h"
// #include <QDebug>
listfileDialog::listfileDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::listfileDialog)
{
ui->setupUi(this);
}
listfileDialog::~listfileDialog()
{
delete ui;
}
///////////////////////////////////////////////////
void listfileDialog::setFilelist(const QStringList &filelist) {
// qDebug() << filelist;
for (QStringList::const_iterator it = filelist.begin();
it != filelist.end(); ++it)
{
//currentitem1 = *it;
ui->flistWidget->addItem(*it);
}
}
////////////////////////////////////////////////////
void listfileDialog::setDialogTitle(const QString &dtitle) {
this->setWindowTitle(dtitle);
}
///////////////////////////////////////////////
void listfileDialog::on_selectButton_clicked()
{
QStringList mstringlist;
if( ui->flistWidget->selectedItems().count() >= 1 )
{
foreach( QListWidgetItem *item, ui->flistWidget->selectedItems() )
mstringlist << item->text();
}
else return;
fitem=mstringlist.at(0);
}
//////////////////////////////////
void listfileDialog::on_flistWidget_doubleClicked(const QModelIndex &index)
{
fitem=index.data(Qt::DisplayRole).toString();
listfileDialog::accept();
}
///////////////////////////////////////////////////
QString listfileDialog::return_fitem() {
return fitem;
}