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


C++ QFileInfoList::removeAt方法代码示例

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


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

示例1: updateFavItems

void UserWidget::updateFavItems(){
  ClearScrollArea(ui->scroll_fav);
  QFileInfoList items;
  QDir homedir = QDir( QDir::homePath()+"/Desktop");
  QDir favdir = QDir( QDir::homePath()+"/.lumina/favorites");
  if(!favdir.exists()){ favdir.mkpath( QDir::homePath()+"/.lumina/favorites"); }
  if(ui->tool_fav_apps->isChecked()){ 
    items = homedir.entryInfoList(QStringList()<<"*.desktop", QDir::Files | QDir::NoDotAndDotDot, QDir::Name);
    items << favdir.entryInfoList(QStringList()<<"*.desktop", QDir::Files | QDir::NoDotAndDotDot, QDir::Name);
  }else if(ui->tool_fav_dirs->isChecked()){ 
    items = homedir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name);
    items << favdir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name);
  }else{ 
    //Files
    items = homedir.entryInfoList(QDir::Files | QDir::NoDotAndDotDot, QDir::Name);
    items << favdir.entryInfoList(QDir::Files | QDir::NoDotAndDotDot, QDir::Name);
    for(int i=0; i<items.length(); i++){
      if(items[i].suffix()=="desktop"){ items.removeAt(i); i--; }
    }
  }
  for(int i=0; i<items.length(); i++){
    UserItemWidget *it = new UserItemWidget(ui->scroll_fav->widget(), items[i].absoluteFilePath(), ui->tool_fav_dirs->isChecked());
    ui->scroll_fav->widget()->layout()->addWidget(it);
    connect(it, SIGNAL(RunItem(QString)), this, SLOT(LaunchItem(QString)) );
    connect(it, SIGNAL(NewShortcut()), this, SLOT(updateFavItems()) );
    connect(it, SIGNAL(RemovedShortcut()), this, SLOT(updateFavItems()) );
  }
  static_cast<QBoxLayout*>(ui->scroll_fav->widget()->layout())->addStretch();
}
开发者ID:KhuramAli,项目名称:lumina,代码行数:29,代码来源:UserWidget.cpp

示例2: updateFileTable

void Widget::updateFileTable()
{
    totalDownloads = 0;
    QString dir = qApp->applicationDirPath();
    QTreeWidgetItem * root = new QTreeWidgetItem(0);
    QTreeWidgetItem * tempItem = root;
    QTreeWidgetItem * tmp;
    QDir sncdr(dir + "/Sync");

    QFileInfoList syncDir = sncdr.entryInfoList(QDir::NoDotAndDotDot|QDir::AllEntries);


    while(!syncDir.empty())
    {
              if(syncDir.at(0).isDir())
              {
                  tmp = scanDirectory(syncDir.at(0).filePath());
                  tmp->setText(0, syncDir.at(0).fileName());
                  ftpFiles->addTopLevelItem(tmp);
                  totalDownloads++;
              }
              else
              {
                  tmp = new QTreeWidgetItem(0);
                  tmp->setText(0, syncDir.at(0).fileName());
                  ftpFiles->addTopLevelItem(tmp);
                  totalDownloads++;
              }
          syncDir.removeAt(0);
    }
}
开发者ID:skalldri,项目名称:LanPartyManager,代码行数:31,代码来源:widget.cpp

示例3: deleteImage

//???
void Photos::deleteImage()
{
    if( 0 == imageList.size())
    {
        QMessageBox::critical(this,tr("Warn"),
                              tr("No picture"),QMessageBox::Ok);
        return;
    }
    QMessageBox::StandardButton select = QMessageBox::question(NULL,"Warning",
                 tr("Delete is?"),QMessageBox::Yes | QMessageBox::No, QMessageBox::No);

    if(QMessageBox::Yes == select)
    {

        imageList.takeAt(position);
        QDir dir(dirPath);
        QFileInfoList fileList;
        QFileInfo curFile;
        QStringList filters;

        filters << "*.jpg" << "*.JPG";

        //??их?
        fileList = dir.entryInfoList(filters, QDir::Dirs|QDir::Files
                                   | QDir::Readable | QDir::Writable
                                   | QDir::Hidden | QDir::NoDotAndDotDot
                                   , QDir::Name);

        if(fileList.size()>0)
        {

            curFile = fileList[position];
            QFile tmpFile(curFile.filePath());
            tmpFile.remove();
            fileList.removeAt(position);

        }

        if(0 == imageList.size())
        {

            QMessageBox::critical(this,tr("Warn"),
                                  tr("No more"),QMessageBox::Ok);
            return;
        }

        //???? ???■?????ш????????
        imagePath = imageList.at(position);
        setPixmap(imagePath);

    }
}
开发者ID:AchillesL,项目名称:ARM,代码行数:53,代码来源:photos.cpp

示例4: writeHistoryFile

void SettingApp::writeHistoryFile(const QString& file)
{
    QFileInfoList list = readHistoryFile();
    clearHistoryFile();
    for(int i = 0; i < list.size(); i++)
        if(list[i].filePath() == file)
        {
            list.removeAt(i);
            break;
        }
    list.push_front(file);
    if(list.size() == 6)
        list.pop_back();

    m_setting->beginGroup("historyFile");
        m_setting->beginWriteArray("pathFile");
            for(int i = 0; i < list.size(); i++)
            {
                m_setting->setArrayIndex(i);
                m_setting->setValue("file", list[i].filePath());
            }
        m_setting->endArray();
    m_setting->endGroup();
}
开发者ID:kissofblood,项目名称:September,代码行数:24,代码来源:settingapp.cpp

示例5: ReplaceAppPakInSrc

/**********
*返回值:0成功
*1原包名不存在
*2创建包出错
*3目的包名已经存在
*4替换包名过程出错
*5替换app包名出错
***********/
int PathManager::ReplaceAppPakInSrc(QString &path, QString &oldName, QString &newName)
{
	QVector<QString> dirNames;
	QDir dir(path);
	QFileInfoList filst;
	QFileInfoList::iterator curFi;
	//初始化
	dirNames.clear();
	if (dir.exists()){
		dirNames << path;
	}
	else{
		return 0;
	}

	bool isTopDir = true;
	//遍历各级文件夹,并将这些文件夹中的文件删除  
	for (int i = 0; i<dirNames.size(); ++i)
	{
		dir.setPath(dirNames[i]);
		filst = dir.entryInfoList(QDir::Dirs | QDir::Files
			| QDir::Readable | QDir::Writable
			| QDir::Hidden | QDir::NoDotAndDotDot
			, QDir::Name);
		if (isTopDir){
			isTopDir = false;
			for (int i = 0; i < filst.size(); i++)
			{
				if (filst[i].fileName() == "assets" || filst[i].fileName() == "bin" || filst[i].fileName() == "libs"){
					filst.removeAt(i);
					i--;
				}
			}
		}
		if (filst.size()>0){
			curFi = filst.begin();
			while (curFi != filst.end())
			{
				//遇到文件夹,则添加至文件夹列表dirs尾部  
				if (curFi->isDir()){
					dirNames.push_back(curFi->filePath());
				}
				else if (curFi->isFile()){
					if (curFi->absoluteFilePath().toLower().endsWith(".java")){
						if (!ReplaceAppPakNameInJava(path, curFi->absoluteFilePath(), oldName, newName)){
							return 1;
						}
					}
					else if (curFi->absoluteFilePath().toLower().endsWith(".xml")){
						if (!ReplaceAppPakNameInXml(path, curFi->absoluteFilePath(), oldName, newName)){
							return 1;
						}
					}
				}
				curFi++;
			}//end of while  
		}
	}

	if (!ReplaceAppPakNameInManifest(path, oldName, newName)){
		return 5;
	}

	return 0;
}
开发者ID:cnandroidlib,项目名称:AutopackingAndroid,代码行数:73,代码来源:PathManager.cpp


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