-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmainwindow3.cpp
More file actions
75 lines (55 loc) · 1.65 KB
/
mainwindow3.cpp
File metadata and controls
75 lines (55 loc) · 1.65 KB
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
#include "mainwindow3.h"
#include "ui_mainwindow3.h"
#include "mainwindow.h"
#include "mainwindow11.h"
MainWindow3::MainWindow3(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow3)
{
ui->setupUi(this);
QIcon icon("C:/Users/12234/Desktop/s.jpg");
setWindowIcon(icon);
setWindowTitle(QStringLiteral("家电信息管理系统"));
QStringList theStrList;
QString folderpath="C:/Users/12234/Documents/01/sum_info";
QDir dir(folderpath);
if(!dir.exists())
{
return;
}
dir.setFilter(QDir::Dirs|QDir::Files);//除了目录和文件,其他的过滤掉
dir.setSorting(QDir::DirsFirst);//优先显示目录
QFileInfoList list1 = dir.entryInfoList();//获取文件信息列表
int i=2;
do
{
QFileInfo fileInfo = list1.at(i);
theStrList<<"用户名:"<<fileInfo.fileName();
i++;
}
//qDebug()<<fileInfo.fileName()<<custom_user_name;
while(i<list1.size());
//theStrList<<"1"<<"2";
theModel=new QStringListModel(this);
theModel->setStringList(theStrList);
ui->listView->setModel(theModel);
ui->listView->setEditTriggers(QAbstractItemView::DoubleClicked|QAbstractItemView::SelectedClicked);
}
MainWindow3::~MainWindow3()
{
delete ui;
}
void MainWindow3::on_pushButton_5_clicked()
{
(new MainWindow)->show();
this->hide();
}
void MainWindow3::on_pushButton_clicked()
{
QModelIndex index;
index=ui->listView->currentIndex();
find_username=index.data().toString();
qDebug()<<find_username;
m11.show();
this->hide();
}