-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathListWidget.cpp
More file actions
46 lines (39 loc) · 871 Bytes
/
ListWidget.cpp
File metadata and controls
46 lines (39 loc) · 871 Bytes
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
#include "ListWidget.h"
ListWidget::ListWidget(QWidget *parent)
: QWidget(parent)
{
ui.setupUi(this);
//列表项选中状态改变信号
connect(ui.listWidget, &QListWidget::currentRowChanged, this, &ListWidget::setPushButtonStatus);
}
ListWidget::~ListWidget()
{
}
//显示列表窗口
void ListWidget::showQListWidget(QList<QStringList*> file)
{
ui.listWidget->clear();
for (int i = 0; i < file.size(); i++) {
ui.listWidget->addItem(file[i]->at(1));
}
}
//设置按钮状态
void ListWidget::setPushButtonStatus(int row)
{
if (row > -1) {
ui.pushButton->setEnabled(true);
}
}
//窗口关闭事件
void ListWidget::closeEvent(QCloseEvent * event)
{
emit closeDown();
}
//下载按钮
void ListWidget::on_pushButton_clicked()
{
if (ui.listWidget->currentRow() > -1) {
emit currentNum(ui.listWidget->currentRow());
this->hide();
}
}