本文整理汇总了C++中QDir::entryInfoList_qt3方法的典型用法代码示例。如果您正苦于以下问题:C++ QDir::entryInfoList_qt3方法的具体用法?C++ QDir::entryInfoList_qt3怎么用?C++ QDir::entryInfoList_qt3使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDir
的用法示例。
在下文中一共展示了QDir::entryInfoList_qt3方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: insertDir
void AccountingSelector::insertDir(QDir d, QListViewItem *root) {
QListViewItem* tli = 0;
// sanity check
if(!d.exists() || !d.isReadable())
return;
// set up filter
d.setNameFilter("*.rst");
d.setFilter(QDir::Files);
d.setSorting(QDir::Name);
// read the list of files
const QFileInfoList_qt3 *list = d.entryInfoList_qt3();
QFileInfoListIterator it( *list );
QFileInfo *fi;
// traverse the list and insert into the widget
while((fi = it.current())) {
++it;
QString samename = fi->fileName();
QListViewItem *i = findByName(samename);
// skip this file if already in tree
if(i)
continue;
// check if this is the file we should mark
QString name = fileNameToName(fi->baseName(true));
if(root)
tli = new QListViewItem(root, name);
else
tli = new QListViewItem(tl, name);
tli->setPixmap(0, pmfile);
// check if this is the item we are searching for
// (only in "Edit"-mode, not in "New"-mode
if(!isnewaccount && !edit_s.isEmpty() &&
(edit_s == QString(fi->filePath()).right(edit_s.length()))) {
edit_item = tli;
}
}
// set up a filter for the directories
d.setFilter(QDir::Dirs);
d.setNameFilter("*");
const QFileInfoList_qt3 *dlist = d.entryInfoList_qt3();
QFileInfoListIterator dit(*dlist);
while((fi = dit.current())) {
// skip "." and ".." directories
if(fi->fileName().left(1) != ".") {
// convert to human-readable name
QString name = fileNameToName(fi->fileName());
// if the tree already has an item with this name,
// skip creation and use this one, otherwise
// create a new entry
QListViewItem *i = findByName(name);
if(!i) {
QListViewItem* item;
if(root)
item = new QListViewItem(root, name);
else
item = new QListViewItem(tl, name);
item->setPixmap(0, pmfolder);
insertDir(QDir(fi->filePath()), item);
} else
insertDir(QDir(fi->filePath()), i);
}
++dit;
}
}