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


C++ QStringList::at方法代码示例

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


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

示例1: parseString

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigEquil RigEquil::parseString(const QString& keywordData)
{
    double datumDepth                       = 0.0;
    double datuDepthPressure                = 0.0;
    double waterOilContactDepth             = 0.0;
    double waterOilContactCapillaryPressure = 0.0;
    double gasOilContactDepth               = 0.0;
    double gasOilContactCapillaryPressure   = 0.0;
    bool   liveOilInitConstantRs            = false;
    bool   wetGasInitConstantRv             = false;
    int    initializationTargetAccuracy     = -5;

    QString line(keywordData);
    line.replace("\t", " ");

    QStringList items = line.split(" ");
    if (items.size() > 0)
    {
        datumDepth = items.at(0).toDouble();
    }

    if (items.size() > 1)
    {
        datuDepthPressure = items.at(1).toDouble();
    }
    if (items.size() > 2)
    {
        waterOilContactDepth = items.at(2).toDouble();
    }
    if (items.size() > 3)
    {
        waterOilContactCapillaryPressure = items.at(3).toDouble();
    }
    if (items.size() > 4)
    {
        gasOilContactDepth = items.at(4).toDouble();
    }
    if (items.size() > 5)
    {
        gasOilContactCapillaryPressure = items.at(5).toDouble();
    }
    if (items.size() > 6)
    {
        liveOilInitConstantRs = items.at(6).toInt() > 0 ? true : false;
    }
    if (items.size() > 7)
    {
        wetGasInitConstantRv = items.at(7).toInt() > 0 ? true : false;
    }
    if (items.size() > 8)
    {
        initializationTargetAccuracy = items.at(8).toInt();
    }

    return RigEquil(datumDepth,
                    datuDepthPressure,
                    waterOilContactDepth,
                    waterOilContactCapillaryPressure,
                    gasOilContactDepth,
                    gasOilContactCapillaryPressure,
                    liveOilInitConstantRs,
                    wetGasInitConstantRv,
                    initializationTargetAccuracy);
}
开发者ID:OPM,项目名称:ResInsight,代码行数:67,代码来源:RigEquil.cpp

示例2: newConnection

void Application::newConnection()
{
	QLocalSocket *socket = m_localServer->nextPendingConnection();

	if (!socket)
	{
		return;
	}

	socket->waitForReadyRead(1000);

	MainWindow *window = (getWindows().isEmpty() ? NULL : getWindow());
	QString data;
	QTextStream stream(socket);
	stream >> data;

	const QStringList encodedArguments = QString(QByteArray::fromBase64(data.toUtf8())).split(QLatin1Char(' '));
	QStringList decodedArguments;

	for (int i = 0; i < encodedArguments.count(); ++i)
	{
		decodedArguments.append(QString(QByteArray::fromBase64(encodedArguments.at(i).toUtf8())));
	}

	QCommandLineParser *parser = getParser();
	parser->parse(decodedArguments);

	const QString session = parser->value(QLatin1String("session"));
	const bool isPrivate = parser->isSet(QLatin1String("privatesession"));

	if (session.isEmpty())
	{
		if (!window || !SettingsManager::getValue(QLatin1String("Browser/OpenLinksInNewTab")).toBool() || (isPrivate && !window->getWindowsManager()->isPrivate()))
		{
			window = createWindow(isPrivate);
		}
	}
	else
	{
		const SessionInformation sessionData = SessionsManager::getSession(session);

		if (sessionData.clean || QMessageBox::warning(NULL, tr("Warning"), tr("This session was not saved correctly.\nAre you sure that you want to restore this session anyway?"), QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes)
		{
			for (int i = 0; i < sessionData.windows.count(); ++i)
			{
				createWindow(isPrivate, false, sessionData.windows.at(i));
			}
		}
	}

	if (window)
	{
		if (!parser->positionalArguments().isEmpty())
		{
			const QStringList urls = parser->positionalArguments();

			for (int i = 0; i < urls.count(); ++i)
			{
				window->openUrl(urls.at(i));
			}
		}
		else if (session.isEmpty())
		{
			window->openUrl();
		}
	}

	delete socket;

	if (window)
	{
		window->raise();
		window->activateWindow();
	}

	delete parser;
}
开发者ID:vbeljan,项目名称:otter,代码行数:77,代码来源:Application.cpp

示例3: populateBoxes

void VideoTab::populateBoxes()
{
    QStringList values;
    QString current_selected = "";
    int index = -1;

    //aspect_ratio
    values = code_int->get_combo_vals("Video", "aspect_ratio");
    values.removeAll("");
    current_selected = cmb_aspect_ratio->currentText();
    cmb_aspect_ratio->clear();

    cmb_aspect_ratio->addItem("");

    for(int i = 0; i < values.size(); i++)
    {
        cmb_aspect_ratio->addItem(values[i]);
    }
    index = cmb_aspect_ratio->findText(current_selected);
    cmb_aspect_ratio->setCurrentIndex(index);


    //color_matrix
    values = code_int->get_combo_vals("Video", "color_matrix");
    values.removeAll("");
    current_selected = cmb_color_matrix->currentText();
    cmb_color_matrix->clear();
    cmb_color_matrix->addItem("");

    for(int i = 0; i < values.size(); i++)
    {
        cmb_color_matrix->addItem(values[i]);
    }
    index = cmb_color_matrix->findText(current_selected);
    cmb_color_matrix->setCurrentIndex(index);


    //encryption
    values = code_int->get_combo_vals("Video", "encryption");
    values.removeAll("");
    current_selected = cmb_encryption->currentText();
    cmb_encryption->clear();

    cmb_encryption->addItem("");

    for(int i = 0; i < values.size(); i++)
    {
        cmb_encryption->addItem(values[i]);
    }
    index = cmb_encryption->findText(current_selected);
    cmb_encryption->setCurrentIndex(index);


    //frame_rate_scan
    values = code_int->get_combo_vals("Video", "frame_rate_scan");
    values.removeAll("");
    current_selected = cmb_frame_rate_scan->currentText();
    cmb_frame_rate_scan->clear();

    cmb_frame_rate_scan->addItem("");

    for(int i = 0; i < values.size(); i++)
    {
        cmb_frame_rate_scan->addItem(values[i]);
    }
    index = cmb_frame_rate_scan->findText(current_selected);
    cmb_frame_rate_scan->setCurrentIndex(index);


    //frame_rate_value_min
    values = code_int->get_combo_vals("Video", "frame_rate_value");
    values.removeAll("");
    current_selected = cmb_frame_rate_min->currentText();
    cmb_frame_rate_min->clear();

    cmb_frame_rate_min->addItem("");

    for(int i = 0; i < values.size(); i++)
    {
        cmb_frame_rate_min->addItem(values[i]);
    }
    index = cmb_frame_rate_min->findText(current_selected);
    cmb_frame_rate_min->setCurrentIndex(index);


    //frame_rate_value_max
    values = code_int->get_combo_vals("Video", "frame_rate_value");
    values.removeAll("");
    current_selected = cmb_frame_rate_max->currentText();
    cmb_frame_rate_max->clear();

    cmb_frame_rate_max->addItem("");

    for(int i = (values.size() - 1); i >= 0; i--)
    { //Reverses the order of the elements
        cmb_frame_rate_max->addItem(values[i]);
    }
    index = cmb_frame_rate_max->findText(current_selected);
    cmb_frame_rate_max->setCurrentIndex(index);

//.........这里部分代码省略.........
开发者ID:nathan313743,项目名称:RS-Video-Analyser,代码行数:101,代码来源:VideoTab.cpp

示例4: resolveLocationIssues

void QrcEditor::resolveLocationIssues(QStringList &files)
{
    const QDir dir = QFileInfo(m_treeview->fileName()).absoluteDir();
    const QString dotdotSlash = QLatin1String("../");
    int i = 0;
    int count = files.count();

    // Find first troublesome file
    for (; i < count; i++) {
        QString const &file = files.at(i);
        const QString relativePath = dir.relativeFilePath(file);
        if (relativePath.startsWith(dotdotSlash))
            break;
    }

    // All paths fine -> no interaction needed
    if (i == count) {
        return;
    }

    // Interact with user from now on
    bool abort = false;
    for (; i < count; i++) {
        // Path fine -> skip file
        QString const &file = files.at(i);
        QString const relativePath = dir.relativeFilePath(file);
        if (!relativePath.startsWith(dotdotSlash)) {
            continue;
        }

        // Path troublesome and aborted -> remove file
        if (abort) {
            files.removeAt(i);
            count--;
            i--;
            continue;
        } else {
            // Path troublesome -> query user
            QMessageBox message(this);
            message.setWindowTitle(tr("Invalid file"));
            message.setIcon(QMessageBox::Warning);
            QPushButton * const continueButton = message.addButton(tr("Add anyway"), QMessageBox::AcceptRole);
            QPushButton * const copyButton = message.addButton(tr("Copy"), QMessageBox::ActionRole);
            QPushButton * const skipButton = message.addButton(tr("Don't add"), QMessageBox::DestructiveRole);
            QPushButton * const abortButton = message.addButton(tr("Abort"), QMessageBox::RejectRole);
            message.setDefaultButton(copyButton);
            message.setEscapeButton(skipButton);
            message.setText(tr("The file %1 is not in a subdirectory of the resource file. Continuing will result in an invalid resource file.")
                            .arg(QDir::toNativeSeparators(file)));
            message.exec();
            if (message.clickedButton() == continueButton) {
                continue;
            } else if (message.clickedButton() == skipButton) {
                files.removeAt(i);
                count--;
                i--; // Compensate i++
            } else if (message.clickedButton() == copyButton) {
                const QFileInfo fi(file);
                const QFileInfo suggestion(dir, fi.fileName());
                const QString copyName = QFileDialog::getSaveFileName(this, tr("Choose copy location"),
                                                                suggestion.absoluteFilePath());
                if (!copyName.isEmpty()) {
                    if (QFile::exists(copyName)) {
                        if (!QFile::remove(copyName)) {
                            QMessageBox::critical(this, tr("Overwrite failed"),
                                                  tr("Could not overwrite file %1.")
                                                  .arg(QDir::toNativeSeparators(copyName)));
                            // Remove file
                            files.removeAt(i);
                            count--;
                            i--; // Compensate i++
                            continue;
                        }
                    }
                    if (!QFile::copy(file, copyName)) {
                        QMessageBox::critical(this, tr("Copying failed"),
                                              tr("Could not copy the file to %1.")
                                              .arg(QDir::toNativeSeparators(copyName)));
                        // Remove file
                        files.removeAt(i);
                        count--;
                        i--; // Compensate i++
                        continue;
                    }
                    files[i] = copyName;
                } else {
                    // Remove file
                    files.removeAt(i);
                    count--;
                    i--; // Compensate i++
                }
            } else if (message.clickedButton() == abortButton) {
                abort = true;

                files.removeAt(i);
                count--;
                i--; // Compensate i++
            }
        }
    }
//.........这里部分代码省略.........
开发者ID:ramons03,项目名称:qt-creator,代码行数:101,代码来源:qrceditor.cpp

示例5: OnClipboardStatisticsButtonClicked

void QmitkImageStatisticsView::OnClipboardStatisticsButtonClicked()
{
  QLocale tempLocal;
  QLocale::setDefault(QLocale(QLocale::English, QLocale::UnitedStates));
  if ( m_CurrentStatisticsValid && !( m_SelectedPlanarFigure != NULL))
   {
    const std::vector<mitk::ImageStatisticsCalculator::Statistics> &statistics =
      this->m_CalculationThread->GetStatisticsData();

    // Set time borders for for loop ;)
    unsigned int startT, endT;
    if(this->m_Controls->m_CheckBox4dCompleteTable->checkState()==Qt::CheckState::Unchecked)
    {
        startT = this->GetRenderWindowPart()->GetTimeNavigationController()->GetTime()->
          GetPos();
        endT = startT+1;
    }
    else
    {
        startT = 0;
        endT = statistics.size();
    }
    QVector< QVector<QString> > statisticsTable;
    QStringList headline;

    // Create Headline
    headline << " "
             << "Mean"
             << "Median"
             << "StdDev"
             << "RMS"
             << "Max"
             << "Min"
             << "NumberOfVoxels"
             << "Skewness"
             << "Kurtosis"
             << "Uniformity"
             << "Entropy"
             << "MPP"
             << "UPP"
             << "V [mm³]";

    for(int i=0;i<headline.size();i++)
    {
        QVector<QString> row;
        row.append(headline.at(i));
        statisticsTable.append(row);
    }

    // Fill Table
    for(unsigned int t=startT;t<endT;t++)
    {
        // Copy statistics to clipboard ("%Ln" will use the default locale for
        // number formatting)
        QStringList value;
        value << QString::number(t)
              << QString::number(statistics[t].GetMean())
              << QString::number(statistics[t].GetMedian())
              << QString::number(statistics[t].GetSigma())
              << QString::number(statistics[t].GetRMS())
              << QString::number(statistics[t].GetMax())
              << QString::number(statistics[t].GetMin())
              << QString::number(statistics[t].GetN())
              << QString::number(statistics[t].GetSkewness())
              << QString::number(statistics[t].GetKurtosis())
              << QString::number(statistics[t].GetUniformity())
              << QString::number(statistics[t].GetEntropy())
              << QString::number(statistics[t].GetMPP())
              << QString::number(statistics[t].GetUPP())
              << QString::number(m_Controls->m_StatisticsTable->item(7, 0)->data(Qt::DisplayRole).toDouble());

         for(int z=0;z<value.size();z++)
         {
             statisticsTable[z].append(value.at(z));
         }
    }

    // Create output string
    QString clipboard;
    for(int i=0;i<statisticsTable.size();i++)
    {
        for(int t=0;t<statisticsTable.at(i).size();t++)
        {
            clipboard.append(statisticsTable.at(i).at(t));
            clipboard.append("\t");
        }
        clipboard.append("\n");
    }
    QApplication::clipboard()->setText(clipboard, QClipboard::Clipboard);
  }
  else
  {
    QApplication::clipboard()->clear();
  }
  QLocale::setDefault(tempLocal);
}
开发者ID:151706061,项目名称:MITK,代码行数:96,代码来源:QmitkImageStatisticsView.cpp

示例6: ModPlusCtrls

Optimization::Optimization(QDomElement domProblem,Project* project,bool &ok)
    :Problem((ProjectBase*)project)
{
    // initialization
    _omProject = project;
    _algos = OptimAlgoUtils::getNewAlgos(this);

    // look for modmodelplus
    ok = !domProblem.isNull();
    ok = ok && (domProblem.tagName()==Optimization::className());
    if(ok)
    {

        QDomElement  domInfos = domProblem.firstChildElement("Infos");
        this->setName(domInfos.attribute("name", "" ));

        // compatibility with older saving format (one model, saved in Infos node)
        if(!domInfos.attribute("model").isEmpty())
        {
            QString modelName = domInfos.attribute("model");
            ModModelPlus* model = project->modModelPlus(modelName);

            // read corresponding controlers
            QDomElement domCtrls = domProblem.firstChildElement(ModPlusCtrls::className());
            ModPlusCtrls* ctrls = new ModPlusCtrls(project,model,domCtrls);

            // add model
            this->addModel(domInfos.attribute("model"));
        }

        // new format
        QDomElement domModels = domProblem.firstChildElement("Models");
        QDomElement domModel = domModels.firstChildElement("Model");
        while(!domModel.isNull())
        {
            QString modelName = domModel.attribute("name");
            ModModelPlus* model = project->modModelPlus(modelName);

            // read corresponding controlers
            QDomElement domCtrls = domModel.firstChildElement(ModPlusCtrls::className());
            ModPlusCtrls* ctrls = new ModPlusCtrls(project,model,domCtrls);

            // add model and controlers
            this->addModel(modelName,ctrls);


            domModel = domModel.nextSiblingElement("Model");
        }

    }


    //initialize default(otherwise seg fault in destructor)
    _optimizedVariables = new OptVariables(true);
    _scannedVariables = new ScannedVariables(true);
    _overwritedVariables = new Variables(true);
    _objectives = new OptObjectives(true);

    // Optimized Variables
    QDomElement domOptVars = domProblem.firstChildElement("OptimizedVariables");
    this->optimizedVariables()->setItems(domOptVars);

    // Objectives
    QDomElement domObj = domProblem.firstChildElement("Objectives");
    this->objectives()->setItems(domObj);

    // Scanned Variables
    QDomElement domScann = domProblem.firstChildElement("ScannedVariables");
    this->scannedVariables()->setItems(domScann);

    // Overvars Variables
    QDomElement domOverVars = domProblem.firstChildElement("OverwritedVariables");
    this->overwritedVariables()->setItems(domOverVars);
    for(int i=0;i<overwritedVariables()->size();i++)
        overwritedVariables()->at(i)->setIsEditableField(Variable::VALUE,true);

    // Files to copy
    QDomElement cFilesToCopy = domProblem.firstChildElement("FilesToCopy");
    QString text = cFilesToCopy.text();
    QStringList strList = text.split("\n",QString::SkipEmptyParts);
    for(int i=0;i<strList.size();i++)
        this->_filesToCopy.push_back(QFileInfo(strList.at(i)));

    // BlockSubstitutions
    QDomElement domBlockSubs = domProblem.firstChildElement("BlockSubstitutions");
    _blockSubstitutions = new BlockSubstitutions(project,domBlockSubs);

    // EA
    QDomElement domEA = domProblem.firstChildElement("EA");
    QDomElement domEAInfos = domEA.firstChildElement("Infos");
    if(!domEAInfos.isNull())
    {
        this->setiCurAlgo(domEAInfos.attribute("num", "" ).toInt());
    }
    QDomElement domEAParameters = domEA.firstChildElement("Parameters");
    if(!domEAParameters.isNull())
    {
        this->getCurAlgo()->_parameters->update(domEAParameters);
    }
}
开发者ID:SemiSQ,项目名称:OpenModelica,代码行数:100,代码来源:Optimization.cpp

示例7: addModels

bool Optimization::addModels(QStringList models)
{
    for(int i=0;i<models.size();i++)
        addModel(models.at(i));
}
开发者ID:SemiSQ,项目名称:OpenModelica,代码行数:5,代码来源:Optimization.cpp

示例8: readfile

void beamtest::readfile()
{

QTime time;
time.start();
Handle_AIS_InteractiveContext ic = ui::getInstance()->getWindowContext();

double chunk = 30000000;
double chunkcount = 3;
//double maxpoints = chunkcount * chunk;
double maxpoints = chunk-1;
Graphic3d_Array1OfVertex* thepointcloud1 = new Graphic3d_Array1OfVertex(1,chunk);


//Graphic3d_Array1OfVertex thepointcloud2(1,chunk);
//Graphic3d_Array1OfVertex thepointcloud3(1,chunk);


QString filename = QFileDialog::getOpenFileName ( this,
												 tr("Import File"),"",
												 tr( "All point cloud formats (*.ptx);;" 
												 "XYZ (*.xyz *XYZ);;" 
												 "PTX (*.ptx *.PTX)"));

QFile file(filename);
if (!file.open(QFile::ReadOnly)) return ;

QMap<QString,gp_Pnt> pointmap;


QProgressDialog progress("loading cloudpoint", "Abort Copy", 1,100);

int count = 0;
int filepos = 0;
QTextStream stream(&file );
QString line;
 do {
        filepos++;
        //qDebug() << "file-linepos:" << filepos;


    line = stream.readLine();


        QStringList linelist = line.split(tr(" "));
        if (linelist.size() == 4)
        {
           
               double x = linelist.at(0).toDouble();
               double y = linelist.at(1).toDouble();
               double z = linelist.at(2).toDouble();
               QString index = linelist.at(0) + linelist.at(1) + linelist.at(2) ;

               if(!pointmap.contains(index))
               {
			    	   count++;
					   if (count % 100000 == 0){
					   progress.setValue((count *100/maxpoints));
						   }
                      // double intensity = linelist.at(3).toDouble();
                       gp_Pnt p1(x,y,z);
                       //TopoDS_Shape point =hsf::AddNewPoint(p1);
                       //vis(point)
					   Graphic3d_Vertex thevert(x,y,z);
					   thepointcloud1->SetValue(count,thevert);
			/*		   if (count < chunk && count > 0)
					   {
						   thepointcloud1.SetValue(count,thevert);
					   } else if (count > chunk && count <= (2*chunk))
					   {
						   thepointcloud2.SetValue(count-chunk,thevert);
					   } else if (count > (2*chunk) && count < (3 * chunk))
					   {
						   thepointcloud3.SetValue(count-(chunk*2),thevert);
					   }*/
					   

                       pointmap.insert(index,p1);
               }

        }

if (count > maxpoints) break;

 } while (!line.isNull());

//Handle(AIS_PointCloud) mypc1 = new AIS_PointCloud(*thepointcloud1);
//ic->Display(mypc1);

//
//Handle(AIS_PointCloud) mypc2 = new AIS_PointCloud(thepointcloud2);
//ic->Display(mypc2);
//
//
//Handle(AIS_PointCloud) mypc3 = new AIS_PointCloud(thepointcloud3);
//ic->Display(mypc3);

//ENDPART

double milliseconds = time.elapsed();
//.........这里部分代码省略.........
开发者ID:jf---,项目名称:openshapefactory,代码行数:101,代码来源:beamtest.cpp

示例9: writebinarytochunkswithcolor

void beamtest::writebinarytochunkswithcolor()
	{
QFileInfo fileInfo;

QString filename = QFileDialog::getOpenFileName ( this,tr("Import File"),
												 "",tr( "All point cloud formats (*.ptx);;"
												 "XYZ (*.xyz *XYZ);;"
												 "PTX (*.ptx *.PTX)"));



	
		 int chunk = 2000000;
		 //int numfiles = floor((double) shapecount / (double) chunk);
		 int shapecounter=0;
		 int filecounter = 0;

double chunksize= 2000000;
int count =0;
int debugcount = 0;
char buf[1024];
QFile file(filename);
qint64 lineLength=0;
QStringList linelist;

QString filename2 = QFileDialog::getSaveFileName(this, tr("SaveBinary"), " ",tr("dat (*.dat "));
QFile file2(filename2);
 file2.open(QIODevice::WriteOnly);
 QDataStream out(&file2);   // we will serialize the data into the file

 	fileInfo.setFile(filename2);

	QString dirname = fileInfo.absoluteDir().absolutePath();
	filename = fileInfo.fileName();
	QString basename = fileInfo.baseName();
	QString bundlename = fileInfo.bundleName();

 if (file.open(QFile::ReadOnly)) {
        do {

    lineLength = file.readLine(buf, sizeof(buf));
    if (lineLength != -1) {
        QString line(buf);

        linelist = line.split(tr(" "));

        if (linelist.size() == 4)
        {
			
			double x = linelist.at(0).toDouble();
            double y = linelist.at(1).toDouble();
            double z = linelist.at(2).toDouble();
			double intensity= linelist.at(3).toDouble();
			if(x != 0 && y != 0 && z != 0 )
			{
			count++;
			shapecounter++;
				if(shapecounter == chunk)
					{
					
					shapecounter = 0;
					filecounter++;
					QString curfilename = dirname + tr("/") + basename + QString::number(filecounter) + tr(".data");
					file2.close();
					file2.setFileName(curfilename);
					file2.open(QFile::WriteOnly);
					
			
					}


			if (count % 100000 == 0) qDebug() << count;

			out << x << y << z << intensity;
			}

        }

   //if (count > 10000) break;


    }
        }while (lineLength != -1);
 }


if(file2.isOpen()) file2.close();






	}
开发者ID:jf---,项目名称:openshapefactory,代码行数:94,代码来源:beamtest.cpp

示例10: main

int main(int argc, char *argv[])
{
    Application app(argc, argv);
    QApplication::setOrganizationName(Common::ORG_NAME);
    QApplication::setOrganizationDomain(Common::ORG_DOMAIN);
    QApplication::setApplicationName(Common::APP_NAME);
    QApplication::setWindowIcon( QIcon(":/res/ico/anonymous.png") );
    QSettings settings;
    NetworkAccessManager::instance()->setCache(0);
    LocalServer localServer;
    //LocalServer::removeServer(Common::APP_NAME);
    bool serverStarted = localServer.listen(Common::APP_NAME);
    QStringList argList;
    QStringList urlList;
    bool fillingUrlList = false;

    for (int i = 0; i < argc; ++i)
    {
        QString arg(argv[i]);

        if ( arg.at(0) == LocalServer::PREFIX.at(0) )
        {
            argList << arg;

            if (fillingUrlList)
                fillingUrlList = false;
            else if (LocalServer::ARG_URLS == arg)
                fillingUrlList = true;
        }
        else if (fillingUrlList)
        {
            urlList << QUrl::fromUserInput(arg).toString();
        }
    }

    if ( !serverStarted && !argList.contains(LocalServer::ARG_MULTIPLE) )
    {
        if ( argList.contains(LocalServer::ARG_URLS) )
        {
            QLocalSocket socket;
            socket.connectToServer(Common::APP_NAME, QIODevice::WriteOnly);

            if ( !socket.waitForConnected() )
                return 1;

            QByteArray data;

            for (int i = 0; i < argc; ++i)
            {
                data.append(argv[i]).append('\0');
            }

            if ( -1 == socket.write(data) )
                return 2;

            if ( !socket.waitForBytesWritten() )
                return 3;

            socket.disconnectFromServer();
        }

        return 0;
    }

    qRegisterMetaType<ParceTask::Result>("ParceTask::Result");
    qRegisterMetaType<SaveTask::Result>("SaveTask::Result");
    qRegisterMetaType<SavePageTask::Result>("SavePageTask::Result");
    qRegisterMetaType<RmdirTask::Result>("RmdirTask::Result");
    qRegisterMetaType<ImageboardThread*>("ImageboardThread*");
    qRegisterMetaType<InfoWidget*>("InfoWidget*");
    qRegisterMetaType<QModelIndex>("QModelIndex");
    qRegisterMetaType<ImageboardThread::Modifiable>("ImageboardThread::Modifiable");
    QThreadPool::globalInstance()->setMaxThreadCount(10);
    ThreadManager threadManager(0);
    QObject::connect( &localServer,
             SIGNAL( addThreadSilent(ImageboardThread::Parameters, bool) ),
             &threadManager,
             SLOT( requestAddThread(ImageboardThread::Parameters, bool) ) );

    if ( argList.contains(LocalServer::ARG_DEFAULT) && !urlList.isEmpty() )
    {
        bool start = argList.contains(LocalServer::ARG_START);
        settings.beginGroup(ParametersDialog::GROUP_PARAMETERS);
          settings.beginGroup(ThreadManager::SUB_GROUP_DEFAULT);
            ImageboardThread::Parameters param =
                    ImageboardThread::readParameters(settings);
          settings.endGroup();
        settings.endGroup();

        for (int i = 0; i < urlList.count(); ++i)
        {
            param.url = urlList.at(i);
            param.added = QDateTime::currentDateTime();
            threadManager.requestAddThread(param, start);
        }
    }

    MainWindow *mainWindow = new MainWindow(threadManager.threadModel(),
                                            threadManager.categoryModel(), 0);
    QObject::connect(&app, SIGNAL( requestWriteSettings() ),
//.........这里部分代码省略.........
开发者ID:ololoepepe,项目名称:qutida,代码行数:101,代码来源:main.cpp

示例11: dump

void tst_qdeclarativeinstruction::dump()
{
    QDeclarativeCompiledData *data = new QDeclarativeCompiledData(0);
    {
        QDeclarativeInstruction i;
        i.line = 0;
        i.type = QDeclarativeInstruction::Init;
        i.init.bindingsSize = 0;
        i.init.parserStatusSize = 3;
        i.init.contextCache = -1;
        i.init.compiledBinding = -1;
        data->bytecode << i;
    }

    {
        QDeclarativeCompiledData::TypeReference ref;
        ref.className = "Test";
        data->types << ref;

        QDeclarativeInstruction i;
        i.line = 1;
        i.type = QDeclarativeInstruction::CreateObject;
        i.create.type = 0;
        i.create.data = -1;
        i.create.bindingBits = -1;
        i.create.column = 10;
        data->bytecode << i;
    }

    {
        data->primitives << "testId";

        QDeclarativeInstruction i;
        i.line = 2;
        i.type = QDeclarativeInstruction::SetId;
        i.setId.value = data->primitives.count() - 1;
        i.setId.index = 0;
        data->bytecode << i;
    }

    {
        QDeclarativeInstruction i;
        i.line = 3;
        i.type = QDeclarativeInstruction::SetDefault;
        data->bytecode << i;
    }

    {
        QDeclarativeInstruction i;
        i.line = 4;
        i.type = QDeclarativeInstruction::CreateComponent;
        i.createComponent.count = 3;
        i.createComponent.column = 4;
        i.createComponent.endLine = 14;
        i.createComponent.metaObject = 0;

        data->bytecode << i;
    }

    {
        QDeclarativeInstruction i;
        i.line = 5;
        i.type = QDeclarativeInstruction::StoreMetaObject;
        i.storeMeta.data = 3;
        i.storeMeta.aliasData = 6;
        i.storeMeta.propertyCache = 7;

        data->bytecode << i;
    }

    {
        QDeclarativeInstruction i;
        i.line = 6;
        i.type = QDeclarativeInstruction::StoreFloat;
        i.storeFloat.propertyIndex = 3;
        i.storeFloat.value = 11.3;
        data->bytecode << i;
    }

    {
        QDeclarativeInstruction i;
        i.line = 7;
        i.type = QDeclarativeInstruction::StoreDouble;
        i.storeDouble.propertyIndex = 4;
        i.storeDouble.value = 14.8;
        data->bytecode << i;
    }

    {
        QDeclarativeInstruction i;
        i.line = 8;
        i.type = QDeclarativeInstruction::StoreInteger;
        i.storeInteger.propertyIndex = 5;
        i.storeInteger.value = 9;
        data->bytecode << i;
    }

    {
        QDeclarativeInstruction i;
        i.line = 9;
//.........这里部分代码省略.........
开发者ID:xjohncz,项目名称:qt5,代码行数:101,代码来源:tst_qdeclarativeinstruction.cpp

示例12: dragStartInternal

int UIDnDHandler::dragStartInternal(const QStringList &lstFormats,
                                    Qt::DropAction defAction, Qt::DropActions actions)
{
    int rc = VINF_SUCCESS;

#ifdef VBOX_WITH_DRAG_AND_DROP_GH

    LogFlowFunc(("defAction=0x%x\n", defAction));
    LogFlowFunc(("Number of formats: %d\n", lstFormats.size()));
# ifdef DEBUG
    for (int i = 0; i < lstFormats.size(); i++)
        LogFlowFunc(("\tFormat %d: %s\n", i, lstFormats.at(i).toAscii().constData()));
# endif

# ifdef DEBUG_DND_QT
    QFile *pFileDebugQt = new QFile(DEBUG_DND_QT_LOGFILE);
    if (pFileDebugQt->open(QIODevice::WriteOnly | QIODevice::Append | QIODevice::Text))
    {
        g_pStrmLogQt = new QTextStream(pFileDebugQt);

        qInstallMsgHandler(UIDnDHandler::debugOutputQt);
        qDebug("========================================================================");
    }
# endif

# ifdef RT_OS_WINDOWS

    UIDnDDropSource *pDropSource = new UIDnDDropSource(m_pParent);
    if (!pDropSource)
        return VERR_NO_MEMORY;
    UIDnDDataObject *pDataObject = new UIDnDDataObject(this, lstFormats);
    if (!pDataObject)
        return VERR_NO_MEMORY;

    DWORD dwOKEffects = DROPEFFECT_NONE;
    if (actions)
    {
        if (actions & Qt::CopyAction)
            dwOKEffects |= DROPEFFECT_COPY;
        if (actions & Qt::MoveAction)
            dwOKEffects |= DROPEFFECT_MOVE;
        if (actions & Qt::LinkAction)
            dwOKEffects |= DROPEFFECT_LINK;
    }

    DWORD dwEffect;
    LogRel2(("DnD: Starting drag and drop operation\n", dwOKEffects));
    LogRel3(("DnD: DoDragDrop dwOKEffects=0x%x\n", dwOKEffects));
    HRESULT hr = ::DoDragDrop(pDataObject, pDropSource, dwOKEffects, &dwEffect);
    LogRel3(("DnD: DoDragDrop ended with hr=%Rhrc, dwEffect=%RI32\n", hr, dwEffect));

    if (pDropSource)
        pDropSource->Release();
    if (pDataObject)
        pDataObject->Release();

# else /* !RT_OS_WINDOWS */

    QDrag *pDrag = new QDrag(m_pParent);
    if (!pDrag)
        return VERR_NO_MEMORY;

    /* Note: pMData is transferred to the QDrag object, so no need for deletion. */
    m_pMIMEData = new UIDnDMIMEData(this, lstFormats, defAction, actions);
    if (!m_pMIMEData)
    {
        delete pDrag;
        return VERR_NO_MEMORY;
    }

    /* Inform the MIME data object of any changes in the current action. */
    connect(pDrag, SIGNAL(actionChanged(Qt::DropAction)),
            m_pMIMEData, SLOT(sltDropActionChanged(Qt::DropAction)));

    /* Invoke this handler as data needs to be retrieved by our derived QMimeData class. */
    connect(m_pMIMEData, SIGNAL(sigGetData(Qt::DropAction, const QString&, QVariant::Type, QVariant&)),
            this, SLOT(sltGetData(Qt::DropAction, const QString&, QVariant::Type, QVariant&)));

    /*
     * Set MIME data object and start the (modal) drag'n drop operation on the host.
     * This does not block Qt's event loop, however (on Windows it would).
     */
    pDrag->setMimeData(m_pMIMEData);
    LogFlowFunc(("Executing modal drag'n drop operation ...\n"));

    Qt::DropAction dropAction;
#  ifdef RT_OS_DARWIN
#    ifdef VBOX_WITH_DRAG_AND_DROP_PROMISES
        dropAction = pDrag->exec(actions, defAction, true /* fUsePromises */);
#    else
        /* Without having VBOX_WITH_DRAG_AND_DROP_PROMISES enabled drag and drop
         * will not work on OS X! It also requires some handcrafted patches within Qt
         * (which also needs VBOX_WITH_DRAG_AND_DROP_PROMISES set there). */
        dropAction = Qt::IgnoreAction;
        rc = VERR_NOT_SUPPORTED;
#    endif
#  else /* !RT_OS_DARWIN */
    dropAction = pDrag->exec(actions, defAction);
#  endif /* RT_OS_DARWIN */
    LogRel3(("DnD: Ended with dropAction=%ld\n", UIDnDHandler::toVBoxDnDAction(dropAction)));
//.........这里部分代码省略.........
开发者ID:rickysarraf,项目名称:virtualbox,代码行数:101,代码来源:UIDnDHandler.cpp

示例13: OnCreateChannel

/*!
 * \brief  功能概述 初始化通道参数
 * \param  参数描述 strChannelFileName_是通道文件绝对路径名,pDatabaseReturn是实时库指针
 * \return 返回值描述 成功返回true,失败返回false
 * \author zzy
 * \date   2015/5/27
 */
bool CProtocolBase::OnCreateChannel(const QString strChannelFileName_, CRTDBI *pDatabaseReturn)
{
    m_strChannelFileName = strChannelFileName_;
    CPRTI *pPRTI = m_pPRTMapI->FindChannelNumber(m_nChannelNumber);
    if (NULL != pPRTI)
    {
        pPRTI->SetDriverType(m_nPROTOCOL_TYPE);/// @note 设置驱动的类型 该驱动为转发驱动
    }
//    m_pPRTMapI->FindChannelNumber(m_nChannelNumber)->SetDriverType(m_nPROTOCOL_TYPE);/// @note 设置驱动的类型 该驱动为转发驱动
    m_pRTDB = pDatabaseReturn;/// @note 设置实时库指针

    QFile file(strChannelFileName_);
    QDomDocument ChannelDoc;
    if (!file.open(QFile::ReadOnly | QFile::Text))
    {
        return false;
    }
    QString errorStr;
    int errorLine;
    int errorColumn;
    if (!ChannelDoc.setContent(&file, false, &errorStr, &errorLine, &errorColumn))
    {
        qDebug()<<strChannelFileName_<<"XML File Error Message:"<<errorStr<<" Error Line:"<<errorLine<<" Error Column:"<<errorColumn;
        return false;
    }
    file.close();

    QDomElement docElem = ChannelDoc.documentElement();
    if (docElem.childNodes().count() != 5)///<zzy 2015/1/15 修改:
    {
        return false;
    }
    QDomElement Channel    = docElem.childNodes().at(0).toElement();
    QDomElement Top        = docElem.childNodes().at(1).toElement();
//    QDomElement Protocol   = docElem.childNodes().at(2).toElement();
    QDomElement MainPort   = docElem.childNodes().at(3).toElement();
//    QDomElement DeviceList = docElem.childNodes().at(4).toElement();
    QString strZTChannelNumber = Top.attribute("ZTChannelNumber");
    if (strZTChannelNumber.isEmpty())
    {
        m_nZTChannelNumber = -1;
    }else
    {
        m_nZTChannelNumber = strZTChannelNumber.toInt();/// @note 组态时设置的通道号
    }

    QStringList strListZTDeliversChannelNumberList = Top.attribute("NotifyNumber").split(",", QString::SkipEmptyParts);
    for (int i = 0; i < strListZTDeliversChannelNumberList.count(); ++i)
    {
        qDebug()<<m_nChannelNumber<<strListZTDeliversChannelNumberList.at(i).toInt()<<"===================";
        m_ZTDeliversChannelNumberList.push_back(strListZTDeliversChannelNumberList.at(i).toInt());
    }
    QString strChannelFileName2 = strChannelFileName_;

    /// @note 是否保存报文部分的处理
    if (Top.attribute("SaveFrame") == "True")
    {
        m_IsSaveFrame = true;
        QDir dir(strChannelFileName2);
        QString strFileName = dir.dirName();
        strFileName = strFileName.remove(".xml").append(".log");

        m_FileLog.setFileName(strFileName);
        if (!m_FileLog.open(QIODevice::ReadWrite|QIODevice::Text|QIODevice::Append))
        {
            qDebug()<<"未生成文件"<<strFileName;
        }else
        {
            qDebug()<<"生成文件了"<<strFileName;

        }
    }else
    {
        m_IsSaveFrame = false;
    }///是否保存报文部分的处理 end

//    InitPoint(DeviceList);
    QString strChannelName = tr("__")+Channel.attribute("Name").append("__");


    if (SetInitLink(Top,MainPort))
    {
        qDebug()<<"CLink Open succeed."<<m_pLink->GetLinkType()<<strChannelName;
    }else
    {
        qDebug()<<"CLink Open failed."<<m_pLink->GetLinkType()<<strChannelName;
    }
//#if defined(Q_PROCESSOR_ARM)
    m_pFrameSharedMemory = new CFrameSharedMemory(strChannelName,1024*30,this);
    m_bCreateStatusFrameSharedMemory = m_pFrameSharedMemory->CreateSharedMemory();
//#elif defined(Q_PROCESSOR_X86)

//#endif
//.........这里部分代码省略.........
开发者ID:Strongc,项目名称:20160125CGI_Src,代码行数:101,代码来源:cprotocolbase.cpp

示例14: main

int main(int argc, char *argv[]) {
    int i_file, i_v, i_curve;
    int i_plot;
    QString fullPath;

    KAboutData aboutData("kst", I18N_NOOP("Kst"),
                         KSTVERSION, description, KAboutData::License_GPL,
                         I18N_NOOP("(c) 2000-2007 Barth Netterfield"),
                         0,
                         "http://kst.kde.org/");
    aboutData.addAuthor("Barth Netterfield",
                        I18N_NOOP("Original author and maintainer."),
                        "[email protected]",
                        "http://omega.astro.utoronto.ca/");
    aboutData.addAuthor("Staikos Computing Services Inc.",
                        I18N_NOOP("Developed for the University of Toronto."),
                        "[email protected]",
                        "http://www.staikos.net/");
    aboutData.addAuthor("Sumus Technology Limited",
                        I18N_NOOP("Developed for the University of British Columbia"),
                        "[email protected]",
                        "http://www.sumusltd.com/");
    aboutData.addAuthor("Rick Chern",
                        I18N_NOOP("University of British Columbia"),
                        "",
                        "");
    aboutData.addAuthor("Duncan Hanson",
                        I18N_NOOP("University of British Columbia"),
                        "",
                        "");
    aboutData.addAuthor("Nicolas Brisset",
                        "",
                        "",
                        "");
    aboutData.addAuthor("Matthew Truch",
                        "",
                        "http://matt.truch.net/",
                        "[email protected]");
    aboutData.addAuthor("Theodore Kisner",
                        "",
                        "[email protected]",
                        "");
    aboutData.setTranslator(I18N_NOOP("_: NAME OF TRANSLATORS\nYour names"),
                            I18N_NOOP("_: EMAIL OF TRANSLATORS\nYour emails"));

    KCmdLineArgs::init( argc, argv, &aboutData );
    KCmdLineArgs::addCmdLineOptions( options ); // Add our own options.

    KApplication app;
    KImageIO::registerFormats();

    KstDialogs::replaceSelf(new KstGuiDialogs);
    KstData::replaceSelf(new KstGuiData);
    KstApp::initialize();

    atexit(exitHelper);

    if (app.isRestored()) {
        RESTORE(KstApp)
    } else {
        KstApp *kst = new KstApp;
        InType in;
        QColor color;
        QCStringList ycolList;
        QCStringList matrixList;
        QCStringList yEqList;
        QCStringList psdList;
        QCStringList hsList;
        QCStringList errorList;
        unsigned int i_ycol;
        QCStringList::Iterator hs_string;
        QCStringList::Iterator eq_i;
        QCStringList::Iterator mat_i;
        bool showQuickStart = false;
        bool showDataWizard = false;
        bool nOK;
        int n_y = 0;
        KCmdLineArgs *args = KCmdLineArgs::parsedArgs();

        CheckForCMDErrors(args);

        QString wizardfile = args->getOption("w");
        QString printfile = args->getOption("print");
        QString pngfile = args->getOption("png");
        bool print_and_exit = false;

        if (printfile != "<none>") {
            print_and_exit = true;
        }
        if (pngfile != "<none>") {
            print_and_exit = true;
        }

        if (!print_and_exit) {
            app.setMainWidget(kst);
            QRect rect = KGlobalSettings::desktopGeometry(kst);
            kst->resize(5 * rect.width() / 6, 5 * rect.height() / 6);
            kst->show();
        }

//.........这里部分代码省略.........
开发者ID:Kst-plot,项目名称:kst-subversion-archive,代码行数:101,代码来源:main.cpp

示例15: writebinary

void beamtest::writebinary()
	{

QString filename = QFileDialog::getOpenFileName ( this,tr("Import File"),
												 "",tr( "All point cloud formats (*.ptx);;"
												 "XYZ (*.xyz *XYZ);;"
												 "PTX (*.ptx *.PTX)"));

double chunksize= 5000000;
int count =0;
int debugcount = 0;
char buf[1024];
QFile file(filename);
qint64 lineLength=0;
QStringList linelist;

QString filename2 = QFileDialog::getSaveFileName(this, tr("SaveBinary"), " ",tr("dat (*.dat "));
QFile file2(filename2);
 file2.open(QIODevice::WriteOnly);
 QDataStream out(&file2);   // we will serialize the data into the file


 if (file.open(QFile::ReadOnly)) {
        do {

    lineLength = file.readLine(buf, sizeof(buf));
    if (lineLength != -1) {
        QString line(buf);

        linelist = line.split(tr(" "));

        if (linelist.size() == 4)
        {
			
			double x = linelist.at(0).toDouble();
            double y = linelist.at(1).toDouble();
            double z = linelist.at(2).toDouble();
			if(x != 0 && y != 0 && z != 0 )
			{
			count++;

			if (count % 100000 == 0) qDebug() << count;

			out << x << y << z;
			}

        }

   //if (count > 10000) break;


    }
        }while (lineLength != -1);
 }



file2.close();






	}
开发者ID:jf---,项目名称:openshapefactory,代码行数:65,代码来源:beamtest.cpp


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