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


C++ QVector::length方法代码示例

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


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

示例1: doUploadArtworks

    void ArtworkUploader::doUploadArtworks(const QVector<ArtworkMetadata *> &artworkList) {
        int artworksCount = artworkList.length();
        if (artworksCount == 0) {
            return;
        }

        UploadInfoRepository *uploadInfoRepository = m_CommandManager->getUploadInfoRepository();
        const QVector<Models::UploadInfo *> &infos = uploadInfoRepository->getUploadInfos();
        const Encryption::SecretsManager *secretsManager = m_CommandManager->getSecretsManager();
        const Models::SettingsModel *settingsModel = m_CommandManager->getSettingsModel();

        uploadInfoRepository->resetPercents();
        uploadInfoRepository->updatePercentages();
        m_UploadCoordinator->uploadArtworks(artworkList, infos, m_IncludeVector, secretsManager, settingsModel);

        m_CommandManager->reportUserAction(Conectivity::UserActionUpload);
    }
开发者ID:snikolau,项目名称:xpiks,代码行数:17,代码来源:artworkuploader.cpp

示例2: rescale

void FrameNumberVisualizator::rescale(){
    EulerDataSeries * buffer= static_cast<EulerDataSeries *>( curve->data() );
    if(buffer==NULL||buffer==0)
        return;

    QVector<double> values = buffer->getData();
    if(values.isEmpty())
        return;

    double max = 0;
    for(int i=0;i<values.length();i++){

        if(values[i]>max)
            max=values[i];
    }
    plot->setAxisScale(QwtPlot::yLeft,max - 500 ,max + 500);

}
开发者ID:jplingrand,项目名称:wimu,代码行数:18,代码来源:framenumbervisualizator.cpp

示例3: submitItems

    void WarningsService::submitItems(const QVector<Models::ArtworkMetadata *> &items) {
        if (m_WarningsWorker == NULL) {
            return;
        }

        int length = items.length();

        std::vector<std::shared_ptr<WarningsItem> > itemsToSubmit;
        itemsToSubmit.reserve(length);

        for (int i = 0; i < length; ++i) {
            Models::ArtworkMetadata *item = items.at(i);
            itemsToSubmit.emplace_back(new WarningsItem(item));
        }

        LOG_INFO << "Submitting" << length << "item(s)";
        m_WarningsWorker->submitItems(itemsToSubmit);
    }
开发者ID:Artiom-M,项目名称:xpiks,代码行数:18,代码来源:warningsservice.cpp

示例4: TurningWeight

void Neuron::TurningWeight(float time, QVector<float> data)
{
	if(this->weight.length() != data.length())
		return;	

	float var1 = -1 * time / Param_1;
	float result1 = LearningRate * expf(var1);

	float var2 = -1 * time / Param_2;
	float result2 = NeighborDis * expf(var2);
	
	GaussianValue = expf((-1.0) * (DisWithWinner * DisWithWinner) / 2.0 * (result2 * result2));
	
	for(int i=0; i<this->weight.length(); i++)
	{
		float var3 = data[i] - weight[i];
		weight[i] += result1 * GaussianValue * var3;
	}
}
开发者ID:yuxiang2025,项目名称:NN,代码行数:19,代码来源:Neuron.cpp

示例5: addButtons

void MainWindow::addButtons(QVector<QPushButton *> buttonList, QScrollArea *symbolScrollArea, QString labelText)
{
    iter = 0;
    row++, column = 0;

    symbolLabel = new QLabel(this);
    QString HTMLtext = "<b>" + labelText + "</b>";
    symbolLabel->setText(HTMLtext);
    symbolLayout->addWidget(symbolLabel, row, column);

    row++, column = -1;

    foreach(symbolButton, buttonList)
    {
        if(column == 5)
        {
            column = 0;
            row++;
        }
        else
            column++;

        symbolButton->setStyleSheet("background-color : rgba(50,50,50,100%);"
                                    "color: white;"
                                    "border-style: solid;"
                                    "border-width: 2px;"
                                    "border-color: rgba(255,255,255,90%);");

        symbolButton->setMinimumHeight(symbolScrollArea->height() / 5);

        symbolLayout->addWidget(symbolButton, row, column);

        connect(symbolButton, SIGNAL(clicked()), this, SLOT(onNotationClicked()));

        iter++;
        if(iter == buttonList.length())
        {
            row++;
            column = -1;
        }
    }
}
开发者ID:DannyGotTea,项目名称:MechanicsTextEditor,代码行数:42,代码来源:mainwindow.cpp

示例6: writeMetadata

    void MetadataIOCoordinator::writeMetadata(const QVector<Models::ArtworkMetadata *> &artworksToWrite, bool useBackups) {
        m_WritingWorker = new MetadataWritingWorker(artworksToWrite,
                                                    m_CommandManager->getSettingsModel(),
                                                    useBackups);
        QThread *thread = new QThread();
        m_WritingWorker->moveToThread(thread);

        QObject::connect(thread, SIGNAL(started()), m_WritingWorker, SLOT(process()));
        QObject::connect(m_WritingWorker, SIGNAL(stopped()), thread, SLOT(quit()));

        QObject::connect(m_WritingWorker, SIGNAL(stopped()), m_WritingWorker, SLOT(deleteLater()));
        QObject::connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater()));

        QObject::connect(m_WritingWorker, SIGNAL(finished(bool)), this, SLOT(writingWorkerFinished(bool)));
        QObject::connect(this, SIGNAL(metadataWritingFinished()), m_WritingWorker, SIGNAL(stopped()));
        setProcessingItemsCount(artworksToWrite.length());

        qDebug() << "Starting metadata writing thread";
        thread->start();
    }
开发者ID:snikolau,项目名称:xpiks,代码行数:20,代码来源:metadataiocoordinator.cpp

示例7: setBlendedVertices

void MetaModelPayload::setBlendedVertices(int blendNumber, const QVector<BlendshapeOffset>& blendshapeOffsets, const QVector<int>& blendedMeshSizes, const render::ItemIDs& subRenderItems) {
    PROFILE_RANGE(render, __FUNCTION__);
    if (blendNumber < _appliedBlendNumber) {
        return;
    }
    _appliedBlendNumber = blendNumber;

    // We have fewer meshes than before.  Invalidate everything
    if (blendedMeshSizes.length() < (int)_blendshapeBuffers.size()) {
        _blendshapeBuffers.clear();
    }

    int index = 0;
    for (int i = 0; i < blendedMeshSizes.size(); i++) {
        int numVertices = blendedMeshSizes.at(i);

        // This mesh isn't blendshaped
        if (numVertices == 0) {
            _blendshapeBuffers.erase(i);
            continue;
        }

        const auto& buffer = _blendshapeBuffers.find(i);
        const auto blendShapeBufferSize = numVertices * sizeof(BlendshapeOffset);
        if (buffer == _blendshapeBuffers.end()) {
            _blendshapeBuffers[i] = std::make_shared<gpu::Buffer>(blendShapeBufferSize, (gpu::Byte*) blendshapeOffsets.constData() + index * sizeof(BlendshapeOffset), blendShapeBufferSize);
        } else {
            buffer->second->setData(blendShapeBufferSize, (gpu::Byte*) blendshapeOffsets.constData() + index * sizeof(BlendshapeOffset));
        }

        index += numVertices;
    }

    render::Transaction transaction;
    for (auto& id : subRenderItems) {
        transaction.updateItem<ModelMeshPartPayload>(id, [this, blendedMeshSizes](ModelMeshPartPayload& data) {
            data.setBlendshapeBuffer(_blendshapeBuffers, blendedMeshSizes);
        });
    }
    AbstractViewStateInterface::instance()->getMain3DScene()->enqueueTransaction(transaction);
}
开发者ID:AndrewMeadows,项目名称:hifi,代码行数:41,代码来源:MetaModelPayload.cpp

示例8: cleanupEmptyDirectories

    void ArtworksRepository::cleanupEmptyDirectories() {
        LOG_DEBUG << "#";
        int count = m_DirectoriesList.length();
        QVector<int> indicesToRemove;
        indicesToRemove.reserve(count);

        for (int i = 0; i < count; ++i) {
            const QString &directory = m_DirectoriesList[i];
            if (m_DirectoriesHash[directory] == 0) {
                indicesToRemove.append(i);
            }
        }

        if (!indicesToRemove.isEmpty()) {
            LOG_INFO << indicesToRemove.length() << "empty directory(ies)...";

            QVector<QPair<int, int> > rangesToRemove;
            Helpers::indicesToRanges(indicesToRemove, rangesToRemove);
            removeItemsAtIndices(rangesToRemove);
        }
    }
开发者ID:RostaTasha,项目名称:xpiks,代码行数:21,代码来源:artworksrepository.cpp

示例9: submitItems

    void SpellCheckerService::submitItems(const QVector<ISpellCheckable *> &itemsToCheck) {
        if (!m_WorkerIsAlive) { return; }

        if (m_SpellCheckWorker != NULL && !m_SpellCheckWorker->isCancelled()) {
            QVector<SpellCheckItemBase *> items;
            int length = itemsToCheck.length();

            items.reserve(length);

            for (int i = 0; i < length; ++i) {
                SpellCheck::ISpellCheckable *itemToCheck = itemsToCheck.at(i);
                SpellCheckItem *item = new SpellCheckItem(itemToCheck, Common::SpellCheckAll);
                itemToCheck->connectSignals(item);
                items.append(item);
            }

            qInfo() << "SpellCheck service: about to submit" << length << "items";

            m_SpellCheckWorker->submitItems(items);
            m_SpellCheckWorker->submitItem(new SpellCheckSeparatorItem());
        }
    }
开发者ID:snikolau,项目名称:xpiks,代码行数:22,代码来源:spellcheckerservice.cpp

示例10: i

// horizontalPoints is an auxiliar method for the button position computation.
// starts from a known center and keeps adding elements horizontally
// and returns the computed positions.
QVector<QPoint> ButtonHandler::horizontalPoints(
        const QPoint &center, const int elements, const bool leftToRight) const
{
    QVector<QPoint> res;
    // Distance from the center to start adding buttons
    int shift = 0;
    if (elements % 2 == 0) {
        shift = m_buttonExtendedSize * (elements / 2) - (m_separator / 2);
    } else {
        shift = m_buttonExtendedSize * ((elements-1) / 2) + m_buttonBaseSize / 2;
    }
    if (!leftToRight) { shift -= m_buttonBaseSize; }
    int x = leftToRight ? center.x() - shift :
                          center.x() + shift;
    QPoint i(x, center.y());
    while (elements > res.length()) {
        res.append(i);
        leftToRight ? i.setX(i.x() + m_buttonExtendedSize) :
                      i.setX(i.x() - m_buttonExtendedSize);
    }
    return res;
}
开发者ID:Jocix123,项目名称:flameshot,代码行数:25,代码来源:buttonhandler.cpp

示例11: exportActorColors

void CSV::exportActorColors(QString path, QVector<int> actorIds, QVector<QString> colorCode)
{
    QFile f(path);

    if (f.open(QFile::WriteOnly | QFile::Truncate))
    {
        QTextStream data( &f );
        QStringList strList;

        //appending data
        for (int row=0; row < actorIds.length(); row++)
        {
            strList.clear();

            strList << QString::number(actorIds.at(row));
            strList << colorCode.at(row);
            data << strList.join(",") + "\n";
//            qDebug() << strList;
        }
        f.close();
    }
}
开发者ID:ambah,项目名称:KTAB,代码行数:22,代码来源:csv.cpp

示例12: on_btnRemove_clicked

void MainWindow::on_btnRemove_clicked()
{
    QModelIndexList selected = ui->listView->selectionModel()->selectedIndexes();
    if (!selected.isEmpty())
    {
        QString str = list.at(selected.first().row());

        QVector<QString> vRemove = readFile(str);

        for(int i = 0; i < vGlobal.length(); i++)
            for(int k = 0; k < vRemove.length(); k++)
            {
                if(vGlobal.at(i) == vRemove.at(k))
                {
                    vGlobal.removeAt(i);
                    showDataInTableView(tvModel, vGlobal);
                    ui->tableView->setModel(tvModel);
                }
            }

        QStandardItemModel *tModel = new QStandardItemModel(0,0,this);
        tModel->setHorizontalHeaderItem(0, new QStandardItem(QString("Site A")));
        tModel->setHorizontalHeaderItem(1, new QStandardItem(QString("Site B")));

        showDataInTableView(tModel, vGlobal);
        ui->tableView->setModel(tModel);

        list.removeAt(selected.first().row());
        ((QStringListModel*) ui->listView->model())->setStringList(list);

        vRemove.clear();

        if(list.isEmpty())
            ui->btnRemove->setEnabled(false);

        ui->btnStart->setEnabled(false);
    }
}
开发者ID:szledak,项目名称:EasyLearning,代码行数:38,代码来源:mainwindow.cpp

示例13: createLine

void WireCreator::createLine()
{
    QVector<int> usedPoints;
    int currPoint=deadEnds[0];
    //currPath.push_back(vertices[currPoint]);
    usedPoints.push_back(currPoint);
    //while(currPoint!=deadEnds.last()){
    while(deadEnds.indexOf(currPoint)==-1||usedPoints.length()==1){

        for(auto p: edges){
            if(p.first==currPoint){
                currPoint=p.second;
                break;
            }
        }
      //currPath.push_back(vertices[currPoint]);
      usedPoints.push_back(currPoint);
    }
    //usedPoints.pop_back();
    qDebug()<<containsAllE(usedPoints);
    //modifiedPath=currPath;
    //qDebug()<<currPath;
    rawPath=usedPoints;
}
开发者ID:akuchinke,项目名称:wire_bender,代码行数:24,代码来源:wirecreator.cpp

示例14: on_btnSelectDB_clicked

void MainWindow::on_btnSelectDB_clicked()
{


    model = new QStringListModel(this);

    QString fileName = getFileName();
    QVector<QString> vRead = readFile(fileName);

    for(int i = 0; i < vRead.length(); i++)
        vGlobal.append(vRead.at(i));


    vRead.clear();

    showDataInTableView(tvModel, vGlobal);

    setListViewElements(fileName);


    ui->tableView->setModel(tvModel);
    model->setStringList(list);
    ui->listView->setModel(model);
}
开发者ID:szledak,项目名称:EasyLearning,代码行数:24,代码来源:mainwindow.cpp

示例15: makeCGData

bool CGDReader::makeCGData(QVector<QVector<double> > p3r, QVector<QVector<int> > ftr, CGData* cgd) {
    cgd->pointAmount = p3r.length() - 1;
    cgd->surfaceAmount = ftr.length() - 1;
    cgd->verticesData = new CGPoint[p3r.length() - 1];
    for(int i = 1; i < p3r.length(); i ++) {
        cgd->verticesData[i - 1].x = p3r[i][1];
        cgd->verticesData[i - 1].y = p3r[i][2];
        cgd->verticesData[i - 1].z = p3r[i][3];
        cgd->verticesData[i - 1].rear = p3r[i][4];
    }

    cgd->surfacesData = new CGFace[ftr.length() - 1];
    for(int i = 1; i < ftr.length(); i ++) {
        cgd->surfacesData[i - 1].vertexAmount = ftr[i][0];
        cgd->surfacesData[i - 1].vertices = new int[ftr[i].length()];
        for(int j = 1; j <= ftr[i][0]; j ++) {
            cgd->surfacesData[i - 1].vertices[j - 1] = ftr[i][j];
        }
    }
    return true;
}
开发者ID:zdwchang,项目名称:CGD-Reader,代码行数:21,代码来源:cgdreader.cpp


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