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


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

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


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

示例1: compile

bool ModPlusDymolaCtrl::compile(const QFileInfoList & moDependencies)
{
    InfoSender::sendCurrentTask("Dymola : Compiling model "+_modModelPlus->modModelName());

    //QString logFilePath = _mmoFolder+QDir::separator()+"log.html";
    QString logFilePath = _modModelPlus->mmoFolder().absoluteFilePath("buildlog.txt");

    //********************
    // update dependencies
    //********************
    QFileInfoList moDeps = moDependencies;
    // 1- add project loaded mo files
    QFileInfoList projectMoFiles = _project->moFiles();
    for(int i=0;i<projectMoFiles.size();i++)
        if(!moDeps.contains(projectMoFiles.at(i)))
            moDeps.push_back(projectMoFiles.at(i));

    // 2 - remove modelica library from moDependencies since Dymola
    // automatically loads it
    moDeps.removeAll(_project->moomc()->getFileOfClass("Modelica"));

    // compile
    bool success = Dymola::firstRun(_modModelPlus->moFilePath(),_modModelPlus->modModelName(),
                                    _modModelPlus->mmoFolder(),logFilePath,moDeps,_modModelPlus->neededFiles());

    // Inform
    ListInfo::InfoNum iMsg;
    if(success)
        iMsg = ListInfo::MODELCOMPILATIONSUCCESS;
    else
        iMsg = ListInfo::MODELCOMPILATIONFAIL;

    // Infos
    InfoSender::instance()->send(Info(iMsg,_modModelPlus->modModelName(),logFilePath));
    InfoSender::instance()->eraseCurrentTask();

    return success;
}
开发者ID:SemiSQ,项目名称:OpenModelica,代码行数:38,代码来源:ModPlusDymolaCtrl.cpp

示例2: handleOpenFileEvent

// Open a new file
void MainWindow::handleOpenFileEvent(QString filename, QString filter) {

// On Windows, we have to remove all three '/' after 'file:', on Linux, we need to leave one of them
#ifdef Q_OS_WIN
	if(filename.startsWith("file:///"))
		filename = filename.remove(0,8);
#else
	if(filename.startsWith("file://"))
		filename = filename.remove(0,7);
#endif

	if(filename.trimmed() == "") {
		QMetaObject::invokeMethod(object, "openFile");
		return;
	}

	variables->keepLoadingThumbnails = true;

	setOverrideCursor();

	if(variables->verbose)
		LOG << CURDATE << "handleOpenFileEvent(): Handle response to request to open new file" << NL;

	// Decode filename
	QByteArray usethis = QByteArray::fromPercentEncoding(filename.trimmed().toUtf8());

	// Store filter
	variables->openfileFilter = filter;


	QString file = "";

	// Check return file
	file = usethis;

	QMetaObject::invokeMethod(object, "alsoIgnoreSystemShortcuts",
				  Q_ARG(QVariant, false));

	// Save current directory
	variables->currentDir = QFileInfo(file).absolutePath();

	// Clear loaded thumbnails
	variables->loadedThumbnails.clear();

	// Load direcgtory
	QFileInfoList l = loadDir->loadDir(file,variables->openfileFilter);
	if(l.isEmpty()) {
		QMetaObject::invokeMethod(object, "noResultsFromFilter");
		restoreOverrideCursor();
		return;
	}
	if(!l.contains(QFileInfo(file)))
		file = l.at(0).filePath();

	// Get and store length
	int l_length = l.length();
	settingsPerSession->setValue("countTot",l_length);

	// Convert QFileInfoList into QStringList and store it
	QStringList ll;
	for(int i = 0; i < l_length; ++i)
		ll.append(l.at(i).absoluteFilePath());
	settingsPerSession->setValue("allFileList",ll);

	// Get and store current position
	int curPos = l.indexOf(QFileInfo(file));
	settingsPerSession->setValue("curPos",curPos);

	// Setiup thumbnail model
	QMetaObject::invokeMethod(object, "setupModel",
		Q_ARG(QVariant, ll),
		Q_ARG(QVariant, curPos));

	// Display current postiion in main image view
	QMetaObject::invokeMethod(object, "displayImage",
				  Q_ARG(QVariant, curPos));

	QVariant centerPos = curPos;
	if(!QMetaObject::invokeMethod(object, "getCenterPos",
				  Q_RETURN_ARG(QVariant, centerPos)))
		std::cerr << CURDATE <<  "handleOpenFileEvent(): ERROR: couldn't get center pos!" << NL;

	// And handle the thumbnails
	handleThumbnails(centerPos.toInt());

	restoreOverrideCursor();

}
开发者ID:asif-mahmud,项目名称:photoqt,代码行数:89,代码来源:mainwindow.cpp


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