include QDir include QFile include QTime include QDebug qDebug QTime c

 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
#include <QDir>
#include <QFile>
#include <QTime>
#include <QDebug>
////////////////////////////////////////////////////////////////////////////////////////
qDebug() << QTime::currentTime();
QDir dir = QDir("/proc/");
QList<QString> filters;
filters << "1*" << "2*" << "3*" << "4*" << "5*" << "6*" << "7*" << "8*" << "9*" << "0*";
QList<QString> dirs = dir.entryList(filters, QDir::Dirs, QDir::Name);
ui->tableWidget->setRowCount(dirs.size());
for(int i=0; i<dirs.size(); i++)
{
QTableWidgetItem *item = new QTableWidgetItem(dirs.at(i));
ui->tableWidget->setItem(i,0, item);
QString str = dir.path()+"/"+dirs.at(i)+"/status";
QFile f(str);
if(!f.open(QIODevice::ReadOnly | QIODevice::Text))
qDebug() << "ошибка";
QTableWidgetItem *itm = new QTableWidgetItem(QString(f.readLine()).remove(0,6));
ui->tableWidget->setItem(i,1, itm);
}
//ui->listWidget->addItems(dirs);
qDebug() << QTime::currentTime();
///////////////////////////////////////////////////////////////////////////////////////