当前位置: 首页>>代码示例>>C++>>正文


C++ QDir::entryInfoList方法代码示例

本文整理汇总了C++中QDir::entryInfoList方法的典型用法代码示例。如果您正苦于以下问题:C++ QDir::entryInfoList方法的具体用法?C++ QDir::entryInfoList怎么用?C++ QDir::entryInfoList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QDir的用法示例。


在下文中一共展示了QDir::entryInfoList方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: QObject

CloudImageProvider::CloudImageProvider(QObject *parent) : QObject(parent),
    QQuickImageProvider(QQuickImageProvider::Image , QQmlImageProviderBase::ForceAsynchronousImageLoading)
//    QDeclarativeImageProvider(QDeclarativeImageProvider::Image)
{
    // This space intentionally left blank.

    mgr = new QNetworkAccessManager;
    connect(mgr,SIGNAL(finished(QNetworkReply*)),this,SLOT(loadfinished(QNetworkReply*)));

    // load cache
    // fetch workdir+"/imgcache" directory
    QDir dir;
    dir.mkpath(workDir+"/imgcache/");
    dir.setPath(workDir+"/imgcache/");
    dir.setFilter(QDir::Files | QDir::Hidden | QDir::NoSymLinks);
    dir.setSorting(QDir::Size | QDir::Reversed);

    QFileInfoList list = dir.entryInfoList();
    //std::cout << "     Bytes Filename" << std::endl;
    for (int i = 0; i < list.size(); ++i) {
        QFileInfo fileInfo = list.at(i);
        if (fileInfo.suffix() == "jpg") {
//            qWarning()<<"load ["<< fileInfo.baseName()<<"]="+fileInfo.absoluteFilePath();
            cache[fileInfo.baseName()] = QImage(fileInfo.absoluteFilePath());
        }

    }
}
开发者ID:pockemul,项目名称:PockEmul,代码行数:28,代码来源:cloudimageprovider.cpp

示例2: installedAPIFiles

// Return installed API files.
QStringList QsciAPIs::installedAPIFiles() const
{
    const char *qtdir = getenv("QTDIR");

    if (!qtdir)
        return QStringList();

    QDir apidir = QDir(QString("%1/qsci/api/%2").arg(qtdir).arg(lexer()->lexer()));
    QStringList filenames;

    const QFileInfoList *flist = apidir.entryInfoList("*.api", QDir::Files, QDir::IgnoreCase);

    if (flist)
    {
        QPtrListIterator<QFileInfo> it(*flist);
        QFileInfo *fi;

        while ((fi = it.current()) != 0)
        {
            filenames << fi->absFilePath();
            ++it;
        }
    }

    return filenames;
}
开发者ID:fusigi0930,项目名称:qnotepad-pp,代码行数:27,代码来源:qsciapis.cpp

示例3: rmpath

bool FacilityLib::rmpath(const QDir &dir)
{
    if(!dir.exists())
        return true;
    bool allHaveWork=true;
    QFileInfoList list = dir.entryInfoList(QDir::AllEntries|QDir::NoDotAndDotDot|QDir::Hidden|QDir::System,QDir::DirsFirst);
    for (int i = 0; i < list.size(); ++i)
    {
        QFileInfo fileInfo(list.at(i));
        if(!fileInfo.isDir())
        {
            if(!QFile(fileInfo.absoluteFilePath()).remove())
                allHaveWork=false;
        }
        else
        {
            //return the fonction for scan the new folder
            if(!FacilityLib::rmpath(dir.absolutePath()+FacilityLib::text_slash+fileInfo.fileName()+FacilityLib::text_slash))
                allHaveWork=false;
        }
    }
    if(!allHaveWork)
        return false;
    allHaveWork=dir.rmdir(dir.absolutePath());
    return allHaveWork;
}
开发者ID:ErwanLeroux,项目名称:CatchChallenger,代码行数:26,代码来源:FacilityLib.cpp

示例4: fill_graphicfiles_combobox

void common::fill_graphicfiles_combobox(std::string directory, QComboBox *comboWidget)
{
    comboWidget->clear(); // delete all previous entries

    std::string str_filepath(FILEPATH+directory);
    QString filepath(str_filepath.c_str());
    QDir dir = QDir(filepath);
    if (!dir.exists()) {
        //std::cout << ">> MainWindow::fill_graphicfiles_listwidget ERROR: Directory '" << str_filepath << " does not exist. <<" << std::endl;
        exit(-1);
    }
    dir.setFilter(QDir::Files | QDir::NoSymLinks | QDir::NoDotAndDotDot);
    dir.setSorting(QDir::Size | QDir::Reversed);
    QFileInfoList list = dir.entryInfoList();

    for (int i = 0; i < list.size(); ++i) {
        QFileInfo fileInfo = list.at(i);
        if (fileInfo.fileName().length() > 30) {
            std::cout << "ERROR: file '" << fileInfo.fileName().toStdString() << "' surpasses the maximum number of file-characters (" << CHAR_FILENAME_SIZE << ")" << std::endl;
        } else {
            std::string filename = FILEPATH + directory + "/" + fileInfo.fileName().toStdString();
            QIcon icon(filename.c_str());
            comboWidget->addItem(icon, fileInfo.fileName());
        }
    }
    comboWidget->repaint();
}
开发者ID:DavidKnight247,项目名称:Rockbot-GCW0-port,代码行数:27,代码来源:common.cpp

示例5: updateFileList

void MainWindow::updateFileList()
{
    QFileInfoList tmp_list;
    QDir dir;

    if (this->directoryPath == "")
        this->directoryPath = dir.absolutePath();

    this->fileList.clear();
    dir.cd(this->directoryPath);
    tmp_list = dir.entryInfoList();
    for (int i = 0; i < tmp_list.size(); ++i)
    {
        QString tmp_name = tmp_list.at(i).fileName();
        if (tmp_name.endsWith(".jpg", Qt::CaseInsensitive) == 1 ||
            tmp_name.endsWith(".bmp", Qt::CaseInsensitive) == 1 ||
            tmp_name.endsWith(".png", Qt::CaseInsensitive) == 1)
        {
            MyFile new_file;
            new_file.name = tmp_list.at(i).fileName();
            new_file.sent = false;
            new_file.path = this->directoryPath;
            new_file.plate = "";
            this->fileList.push_back(new_file);
        }
    }
}
开发者ID:monsty,项目名称:licenserecognizer,代码行数:27,代码来源:mainwindow.cpp

示例6: FindFiles

void FindFiles(QString sDirectoryName,QStringList *pList,bool bSubDirs)
{
    QDir dir;
    dir.setPath(sDirectoryName);

    QFileInfoList fi=dir.entryInfoList();

    for(int i=0; i<fi.count(); i++)
    {
        if(fi.at(i).fileName()==".")
        {
            continue;
        }

        if(fi.at(i).fileName()=="..")
        {
            continue;
        }
        else if(fi.at(i).isFile())
        {
            pList->append(fi.at(i).absoluteFilePath());
        }

        if(fi.at(i).isDir()&&(bSubDirs))
        {
            FindFiles(fi.at(i).absoluteFilePath(),pList,bSubDirs);
        }
    }
}
开发者ID:RaptorFactor,项目名称:DIE-engine,代码行数:29,代码来源:mainc.cpp

示例7: fill_files_combo

void common::fill_files_combo(std::string directory, QComboBox* combo, bool show_none)
{
    combo->clear(); // delete all previous entries

    combo->addItem(QString("")); // for "empty"
    std::string str_filepath(FILEPATH+directory);
    QString filepath(str_filepath.c_str());
    QDir dir = QDir(filepath);
    if (!dir.exists()) {
        std::cout << ">> MainWindow::fill_files_combo ERROR: Directory '" << str_filepath << " does not exist. <<" << std::endl;
        exit(-1);
    }
    dir.setFilter(QDir::Files | QDir::NoSymLinks | QDir::NoDotAndDotDot);
    dir.setSorting(QDir::Size | QDir::Reversed);
	if (show_none == true) {
		combo->addItem(QString("None"));
	}
    QFileInfoList list = dir.entryInfoList();
    for (int i = 0; i < list.size(); ++i) {
        QFileInfo fileInfo = list.at(i);
        if (fileInfo.fileName().length() > 30) {
            std::cout << "ERROR: file '" << fileInfo.fileName().toStdString() << "' surpasses the maximum number of file-characters (" << CHAR_FILENAME_SIZE << ")" << std::endl;
        } else {
            combo->addItem(QString(fileInfo.fileName()));
        }
    }
    combo->repaint();
}
开发者ID:DavidKnight247,项目名称:Rockbot-GCW0-port,代码行数:28,代码来源:common.cpp

示例8: QDir

void
MultiplayerDialog::updateLandscapesList()
{
	QDir pluginsDirectory = QDir( m_environment.getLandscapesDirectory() );

	if ( !pluginsDirectory.exists() )
		return;

	QStringList filesFilter;
	filesFilter.push_back( Core::LandscapeModel::Resources::LandscapeFileFilter );

	QFileInfoList filesList = pluginsDirectory.entryInfoList( filesFilter );

	if ( filesList.empty() )
		return;

	for ( int i = 0; i < filesList.size(); ++i )
	{
         QFileInfo fileInfo = filesList.at( i );
		 m_landscapesList->addItem( fileInfo.fileName() );
	}

	m_landscapesList->setCurrentItem( m_landscapesList->item( 0 ) );

} // MultiplayerDialog::updateLandscapesList
开发者ID:valeriyr,项目名称:Hedgehog,代码行数:25,代码来源:lv_multiplayer_dialog.cpp

示例9: read_formula

void Enhancededitorwindow::read_formula()
{
    _names_list.clear();
    ui->cb_AtomFormula->clear();

    QString contents;
    QFile formula_file(QDir::homePath() + "/" + "Matching-Pursuit-Toolbox/user.fml");

    if (formula_file.open(QIODevice::ReadOnly | QIODevice::Text))
    {
        while(!formula_file.atEnd())
        {
            contents = formula_file.readLine(0).constData();
            ui->cb_AtomFormula->addItem(QIcon(":/images/icons/formel.png"), contents.trimmed());
        }
    }
    formula_file.close();

    QDir dictDir = QDir(QDir::homePath() + "/" + "Matching-Pursuit-Toolbox");

    QStringList filterList;
    filterList.append("*.dict");
    filterList.append("*.pdict");

    QFileInfoList fileList = dictDir.entryInfoList(filterList);
    for(int i = 0; i < fileList.length(); i++)
        _names_list.append(fileList.at(i).baseName());

    if(ui->cb_AtomFormula->count() != 0)
        ui->cb_AtomFormula->setCurrentIndex(0);
}
开发者ID:GBeret,项目名称:mne-cpp,代码行数:31,代码来源:enhancededitorwindow.cpp

示例10: setCurrentFolder

void FilesModel::setCurrentFolder( QString folder )
{
	// doing some checks 
	if( true  == folder.isEmpty() )
		return;
	
	QDir directory;
	directory.setPath( folder );
	
	QStringList folderContent = directory.entryList();
	
	// removing the "."
	folderContent.removeAt(0);
	
	setStringList( folderContent );
	m_fileInfoList = directory.entryInfoList();
	
	// removing info for "."
	m_fileInfoList.removeAt(0);
	

	// storing the folder beeing displaied
	m_currentFolder = directory.absolutePath();

}
开发者ID:nic0lae,项目名称:freebsddistro,代码行数:25,代码来源:filesmodel.cpp

示例11: read_dir

//*******************************************************************
// read_dir                                                  PRIVATE
//-------------------------------------------------------------------
// Rekursywne odczytywanie calej zawartosci wskazanego katalogu.
// Odczytana zawrtosc katalogu jest zapamietywania w hash-tablicy.
//*******************************************************************
void QBtCompareDirsDialog::read_dir( const QString& in_parent,
                                     const QString& in_dir,
                                     DirMap& out_data ) const
{
   static const int sflag = QDir::AllDirs
                          | QDir::Files
                          | QDir::NoDotAndDotDot
                          | QDir::Readable
                          | QDir::Writable
                          | QDir::Hidden;
                   
   const QDir dir( in_dir, "*", QDir::Unsorted, QFlags<QDir::Filter>( sflag ) );
   const QFileInfoList items = dir.entryInfoList();

   FileMap files_map = FileMap();
   QFileInfoList::const_iterator it = items.begin();
   const QFileInfoList::const_iterator end = items.end();
   while( continue_ && ( it != end ) ) {
      if( it->isDir() ) read_dir( in_parent, it->absoluteFilePath(), out_data );
      else              files_map.insert( it->fileName(), *it );
      ++it;
   }
   QString path = in_dir;
   out_data.insert( path.remove( in_parent ), files_map );
}
开发者ID:sclown,项目名称:bsc,代码行数:31,代码来源:QBtCompareDirsDialog.cpp

示例12: rmpath

/** remplace QDir::rmpath() because it return false if the folder not exists
  and seam bug with parent folder */
bool copyEngineUnitTester::rmpath(const QDir &dir)
{
    if(!dir.exists())
        return true;
    bool allHaveWork=true;
    QFileInfoList list = dir.entryInfoList(QDir::AllEntries|QDir::NoDotAndDotDot|QDir::Hidden|QDir::System,QDir::DirsFirst);
    for (int i = 0; i < list.size(); ++i)
    {
        QFileInfo fileInfo(list.at(i));
        if(!fileInfo.isDir())
        {
            ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"found a file: "+fileInfo.fileName());
            allHaveWork=false;
        }
        else
        {
            //return the fonction for scan the new folder
            if(!rmpath(dir.absolutePath()+'/'+fileInfo.fileName()+'/'))
                allHaveWork=false;
        }
    }
    if(!allHaveWork)
        return allHaveWork;
    allHaveWork=dir.rmdir(dir.absolutePath());
    if(!allHaveWork)
        ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"unable to remove the folder: "+dir.absolutePath());
    return allHaveWork;
}
开发者ID:AutoRunWare,项目名称:Ultracopier,代码行数:30,代码来源:copyEngineUnitTester.cpp

示例13: mididir

MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) {
    ui->setupUi(this);

    midi = new MistyMidi();
    loadPortNames();
    connect(ui->intputList, SIGNAL(currentTextChanged(QString)), midi, SLOT(input_changed(QString)));
    connect(midi, SIGNAL(send_message(QString)), this, SLOT(updatelog(QString)));
    ui->actionE_xit->setShortcut(QKeySequence::Quit);

    ui->synthList->setRowCount(1);
    ui->synthList->setItem(0, 0, new QTableWidgetItem("Piano", QTableWidgetItem::Type));
    SynthSelector *combo = new SynthSelector(ui->synthList, outputs);
    ui->synthList->setCellWidget(0, 1, combo);

    QDir mididir ("MIDI");

    if(mididir.exists()) {
        mididir.setFilter(QDir::Files | QDir::NoSymLinks);
        mididir.setNameFilters(QStringList("*.mid"));

        QFileInfoList files = mididir.entryInfoList();
        for(int i=0; i<files.size(); i++) {
            ui->accompanimentList->addItem(files.at(i).fileName());
        }
    } else {
        ui->accompanimentList->addItem(QString("Midi Directory %1 Not Found").arg(mididir.absolutePath()));
    }
}
开发者ID:shimpe,项目名称:MistyRTAW,代码行数:28,代码来源:mainwindow.cpp

示例14: RecursiveRemoveDir

bool cceDirRemoverHelper::RecursiveRemoveDir(QDir aDir)
{
	bool allOk = true;
	if (aDir.exists())//QDir::NoDotAndDotDot
		{
			QFileInfoList entries = aDir.entryInfoList(	QDir::NoDotAndDotDot |
																									QDir::Dirs |
																									QDir::Files);
			foreach (QFileInfo entryInfo, entries)
				{
					QString path = entryInfo.absoluteFilePath();
					if (entryInfo.isDir())
						{
							allOk = RecursiveRemoveDir(QDir(path));
						}
					else
						{
							QFile file(path);
							if (!file.remove())
								{
									allOk = false;
								}
						}
					if (!allOk)
						{
							break;
						}
				}
开发者ID:BtbN,项目名称:crimson-core,代码行数:28,代码来源:helper.cpp

示例15: MythRemoveDirectory

bool MythRemoveDirectory(QDir &aDir)
{
    if (!aDir.exists())//QDir::NoDotAndDotDot
        return false;

    QFileInfoList entries = aDir.entryInfoList(QDir::NoDotAndDotDot |
                                               QDir::Dirs | QDir::Files);
    int count = entries.size();
    bool has_err = false;

    for (int idx = 0; idx < count && !has_err; idx++)
    {
        QFileInfo entryInfo = entries[idx];
        QString path = entryInfo.absoluteFilePath();
        if (entryInfo.isDir())
        {
            QDir dir(path);
            has_err = MythRemoveDirectory(dir);
        }
        else
        {
            QFile file(path);
            if (!file.remove())
                has_err = true;
        }
    }

    if (!has_err && !aDir.rmdir(aDir.absolutePath()))
        has_err = true;

    return(has_err);
}
开发者ID:microe,项目名称:mythtv,代码行数:32,代码来源:util.cpp


注:本文中的QDir::entryInfoList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。