本文整理汇总了C++中QFileInfo::extension方法的典型用法代码示例。如果您正苦于以下问题:C++ QFileInfo::extension方法的具体用法?C++ QFileInfo::extension怎么用?C++ QFileInfo::extension使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QFileInfo
的用法示例。
在下文中一共展示了QFileInfo::extension方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setName
/*!
* \brief TextDoc::setName sets the text file name on its tab
* \param Name_ text file name to be set
*/
void TextDoc::setName (const QString& Name_)
{
DocName = Name_;
setLanguage (DocName);
QFileInfo Info (DocName);
DataSet = Info.baseName (true) + ".dat";
DataDisplay = Info.baseName (true) + ".dpl";
if(Info.extension(false) == "m" || Info.extension(false) == "oct")
SimTime = "1";
}
示例2: setName
// ---------------------------------------------------
void TextDoc::setName (const QString& Name_)
{
DocName = Name_;
setLanguage (DocName);
QFileInfo Info (DocName);
if (App)
App->DocumentTab->setTabLabel (this, Info.fileName ());
DataSet = Info.baseName (true) + ".dat";
DataDisplay = Info.baseName (true) + ".dpl";
if(Info.extension(false) == "m" || Info.extension(false) == "oct")
SimTime = "1";
}
示例3: registeredUsers
/***************************************************************************
* Returns a list of all the registered users of kinkatta. By this, it means all
* users that have a settings file under ~/.kde/share/apps/kinkatta/
***************************************************************************/
QStringList setup::registeredUsers(){
QString buddy = "";
QString extension = "";
QFileInfo fileInfo;
QStringList l;
QString homeDirr = KINKATTA_DIR;
if(!QFile::exists(homeDirr)) {
return l; //no registered users, return empty StringList
}
QDir home(homeDirr);
home.setFilter( QDir::Files | QDir::NoSymLinks );
if ( home.exists() ){
for (unsigned int i = 0; i < home.count(); i++){
fileInfo.setFile(home[i]);
buddy = fileInfo.baseName().lower();
extension = fileInfo.extension( FALSE );
if ( (extension == "xml") && buddy != "settings"){ //settings.xml is the global settings file
if(l.contains(buddy) == 0) //make them unique
l.append(buddy);
}
}
}
return l;
}
示例4: dir
DocEntry *DocMetaInfo::scanMetaInfoDir(const QString &dirName, DocEntry *parent)
{
QDir dir(dirName);
if(!dir.exists())
return 0;
const QFileInfoList_qt3 *entryList = dir.entryInfoList_qt3();
QFileInfoListIterator it(*entryList);
QFileInfo *fi;
for(; (fi = it.current()); ++it)
{
DocEntry *entry = 0;
if(fi->isDir() && fi->fileName() != "." && fi->fileName() != "..")
{
DocEntry *dirEntry = addDirEntry(QDir(fi->absFilePath()), parent);
entry = scanMetaInfoDir(fi->absFilePath(), dirEntry);
}
else if(fi->extension(false) == "desktop")
{
entry = addDocEntry(fi->absFilePath());
if(parent && entry)
parent->addChild(entry);
}
}
return 0;
}
示例5: findChildren
void AppLnkSet::findChildren(const QString &dr, const QString& typ, const QString& typName, int depth)
{
depth++;
if ( depth > 10 )
return;
QDir dir( dr );
QString typNameLocal = typName;
if ( dir.exists( ".directory" ) ) {
Config config( dr + "/.directory", Config::File );
config.setGroup( "Desktop Entry" );
typNameLocal = config.readEntry( "Name", typNameLocal );
if ( !typ.isEmpty() ) {
d->typPix.insert( typ,
new AppLnkImagePrivate( config.readEntry( "Icon", "AppsIcon" ) )
);
d->typName.insert(typ, new QString(typNameLocal));
}
}
const QFileInfoList *list = dir.entryInfoList();
if ( list ) {
QFileInfo* fi;
bool cadded=FALSE;
for ( QFileInfoListIterator it(*list); (fi=*it); ++it ) {
QString bn = fi->fileName();
// qDebug("findChildren "+bn);
if ( bn[0] != '.' && bn != "CVS" ) {
if ( fi->isDir() ) {
QString c = typ.isNull() ? bn : typ+"/"+bn;
QString d = typNameLocal.isNull() ? bn : typNameLocal+"/"+bn;
findChildren(fi->filePath(), c, d, depth );
} else {
if ( fi->extension(FALSE) == "desktop" ) {
AppLnk* app = new AppLnk( fi->filePath() );
#ifdef QT_NO_QWS_MULTIPROCESS
if ( !Global::isBuiltinCommand( app->exec() ) )
delete app;
else
#endif
{
if ( !typ.isEmpty() ) {
if ( !cadded ) {
typs.append(typ);
cadded = TRUE;
}
app->setType(typ);
}
add(app);
}
}
}
}
}
}
}
示例6: setLanguage
// ---------------------------------------------------
void TextDoc::setLanguage (const QString& FileName)
{
QFileInfo Info (FileName);
QString ext = Info.extension (false);
if (ext == "vhd" || ext == "vhdl")
setLanguage (LANG_VHDL);
else if (ext == "v")
setLanguage (LANG_VERILOG);
else if (ext == "va")
setLanguage (LANG_VERILOGA);
else if (ext == "m" || ext == "oct")
setLanguage (LANG_OCTAVE);
else
setLanguage (LANG_NONE);
}
示例7: FillComboWithDir
static void FillComboWithDir( QComboBox * combo, const char * sDirectory, const char * ext )
{
// Look in the current directory
QDir dir(sDirectory);
if( !dir.exists() )
{
fprintf( stderr, "Warning: Directory not found (%s).\n", sDirectory );
fprintf( stderr, "Action: Run rars from his home directory\n" );
return;
}
dir.setFilter( QDir::Files | QDir::NoSymLinks );
const QFileInfoList * fileinfolist = dir.entryInfoList();
QFileInfoListIterator it (*fileinfolist);
QFileInfo *fi;
while( (fi=it.current()) )
{
if( strcmp( fi->extension(), ext )==0 )
{
combo->insertItem( fi->fileName() );
}
++it;
}
}
示例8: fileSuffix
QString QucsDoc::fileSuffix (const QString& Name) {
QFileInfo Info (Name);
return Info.extension (false);
}