You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.2 KiB
44 lines
1.2 KiB
#include "devicelist.h" |
|
#include "ui_devicelist.h" |
|
#include <QDir> |
|
#include <QLabel> |
|
#include <QDebug> |
|
#include <QTableWidgetItem> |
|
|
|
devicelist::devicelist(QWidget *parent) : |
|
QDialog(parent), |
|
ui(new Ui::devicelist) |
|
{ |
|
ui->setupUi(this); |
|
QDir d("datas"); |
|
QStringList devices = d.entryList(QStringList(),QDir::AllDirs,QDir::Name); |
|
int i = 0; |
|
ui->tableWidget->setColumnCount(1); |
|
for(QString device:devices){ |
|
if(device == "." || device == ".."){ |
|
continue; |
|
} |
|
ui->tableWidget->setRowCount(i+1); |
|
ui->tableWidget->setItem(i,0,new QTableWidgetItem(device)); |
|
i++; |
|
qDebug()<<"device = "<<device; |
|
} |
|
ui->tableWidget->horizontalHeader()->hide(); |
|
ui->tableWidget->verticalHeader()->hide(); |
|
|
|
ui->tableWidget->resizeColumnsToContents(); |
|
ui->tableWidget->resizeRowsToContents(); |
|
ui->tableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch); |
|
// ui->tableWidget->verticalHeader()->setSectionResizeMode(QHeaderView::Stretch);} |
|
} |
|
|
|
devicelist::~devicelist() |
|
{ |
|
delete ui; |
|
} |
|
|
|
void devicelist::on_buttonBox_accepted() |
|
{ |
|
emit signalIDpath(ui->tableWidget->currentItem()->text()); |
|
} |
|
|
|
|