本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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;
}
}
示例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;
}
}
}
示例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();
}
示例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);
}
示例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);
}
}
示例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());
}
}
示例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 ¢er, 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;
}
示例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();
}
}
示例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);
}
}
示例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;
}
示例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);
}
示例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;
}