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


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

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


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

示例1: main

int main(int argc, char *argv[])
{
    QDir dir;
    dir.setFilter(QDir::Files | QDir::Hidden | QDir::NoSymLinks);
    dir.setSorting(QDir::Size | QDir::Reversed);

//! [0]
    QStringList filters;
    filters << "*.cpp" << "*.cxx" << "*.cc";
    dir.setNameFilters(filters);
//! [0]

    QFileInfoList list = dir.entryInfoList();
    std::cout << "     Bytes Filename" << std::endl;
    for (int i = 0; i < list.size(); ++i) {
        QFileInfo fileInfo = list.at(i);
        std::cout << qPrintable(QString("%1 %2").arg(fileInfo.size(), 10)
                                                .arg(fileInfo.fileName()));
        std::cout << std::endl;
    }
    return 0;
}
开发者ID:Akheon23,项目名称:chromecast-mirrored-source.vendor,代码行数:22,代码来源:main.cpp

示例2: systemDirectory

QDir QLCFile::systemDirectory(QString path, QString extension)
{
    QDir dir;
#if defined(__APPLE__) || defined(Q_OS_MAC)
    dir.setPath(QString("%1/../%2").arg(QCoreApplication::applicationDirPath())
                                   .arg(path));
#elif defined(WIN32) || defined(Q_OS_WIN)
    dir.setPath(QString("%1%2%3").arg(QCoreApplication::applicationDirPath())
                                 .arg(QDir::separator())
                                 .arg(path));
#elif defined(Q_OS_ANDROID)
    dir.setPath(QString("assets:/%1").arg(path.remove(0, path.lastIndexOf("/") + 1)));
#else
    dir.setPath(path);
#endif

    dir.setFilter(QDir::Files);
    if (!extension.isEmpty())
        dir.setNameFilters(QStringList() << QString("*%1").arg(extension));

    return dir;
}
开发者ID:ChrisLaurie,项目名称:qlcplus,代码行数:22,代码来源:qlcfile.cpp

示例3: qWarning

QList <QSharedPointer<Entry> > System::outboxEntries () {
    QList <QSharedPointer<Entry> > list;

    QDir dir = d_ptr->entryOutboxPath;
    QStringList filters;
    filters << "entry_*.xml";
    dir.setNameFilters (filters);
    QStringList entryFiles = dir.entryList (filters, QDir::Files, QDir::Name);

    for (int i = 0; i < entryFiles.count(); ++i) {
        QSharedPointer <Entry> entry = QSharedPointer <Entry> (new Entry);
        if (entry->init (dir.filePath(entryFiles.at (i)))) {
            list.append (entry);
        } else {
            qWarning() << "Invalid entry found in outbox, removing it..." <<
                dir.filePath(entryFiles.at (i)) ;
            Entry::cleanUp (dir.filePath(entryFiles.at (i)));
        }
    }

    return list;
}
开发者ID:nemomobile-graveyard,项目名称:webupload-engine,代码行数:22,代码来源:system.cpp

示例4: processModelFiles

void processModelFiles()
{
	QString workingModelDirPath = QString(workingAssetsDir) + "Models\\";
	QDir workingModelDir (workingModelDirPath);
	if(workingModelDir.exists())
	{
		QStringList modelFileFilters;
		modelFileFilters << "*.obj";

		workingModelDir.setFilter(QDir::Files | QDir::NoSymLinks);
		workingModelDir.setNameFilters(modelFileFilters);
		QFileInfoList workingModelFiles = workingModelDir.entryInfoList();
		for(int i = 0; i < workingModelFiles.size(); i++)
		{
			QFileInfo workingModelObj = workingModelFiles.at(i);
			QFileInfo workingModelBin (workingModelObj.path() + "\\" + workingModelObj.baseName() + ".bin");
			QFileInfo outModelBin (QString(outAssetsDir) + "Models\\" + workingModelBin.fileName());
			
			bool needsUpdate = (!workingModelBin.exists() || !outModelBin.exists() || (workingModelBin.lastModified() < workingModelObj.lastModified()));
			if(needsUpdate)
			{
				QString command("call \"" + QString(objToBinDir) + "ObjToBinaryWriter.exe\" ");
				command += "\"" + QDir::toNativeSeparators(workingModelObj.absoluteFilePath()) + "\" \"" + QDir::toNativeSeparators(workingModelBin.absoluteFilePath()) + "\"";
				int result = system(command.toLocal8Bit().constData());
				if(result != 0)
				{
					qDebug("ERROR CONVERTING MODEL OBJ, RESULT: " + result);
				}
				QString copyCommand("echo f|xcopy /y \"" + QDir::toNativeSeparators(workingModelBin.absoluteFilePath()) + "\" \"" + QString(outAssetsDir) + "Models\\" + workingModelBin.fileName() + "\"");
				int result2 = system(copyCommand.toLocal8Bit().constData());
			}

		}
	}
	else
	{
		qDebug("No working Model folder.");
	}
}
开发者ID:tmgarcia,项目名称:CPPGameEngine,代码行数:39,代码来源:Main.cpp

示例5: inicializa

/**
\param idasiento
**/
void BcAsientoInteligenteView::inicializa ( int idasiento )
{
    BL_FUNC_DEBUG
    numasiento = idasiento;
    inicializaVariables();

    QDir dir ( g_confpr->value( CONF_DIR_AINTELIGENTES ) );
    dir.setFilter ( QDir::Files );
    dir.setNameFilters ( QStringList ( "*.xml" ) );
    dir.setSorting ( QDir::Size | QDir::Reversed );

    QFileInfoList list = dir.entryInfoList();

    if ( list.size() > 0 ) {
        /// Cargamos el combo con los ficheros de asientos inteligentes disponibles
        QStringList listaOrdenada;
        while ( !list.isEmpty() ) {
            QFileInfo fileInfo = list.takeFirst();
            listaOrdenada.append ( fileInfo.fileName().replace ( ".xml", "" ) ); /// cogemos los nombres de los ficheros sin la extension
            listasientos.append ( fileInfo.filePath() ); /// y la ruta completa
        }
        listaOrdenada.sort(); /// se ordena la lista alfabeticamente
        listasientos.sort(); /// y la de la ruta, que se ordenara igual
        while ( !listaOrdenada.isEmpty() )
            mui_comboainteligentes->addItem ( listaOrdenada.takeFirst() ); /// y se carga en el combo

        /// Calculamos el n&uacute;mero de d&iacute;gitos que tiene una cuenta.
        mainCompany() ->begin();
        QString query1 = "SELECT * FROM configuracion WHERE nombre = 'CodCuenta'";
        BlDbRecordSet *cursoraux1 = mainCompany() ->loadQuery ( query1, "codcuenta" );
        numDigitos = cursoraux1->value( 2 ).length();
        mainCompany() ->commit();
        delete cursoraux1;

        on_mui_comboainteligentes_activated ( 0 );
    }
    
}
开发者ID:trifolio6,项目名称:Bulmages,代码行数:41,代码来源:bcasientointeligenteview.cpp

示例6: scanDir

void DirectoryWorker::scanDir(QDir dir)
{
    dir.setNameFilters(m_extensions);
    dir.setFilter(QDir::AllDirs | QDir::Files | QDir::NoDotAndDotDot | QDir::NoSymLinks);

    QFileInfoList fileList = dir.entryInfoList();

    foreach (const QFileInfo &fi, fileList)
    {
        if (fi.isDir())
        {
            scanDir(QDir(fi.absoluteFilePath()));
            continue;
        }

        char sha1[20];

        QString fullPath = fi.absoluteFilePath();
        sha1Compute(fullPath, (unsigned char*)sha1);
        QByteArray byteArray = QByteArray::fromRawData(sha1, 20);
        QString sha1StrHex(byteArray.toHex());
        emit fileFound(fullPath, sha1StrHex);
    }
}
开发者ID:enna-project,项目名称:Enna-Media-Server,代码行数:24,代码来源:DirectoryWorker.cpp

示例7: defaultSettings

QVariant ApplicationsMenuApplet::defaultSettings(void)
{
  QVariantList list;

  for(int y = 0; y < MENU_COUNT; ++y)
    list << QVariant::fromValue<void*>(g_menus[y]);

  QDir dir;
  dir.setNameFilters(QStringList("*.desktop"));
  QStringList dirs = CXDGDirs::appDirectories();
  for(QStringList::const_iterator pos = dirs.begin(); pos != dirs.end(); ++pos)
  {
    dir.setPath(*pos);
    QStringList files = dir.entryList(QDir::Files);
    for(QStringList::const_iterator pos2 = files.begin(); pos2 != files.end(); ++pos2)
    {
      DesktopEntryObject* de = new DesktopEntryObject(dir.absoluteFilePath(*pos2));
      de->Action()->setIcon(de->Action()->icon().pixmap(m_menu->height(),m_menu->height())); // resize icon
      m_entries.push_back(de);
    }
  }

  return QVariant::fromValue<QVariantList>(list);
}
开发者ID:GravisZro,项目名称:qtpanel,代码行数:24,代码来源:applicationsmenuapplet.cpp

示例8: getSpriteDesc

spriteDesc newSpriteDialog::getSpriteDesc(QString type)
{
    spriteDesc result;
    QDir dir;
    dir.setPath("data/sprites/");
    QStringList filters;
    filters << "*.sprite";
    dir.setNameFilters(filters);
    QStringList files = dir.entryList();
    for (int i=0; i<files.count(); i++)
    {
        QString str = files.at(i);
        Defines d;
        d.Load("data/sprites/"+str);
        if (type == d.Get("registername"))
        {
            result.h = d.Get("h").toInt();
            result.w = d.Get("w").toInt();
            result.animations = d.GetList("animationlist");
            return result;
        }
    }
    return result;
}
开发者ID:SpaceWind,项目名称:mapcompiler,代码行数:24,代码来源:newspritedialog.cpp

示例9: loadColorSchemes

void AppearanceSettings::loadColorSchemes()
{
    QHash<QString, QString> colorSchemeNames;
    QStringList installPaths = Qtopia::installPaths();
    for (int i=0; i<installPaths.size(); i++) {
        QString path(installPaths[i] + "etc/colors/");
        QDir dir;
        if (!dir.exists(path)) {
            qLog(UI) << "Color scheme configuration path not found" << path.toLocal8Bit().data();
            continue;
        }

        // read theme.conf files
        dir.setPath(path);
        dir.setNameFilters(QStringList("*.scheme")); // No tr

        // insert (scheme-file-name, scheme-path) pair
        for (uint j=0; j<dir.count(); j++) {
            if (!colorSchemeNames.contains(dir[j]))
                colorSchemeNames[dir[j]] = path + dir[j];
        }
    }
    Theme::setAvailableColorSchemes(colorSchemeNames);
}
开发者ID:Artox,项目名称:qtmoko,代码行数:24,代码来源:appearance.cpp

示例10: readReportNames

bool FrmReports::readReportNames ()
{
    QDir reportsDir;
    reportsDir.setFilter(QDir::Files | QDir::Hidden | QDir::NoSymLinks);
    reportsDir.setSorting(QDir::Size | QDir::Reversed);

    QStringList filters;
    filters << tr("*.bdrt");
    reportsDir.setNameFilters(filters);

    if (reportsDir.exists(qApp->translate("dir", strReportsDir)))
        reportsDir=QDir(qApp->translate("dir", strReportsDir));
    else return false;

    if (!reportsDir.isReadable()) return false;

    QFileInfoList list = reportsDir.entryInfoList(filters,QDir::Files,QDir::Name);
    for (int i = 0; i < list.size(); ++i) {
        QFileInfo fileInfo = list.at(i);
        listWidget->addItem(fileInfo.baseName());
    }

    return true;
}
开发者ID:doublebyte1,项目名称:medfisis,代码行数:24,代码来源:frmreports.cpp

示例11: main

/**
 * entrance
 */
int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);

    cout << "- Tau Labs UAVObject Generator -" << endl;

    QString inputpath;
    QString templatepath;
    QString outputpath;
    QStringList arguments_stringlist;
    QStringList objects_stringlist;

    // process arguments
    for (int argi=1;argi<argc;argi++)
        arguments_stringlist << argv[argi];

    if ((arguments_stringlist.removeAll("-h")>0)||(arguments_stringlist.removeAll("-h")>0)) {
      usage();
      return RETURN_OK; 
    }

    bool verbose=(arguments_stringlist.removeAll("-v")>0);
    bool do_gcs=(arguments_stringlist.removeAll("-gcs")>0);
    bool do_flight=(arguments_stringlist.removeAll("-flight")>0);
    bool do_java=(arguments_stringlist.removeAll("-java")>0);
    bool do_matlab=(arguments_stringlist.removeAll("-matlab")>0);
    bool do_wireshark=(arguments_stringlist.removeAll("-wireshark")>0);
    bool do_none=(arguments_stringlist.removeAll("-none")>0); //

    bool do_all=((do_gcs||do_flight||do_java||do_matlab)==false);
    bool do_allObjects=true;

    if (arguments_stringlist.length() >= 2) {
        inputpath = arguments_stringlist.at(0);
        templatepath = arguments_stringlist.at(1);
    } else {
        // wrong number of arguments
        return usage_err();
    }
    if (arguments_stringlist.length() >2) {
        do_allObjects=false;
        for (int argi=2;argi<arguments_stringlist.length();argi++) {
            objects_stringlist << ( arguments_stringlist.at(argi).toLower() + ".xml" );
        }
    }

    if (!inputpath.endsWith("/"))
        inputpath.append("/"); // append a slash if it is not there

    if (!templatepath.endsWith("/"))
        templatepath.append("/"); // append a slash if it is not there

    // put all output files in the current directory
    outputpath = QString("./");

    QDir xmlPath = QDir(inputpath);
    UAVObjectParser* parser = new UAVObjectParser();

    QStringList filters=QStringList("*.xml");

    xmlPath.setNameFilters(filters);
    QFileInfoList xmlList = xmlPath.entryInfoList();

    // Read in each XML file and parse object(s) in them
    
    for (int n = 0; n < xmlList.length(); ++n) {
        QFileInfo fileinfo = xmlList[n];
        if (!do_allObjects) {
            if (!objects_stringlist.removeAll(fileinfo.fileName().toLower())) {
                if (verbose)
                  cout << "Skipping XML file: " << fileinfo.fileName().toStdString() << endl;
               continue;
            }
        }
        if (verbose)
          cout << "Parsing XML file: " << fileinfo.fileName().toStdString() << endl;
        QString filename = fileinfo.fileName();
        QString xmlstr = readFile(fileinfo.absoluteFilePath());

        QString res = parser->parseXML(xmlstr, filename);

        if (!res.isNull()) {
	    if (!verbose) {
               cout << "Error in XML file: " << fileinfo.fileName().toStdString() << endl;
            }
            cout << "Error parsing " << res.toStdString() << endl;
            return RETURN_ERR_XML;
        }
    }

    if (objects_stringlist.length() > 0) {
        cout << "required UAVObject definitions not found! " << objects_stringlist.join(",").toStdString() << endl;
        return RETURN_ERR_XML;
    }

    // check for duplicate object ID's
    QList<quint32> objIDList;
//.........这里部分代码省略.........
开发者ID:EATtomatoes,项目名称:TauLabs,代码行数:101,代码来源:main.cpp

示例12: QGeoTiledMappingManagerEngine

QGeoMappingManagerEngineCm::QGeoMappingManagerEngineCm(const QMap<QString, QVariant> &parameters, QGeoServiceProvider::Error *error, QString *errorString)
        : QGeoTiledMappingManagerEngine(parameters),
        m_parameters(parameters),
	m_host("b.tile.cloudmade.com"),
	m_token(QGeoServiceProviderFactoryCm::defaultToken)
{
    Q_UNUSED(error)
    Q_UNUSED(errorString)

    setTileSize(QSize(256,256));
    setMinimumZoomLevel(0.0);
    setMaximumZoomLevel(18.0);

    m_styleId = m_parameters.value("style", "1").toString();

    //SL_MAP_TYPE
    QList<QGraphicsGeoMap::MapType> types;
    types << QGraphicsGeoMap::StreetMap;    
    setSupportedMapTypes(types);

    m_nam = new QNetworkAccessManager(this);
    //m_cache = new QNetworkDiskCache(this);
    m_cacheSize = DEFAULT_TILE_CACHE_SIZE;

    QList<QString> keys = m_parameters.keys();

    if (keys.contains("mapping.proxy")) {
        QString proxy = m_parameters.value("mapping.proxy").toString();
        if (!proxy.isEmpty())
            m_nam->setProxy(QNetworkProxy(QNetworkProxy::HttpProxy, proxy, 8080));
    }

    if (keys.contains("mapping.host")) {
        QString host = m_parameters.value("mapping.host").toString();
        if (!host.isEmpty())
            m_host = host;
    }

    if (keys.contains("mapping.cache.directory")) {
        QString cacheDir = m_parameters.value("mapping.cache.directory").toString();
        if (!cacheDir.isEmpty())
            m_cacheDir = cacheDir;
            //m_cache->setCacheDirectory(cacheDir);
    }
    else
    {
        // set default cache dir
        //        QDir dir = QDir::temp();
        QDir dir = QDir(QDesktopServices::storageLocation(QDesktopServices::CacheLocation));
	qDebug() << __FUNCTION__ << "Cache at" << dir;
	
        dir.mkdir(DEFAULT_TILE_CACHE_DIR);
	//	QFileInfo info(dir.absolutePath());
	//	qDebug() << __FUNCTION__ << "Cache size" << info.size();

        dir.cd(DEFAULT_TILE_CACHE_DIR);
        //m_cache->setCacheDirectory(dir.path());
        m_cacheDir = dir.path();
    }
    DBG_CM(TILES_M, INFO_L, "Setting tile cache dir to " << m_cacheDir);

    if (keys.contains("mapping.cache.size")) {
        bool ok = false;
        qint64 cacheSize = m_parameters.value("mapping.cache.size").toString().toLongLong(&ok);
        if (ok) {
            //m_cache->setMaximumCacheSize(cacheSize);
            m_cacheSize = cacheSize;
            DBG_CM(TILES_M, INFO_L, "Setting tile cache size = " << m_cacheSize);
        }
    }

    // first of all: delete all *.png files that may still be lurking in
    // the old cache dir as they may affect the gallery (they are named 
    // png, but are not real png files)
    QDir dir = QDir::temp();
    if(dir.cd("maptiles-cm")) {
      QStringList pngFilters;
      pngFilters << "*.png";
      dir.setNameFilters(pngFilters);
      QStringList pngList = dir.entryList();
      foreach(QString name, pngList)
	dir.remove(name);
      
      dir.cd("..");
      dir.rmdir("maptiles-cm");
    }

    //    if (m_cacheSize > 0) cleanCacheToSize(m_cacheSize);
}
开发者ID:harbaum,项目名称:CacheMe,代码行数:89,代码来源:qgeomappingmanagerengine_cm.cpp

示例13: init1

// ========================================================
int init1 (  )
{
    BL_FUNC_DEBUG


    PluginBl_Report *mcont = new PluginBl_Report;

    QMenu *pPluginMenu = NULL;
    /// Miramos si existe un menu Informes
    pPluginMenu = g_pluginbl_report->menuBar()->findChild<QMenu *> ( "menuInformes" );
    QMenu *pPluginVer = g_pluginbl_report->menuBar()->findChild<QMenu *> ( "menuVentana" );

    /// Buscamos ficheros adecuados
    QDir dir ( g_confpr->value( CONF_DIR_OPENREPORTS ) );
    dir.setFilter ( QDir::Files | QDir::NoSymLinks );
    dir.setSorting ( QDir::Size | QDir::Reversed );
    /// Hacemos un filtrado de busqueda
    QStringList filters;
    filters << "inf_*.txt";
    dir.setNameFilters ( filters );

    QFileInfoList list = dir.entryInfoList();

    
    for ( int i = 0; i < list.size(); ++i ) {
      
        QFileInfo fileInfo = list.at ( i );

        QFile file;
        file.setFileName ( g_confpr->value( CONF_DIR_OPENREPORTS ) + fileInfo.fileName() );
        file.open ( QIODevice::ReadOnly );
        QTextStream stream ( &file );
        QString buff = stream.readAll();
        file.close();

        /// Buscamos el titulo
        QString titulo = fileInfo.fileName();
        QRegExp rx3 ( " title\\s*=\\s*\"(.*)\"" );
        rx3.setMinimal ( true );
        if ( rx3.indexIn ( buff, 0 )  != -1 ) {
            titulo = rx3.cap ( 1 );
        } // end while

        QString pathtitulo = fileInfo.fileName();
        QRegExp rx1 ( "pathtitle\\s*=\\s*\"(.*)\"" );
        rx1.setMinimal ( true );
        if ( rx1.indexIn ( buff, 0 )  != -1 ) {
            pathtitulo = rx1.cap ( 1 );
        } else {
	    pathtitulo = titulo;
	} // end while

        /// Buscamos el icono
        QString icon = ":/Images/template2rml.png";
        QRegExp rx6 ( " icon\\s*=\\s*\"(.*)\"" );
        rx6.setMinimal ( true );
        if ( rx6.indexIn ( buff, 0 )  != -1 ) {
            icon = rx6.cap ( 1 );
        } // end while


	QMenuBar *menubar =g_pluginbl_report->menuBar();
	QMenu *menu = NULL;
	QStringList path = pathtitulo.split("\\");


	if (path.size() > 1) {
		    QList<QMenu *> allPButtons = menubar->findChildren<QMenu *>();
		    bool encontrado = false;
		    for (int j = 0; j < allPButtons.size(); ++j) {
			if (allPButtons.at(j)->title() == path[0]) {
			    encontrado = true;
			    menu = allPButtons.at(j);
			} // end if
		    } // end for

		    if (!encontrado) {
			QMenu *pPluginMenu1 = new QMenu (path[0] , menubar );
                        menubar->insertMenu ( pPluginVer->menuAction(), pPluginMenu1 );
			menu = pPluginMenu1;
		    } // end if
	} else {

		    if (!pPluginMenu) {
			    pPluginMenu = new QMenu ( _ ( "Informes" ), g_pluginbl_report->menuBar() );
			    pPluginMenu->setObjectName ( QString::fromUtf8 ( "menuInformes" ) );
			    g_pluginbl_report->menuBar()->insertMenu ( pPluginVer->menuAction(), pPluginMenu );
		    } // end if
		    menu = pPluginMenu;
	} // end if
	


	for (int i = 1; i < path.size()-1; ++i) {
	    QList<QMenu *> allPButtons = menu->findChildren<QMenu *>();
	    bool encontrado = false;
	    for (int j = 0; j < allPButtons.size(); ++j) {
		if (allPButtons.at(j)->title() == path[i]) {
		    encontrado = true;
//.........这里部分代码省略.........
开发者ID:JustDevZero,项目名称:bulmages,代码行数:101,代码来源:pluginbl_report.cpp

示例14: run

void ThreadedTracer::run(){

qDebug()<<"loadScan input: "<<latestString;
//QString latestString = getFileString();
//    latestString =QString("/data/mat/BRL/DATA_FOR_GROUP/testDataForZhi/ZSeries-06092016-1407-8470/ZSeries-06092016-1407-8470_Cycle00001_Ch1_000001.ome.tif");
//    bool isAdaptive = 1;
//    int methodChoice = 1;

//LandmarkList inputRootList;
QString fString;
fString = QString("Cycle%1").arg(tileNumber,5,10,QLatin1Char('0'));
qDebug()<<tileNumber;

QList<LandmarkList> newTipsList;
LandmarkList newTargetList;

QFileInfo imageFileInfo = QFileInfo(latestString);
if (imageFileInfo.isReadable()){
    Image4DSimple * pNewImage = cb->loadImage(latestString.toLatin1().data());
    QDir imageDir =  imageFileInfo.dir();
    QStringList filterList;
    filterList.append(QString("*").append(fString).append("_Ch").append(channel).append("*.tif"));
    qDebug()<<"filterlist.first()"<<filterList.first();
    imageDir.setNameFilters(filterList);
    QStringList fileList = imageDir.entryList();

    //use this to id the number of images in the stack (in one channel?!)
    V3DLONG x = pNewImage->getXDim();
    V3DLONG y = pNewImage->getYDim();
    V3DLONG nFrames = fileList.length();

    V3DLONG tunits = x*y*nFrames;
    unsigned short int * total1dData = new unsigned short int [tunits];
    unsigned short int * total1dData_mip= new unsigned short int [x*y];
    for(V3DLONG i =0 ; i < x*y; i++)
        total1dData_mip[i] = 0;
    V3DLONG totalImageIndex = 0;
    double p_vmax=0;
    qDebug()<<"nFrames = "<<nFrames;
    for (int f=0; f<nFrames; f++){
        qDebug()<<fileList[f];
        Image4DSimple * pNewImage = cb->loadImage(imageDir.absoluteFilePath(fileList[f]).toLatin1().data());
        if (pNewImage->valid()){
            unsigned short int * data1d = 0;
            data1d = new unsigned short int [x*y];
            data1d = (unsigned short int*)pNewImage->getRawData();
            for (V3DLONG i = 0; i< (x*y); i++)
            {
                total1dData[totalImageIndex]= data1d[i];
                if(data1d[i] > p_vmax) p_vmax = data1d[i];
                if(total1dData_mip[i] < data1d[i]) total1dData_mip[i] = data1d[i];
                totalImageIndex++;
            }
            if(data1d) {delete []data1d; data1d = 0;}
        }else{
            qDebug()<<imageDir.absoluteFilePath(fileList[f])<<" failed!";
        }
    }

    Image4DSimple* total4DImage = new Image4DSimple;
    total4DImage->setData((unsigned char*)total1dData, x, y, nFrames, 1, V3D_UINT16);

    Image4DSimple* total4DImage_mip = new Image4DSimple;
    total4DImage_mip->setData((unsigned char*)total1dData_mip, x, y, 1, 1, V3D_UINT16);


    QString swcString = saveDirString;
    swcString.append("/x_").append(QString::number((int)tileLocation.x)).append("_y_").append(QString::number((int)tileLocation.y)).append("_").append(imageFileInfo.fileName()).append(fString).append(".swc");


    QString scanDataFileString = saveDirString;
    scanDataFileString.append("/").append("scanData.txt");
    qDebug()<<scanDataFileString;
    QFile saveTextFile;
    saveTextFile.setFileName(scanDataFileString);// add currentScanFile
    if (!saveTextFile.isOpen()){
        if (!saveTextFile.open(QIODevice::Text|QIODevice::Append  )){
            qDebug()<<"unable to save file!";
            return;}     }
    QTextStream outputStream;
    outputStream.setDevice(&saveTextFile);
    total4DImage->setOriginX(tileLocation.x);
    total4DImage->setOriginY(tileLocation.y);

    qDebug()<<total4DImage->getOriginX();


    outputStream<< (int) total4DImage->getOriginX()<<" "<< (int) total4DImage->getOriginY()<<" "<<swcString<<" "<< (int) x<<" "<< (int) y<<" "<<"\n";

    saveTextFile.close();
    V3DLONG mysz[4];
    mysz[0] = total4DImage->getXDim();
    mysz[1] = total4DImage->getYDim();
    mysz[2] = total4DImage->getZDim();
    mysz[3] = total4DImage->getCDim();

    tileLocation.ev_pc1 = (double) total4DImage->getXDim();
    tileLocation.ev_pc2 = (double) total4DImage->getYDim();


//.........这里部分代码省略.........
开发者ID:Vaa3D,项目名称:vaa3d_tools,代码行数:101,代码来源:threadedTracer.cpp

示例15: init

int init (  )
{
    BL_FUNC_DEBUG

    /// Inicializa el sistema de traducciones 'gettext'.
    setlocale ( LC_ALL, "" );
    blBindTextDomain ( "pluginbl_report2ods", g_confpr->value( CONF_DIR_TRADUCCION ).toLatin1().constData() );



    PluginBl_Report2ODS *mcont = new PluginBl_Report2ODS;

    QMenu *pPluginMenu = NULL;

    /// Buscamos ficheros que tengan el nombre de la tabla
    QDir dir ( g_confpr->value( CONF_DIR_OPENREPORTS ) );
    dir.setFilter ( QDir::Files | QDir::NoSymLinks );
    dir.setSorting ( QDir::Size | QDir::Reversed );
    /// Hacemos un filtrado de busqueda
    QStringList filters;
    filters << "inf_*.pys";
    dir.setNameFilters ( filters );

    QFileInfoList list = dir.entryInfoList();

    for ( int i = 0; i < list.size(); ++i ) {
        QFileInfo fileInfo = list.at ( i );

        QFile file;
        file.setFileName ( g_confpr->value( CONF_DIR_OPENREPORTS ) + fileInfo.fileName() );
        file.open ( QIODevice::ReadOnly );
        QTextStream stream ( &file );
        QString buff = stream.readAll();
        file.close();

        /// Buscamos el titulo
        QString titulo = fileInfo.fileName();
        QRegExp rx3 ( "title\\s*=\\s*\"(.*)\"" );
        rx3.setMinimal ( true );
        if ( rx3.indexIn ( buff, 0 )  != -1 ) {
            titulo = rx3.cap ( 1 );
        } // end if

        QString pathtitulo = fileInfo.fileName();
        QRegExp rx1 ( "pathtitle\\s*=\\s*\"(.*)\"" );
        rx1.setMinimal ( true );
        if ( rx1.indexIn ( buff, 0 )  != -1 ) {
            pathtitulo = rx1.cap ( 1 );
	} else {
	    pathtitulo = titulo;
        } // end if

        /// Buscamos el icono
        QString icon = ":/Images/template2ods.png";
        QRegExp rx4 ( " icon\\s*=\\s*\"(.*)\"" );
        rx4.setMinimal ( true );
        if ( rx4.indexIn ( buff, 0 )  != -1 ) {
            icon = rx4.cap ( 1 );
        } // end if

	QMenuBar *menubar =g_pluginbl_report2ods->menuBar();
	QMenu *menu = NULL;
	QStringList path = pathtitulo.split("\\");

	if (path.size() > 1) {
		    QList<QMenu *> allPButtons = menubar->findChildren<QMenu *>();
		    bool encontrado = false;
		    for (int j = 0; j < allPButtons.size(); ++j) {
			if (allPButtons.at(j)->title() == path[0]) {
			    encontrado = true;
			    menu = allPButtons.at(j);
			} // end if
		    } // end for
		    if (!encontrado) {
			//QMenu *pPluginMenu1 = new QMenu (  path[0] , menubar );
			//menubar->insertMenu ( pPluginVer->menuAction(), pPluginMenu1 );
        		/// Miramos si existe un menu Herramientas
			menu = g_pluginbl_report2ods->newMenu ( path[0], "", "menuHerramientas" );
		    } // end if
	} else {

		    if (!pPluginMenu) {
			    pPluginMenu = g_pluginbl_report2ods->newMenu ( _("Informes &ODS"), "menuInfODS", "menuHerramientas" );
		    } // end if
		    menu = pPluginMenu;
	} // end if
	


	for (int i = 1; i < path.size()-1; ++i) {
	    QList<QMenu *> allPButtons = menu->findChildren<QMenu *>();
	    bool encontrado = false;
	    for (int j = 0; j < allPButtons.size(); ++j) {
		if (allPButtons.at(j)->title() == path[i]) {
		    encontrado = true;
		    menu = allPButtons.at(j);
		} // end if
	    } // end for

	    if (!encontrado) {
//.........这里部分代码省略.........
开发者ID:JustDevZero,项目名称:bulmages,代码行数:101,代码来源:pluginbl_report2ods.cpp


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