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


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

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


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

示例1: findFiles

QStringList findFiles(const QString& path = QString())
{
  QStringList files;

  QDir dir = QDir::current();
  if(!path.isEmpty())
    dir = QDir(path);

  dir.setFilter(QDir::Files | QDir::Hidden | QDir::NoSymLinks);
#if QT_VERSION >= 0x040000
  QFileInfoList list = dir.entryInfoList();
  for (int i = 0; i < list.size(); ++i) 
  {
    QFileInfo fileInfo = list.at(i);
    files.append(dir.absoluteFilePath(fileInfo.fileName()));
  }
#else
  const QFileInfoList* list = dir.entryInfoList();
  if(list) 
  {
    QFileInfoListIterator it( *list );
    QFileInfo * fi;
    while( (fi=it.current()) != 0 ) 
    {
      ++it;
      files.append(dir.absFilePath(fi->fileName()));
    }
  }
#endif

  return files;
}
开发者ID:Monthy,项目名称:gr-lida,代码行数:32,代码来源:main.cpp

示例2:

BrowserColDiagram::~BrowserColDiagram()
{
    if (deletedp() && !modifiedp()) {
        QString fn;

        fn.sprintf("%d.diagram", get_ident());

        QDir d = BrowserView::get_dir();

        QFile::remove(d.absFilePath(fn));
    }

    all.remove(get_ident());
    delete def;
}
开发者ID:jeremysalwen,项目名称:douml,代码行数:15,代码来源:BrowserColDiagram.cpp

示例3:

BrowserObjectDiagram::~BrowserObjectDiagram()
{
    if (deletedp() && !modifiedp()) {
        QString fn;

        fn.sprintf("%d.diagram", get_ident());

        QDir d = BrowserView::get_dir();

        QFile::remove(d.absFilePath(fn));
    }
    on_close();
//    if(window)
//        window->set_browser_diagram(0);

    all.remove(get_ident());
    delete def;
}
开发者ID:jeremysalwen,项目名称:douml,代码行数:18,代码来源:BrowserObjectDiagram.cpp

示例4: extractFile

// ---------------------------------------------------------------
int PackageDialog::extractFile(QFile& PkgFile, Q_UINT32 Count, QDir& currDir)
{
  char *p = (char*)malloc(Count);
  PkgFile.readBlock(p, Count);
  QByteArray Content = qUncompress((unsigned char*)p, Count);
  free(p);

  p = Content.data();
  QFile File(currDir.absFilePath(QString(p)));
  if(!File.open(QIODevice::WriteOnly)) {
    MsgText->append(tr("ERROR: Cannot create file \"%1\"!").arg(QString(p)));
    return -1;
  }

  File.writeBlock(p+strlen(p)+1, Content.size()-strlen(p)-1);
  File.close();
  MsgText->append(tr("Create file \"%1\"").arg(QString(p)));
  return 1;
}
开发者ID:AMDmi3,项目名称:qucs,代码行数:20,代码来源:packagedialog.cpp

示例5:

BrowserSeqDiagram::~BrowserSeqDiagram()
{
    if (deletedp() && !modifiedp()) {
        QString fn;

        fn.sprintf("%d.diagram", get_ident());

        QDir d = BrowserView::get_dir();

        QFile::remove(d.absFilePath(fn));
    }

#if 0

    // already done before browser->clear
    if (window)
        delete window;

#endif
    all.remove(get_ident());
    delete def;
}
开发者ID:jeremysalwen,项目名称:douml,代码行数:22,代码来源:BrowserSeqDiagram.cpp

示例6: createBody

void KImGalleryPlugin::createBody(QTextStream& stream, const QString& sourceDirName, const QStringList& subDirList,
                                  const QDir& imageDir, const KURL& url, const QString& imageFormat)
{
    int numOfImages = imageDir.count();
    const QString imgGalleryDir = url.directory();
    const QString today(KGlobal::locale()->formatDate(QDate::currentDate()));

    stream << "<body>\n<h1>" << QStyleSheet::escape(m_configDlg->getTitle()) << "</h1><p>" << endl;
    stream << i18n("<i>Number of images</i>: %1").arg(numOfImages) << "<br/>" << endl;
    stream << i18n("<i>Created on</i>: %1").arg(today) << "</p>" << endl;

    stream << "<hr/>" << endl;

    if (m_recurseSubDirectories && subDirList.count() > 2) { //subDirList.count() is always >= 2 because of the "." and ".." directories
        stream << i18n("<i>Subfolders</i>:") << "<br>" << endl;
        for (QStringList::ConstIterator it = subDirList.begin(); it != subDirList.end(); it++) {
            if (*it == "." || *it == "..")
                continue; //disregard the "." and ".." directories
            stream << "<a href=\"" << *it << "/" << url.fileName()
                   << "\">" << *it << "</a><br>" << endl;
        }
        stream << "<hr/>" << endl;
    }

    stream << "<table>" << endl;

    //table with images
    int imgIndex;
    QFileInfo imginfo;
    QPixmap  imgProp;
    for (imgIndex = 0; !m_cancelled && (imgIndex < numOfImages);) {
        stream << "<tr>" << endl;

        for (int col=0; !m_cancelled && (col < m_imagesPerRow) && (imgIndex < numOfImages); col++) {
            const QString imgName = imageDir[imgIndex];

            if (m_copyFiles) {
                stream << "<td align='center'>\n<a href=\"images/" << imgName << "\">";
            } else {
                stream << "<td align='center'>\n<a href=\"" << imgName << "\">";
            }


            if (createThumb(imgName, sourceDirName, imgGalleryDir, imageFormat)) {
                const QString imgPath("thumbs/" + imgName + extension(imageFormat));
                stream << "<img src=\"" << imgPath << "\" width=\"" << m_imgWidth << "\" ";
                stream << "height=\"" << m_imgHeight << "\" alt=\"" << imgPath << "\"/>";
                m_progressDlg->setLabelText( i18n("Created thumbnail for: \n%1").arg(imgName) );
            } else {
                kdDebug(90170) << "Creating thumbnail for " << imgName << " failed" << endl;
                m_progressDlg->setLabelText( i18n("Creating thumbnail for: \n%1\n failed").arg(imgName) );
            }
            stream << "</a>" << endl;

            if (m_configDlg->printImageName()) {
                stream << "<div>" << imgName << "</div>" << endl;
            }

            if (m_configDlg->printImageProperty()) {
                imgProp.load( imageDir.absFilePath(imgName,true) );
                stream << "<div>" << imgProp.width() << " x " << imgProp.height() << "</div>" << endl;
            }

            if (m_configDlg->printImageSize()) {
                imginfo.setFile( imageDir, imgName );
                stream << "<div>(" << (imginfo.size() / 1024) << " " <<  i18n("KB") << ")" << "</div>" << endl;
            }

            if (m_useCommentFile) {
                QString imgComment = (*m_commentMap)[imgName];
                stream << "<div>" << QStyleSheet::escape(imgComment) << "</div>" << endl;
            }
            stream << "</td>" << endl;

            m_progressDlg->setTotalSteps( numOfImages );
            m_progressDlg->setProgress( imgIndex );
            kapp->processEvents();
            imgIndex++;
        }
        stream << "</tr>" << endl;
    }
    //close the HTML
    stream << "</table>\n</body>\n</html>" << endl;
}
开发者ID:iegor,项目名称:kdesktop,代码行数:84,代码来源:imgalleryplugin.cpp

示例7: is_readonly

bool is_readonly(QDir & dir, QString fn)
{
  QFileInfo fi(dir.absFilePath(fn));
  
  return fi.exists() && !fi.isWritable();
}
开发者ID:SciBoy,项目名称:douml,代码行数:6,代码来源:myio.cpp

示例8: writeConfig

void PMenu::writeConfig( QDir base_dir, PMenuItem *parent_item)
{
  if( parent_item )
    if( parent_item->read_only )
      return;
  if( !base_dir.exists() )
    {
      return;
    }
  QString name;
  const QStrList *temp_list = base_dir.entryList("*", QDir::Files);
  QStrList file_list;
  file_list.setAutoDelete(TRUE);
  QStrListIterator temp_it( *temp_list );
  while( name = temp_it.current() )
    {
      file_list.append(name);
      ++temp_it;
    }
  temp_list = base_dir.entryList("*", QDir::Dirs);
  QStrList dir_list;
  dir_list.setAutoDelete(TRUE);
  temp_it.toFirst();
  while( name = temp_it.current() )
    {
      if(name != "." && name != "..")
	dir_list.append(name);
      ++temp_it;
    }
  QString sort_order;
  PMenuItem *item;
  for( item = list.first(); item != 0; item = list.next() )
    {
      //      if( item->read_only )
      //	continue;
      if( item->entry_type == separator )
	sort_order += ((QString) "SEPARATOR" + ',');
      else
	sort_order += (item->real_name + ',');
      if( item->getType() == submenu )
	{
	  if( !item->read_only )
	    {
	      QDir sub_dir(base_dir);
	      if( !sub_dir.cd(item->real_name) )
		{
		  base_dir.mkdir(item->real_name);
		  if( !sub_dir.cd(item->real_name) )
		    continue;
		}
	      item->sub_menu->writeConfig( sub_dir, item );
	    }
	  dir_list.remove(item->real_name);
	}
      else
	{
	  if( item->entry_type != separator )
	    {
	      if( !item->read_only )
		{
		  if( item->real_name.isEmpty() )
		    item->real_name = uniqueFileName(item->text_name);
		  item->writeConfig(base_dir);
		}
	      file_list.remove(item->real_name); // + ".kdelnk");
	    }
	}
    }
  // remove files not in pmenu
  for( name = file_list.first(); name != 0; name = file_list.next() )
    {
      if( isKdelnkFile(base_dir.absFilePath(name)) )
	{
	  //debug("will remove file: %s", (const char *) name );
	  base_dir.remove(name);
	}
    }
  // remove dirs not in pmenu
  for( name = dir_list.first(); name != 0; name = dir_list.next() )
    {
      //debug("will remove dir: %s", (const char *) name );
      QDir sub_dir(base_dir);
      if(sub_dir.cd(name))
	{
	  PMenu *new_menu = new PMenu;
	  new_menu->writeConfig(sub_dir);
	  delete new_menu;
	  sub_dir.remove(".directory");	  
	}
      base_dir.rmdir(name);
    }
  sort_order.truncate(sort_order.length()-1);
  QString file = base_dir.absPath();
  file += "/.directory";
  QFile config(file);
  if( !config.open(IO_ReadWrite) ) 
    return;
  config.close();
  KConfig kconfig(file);
  kconfig.setGroup("KDE Desktop Entry");
//.........这里部分代码省略.........
开发者ID:kthxbyte,项目名称:KDE1-Linaro,代码行数:101,代码来源:pmenu.cpp


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