Beispiel #1
0
void Hdd::configAccepted()
{
    KConfigGroup cg = config();
    KConfigGroup cgGlobal = globalConfig();
    QStandardItem *parentItem = m_hddModel.invisibleRootItem();

    clear();

    for (int i = 0; i < parentItem->rowCount(); ++i) {
        QStandardItem *item = parentItem->child(i, 0);
        if (item) {
            QStandardItem *child = parentItem->child(i, 1);
            if (child->text() != child->data().toString()) {
                cgGlobal.writeEntry(item->data().toString(), child->text());
            }
            if (item->checkState() == Qt::Checked) {
                appendSource(item->data().toString());
            }
        }
    }
    cg.writeEntry("uuids", sources());

    uint interval = ui.intervalSpinBox->value();
    cg.writeEntry("interval", interval);

    emit configNeedsSaving();
}
void ReportGenerationDialog::on_screenshotListView_doubleClicked(const QModelIndex &index)
{
    QStandardItem *item = screenshotModel.item(ui->screenshotListView->currentIndex().row());
    selectedScreenshotModel.appendRow(new QStandardItem(item->icon(), item->text()));
    processScreenshotAnalysis(item->text());
    screenshotModel.removeRow(ui->screenshotListView->currentIndex().row());
}
Beispiel #3
0
void HPSKnotDirModel::setTreeView(bool isTreeView,QStandardItem *item)
{
    qDebug() << Q_FUNC_INFO << isTreeView <<item->text();
    QStandardItem *tmpItem;
    if( isTreeView){
        const int count = item->rowCount();
        for ( int i = 0 ; i < count ; ++i){
            delete item->takeRow(0).first();
        }
        qDebug() << item->rowCount();
        const int size = mTmpRoot->rowCount();
        for(  int i = 0 ;  i < size ; ++i ) {
            tmpItem = mTmpRoot->takeRow(0).first();
            qDebug() << tmpItem->text();
            item->appendRow(tmpItem);
        }
        mRoot->item = item;
    }else{
        const int size = item->rowCount();
        for(  int i = 0 ;  i < size ; ++i ) {
            tmpItem = item->takeRow(0).first();
            qDebug() << tmpItem->text();
            mTmpRoot->appendRow(tmpItem);
        }
        mRoot->item = mTmpRoot;
        makeListView(mRoot,item);
    }
}
void ConfigurationContentsWidget::optionChanged(const QString &option, const QVariant &value)
{
	for (int i = 0; i < m_model->rowCount(); ++i)
	{
		QStandardItem *groupItem = m_model->item(i, 0);

		if (!groupItem || !QString(option).startsWith(groupItem->text()))
		{
			continue;
		}

		for (int j = 0; j < groupItem->rowCount(); ++j)
		{
			QStandardItem *optionItem = groupItem->child(j, 0);

			if (optionItem && option == QStringLiteral("%1/%2").arg(groupItem->text()).arg(optionItem->text()))
			{
				QFont font = optionItem->font();
				font.setBold(value != SettingsManager::getDefaultValue(option));

				optionItem->setFont(font);

				groupItem->child(j, 2)->setText(value.toString());

				break;
			}
		}
	}
}
void HistoryContentsWidget::removeDomainEntries()
{
	QStandardItem *domainItem = findEntry(getEntry(m_ui->historyView->currentIndex()));

	if (!domainItem)
	{
		return;
	}

	const QString host = QUrl(domainItem->text()).host();
	QList<qint64> entries;

	for (int i = 0; i < m_model->rowCount(); ++i)
	{
		QStandardItem *groupItem = m_model->item(i, 0);

		if (!groupItem)
		{
			continue;
		}

		for (int j = (groupItem->rowCount() - 1); j >= 0; --j)
		{
			QStandardItem *entryItem = groupItem->child(j, 0);

			if (entryItem && host == QUrl(entryItem->text()).host())
			{
				entries.append(entryItem->data(Qt::UserRole).toLongLong());
			}
		}
	}

	HistoryManager::removeEntries(entries);
}
Beispiel #6
0
void tst_QStandardItem::clone()
{
    QStandardItem item;
    item.setText(QLatin1String("text"));
    item.setToolTip(QLatin1String("toolTip"));
    item.setStatusTip(QLatin1String("statusTip"));
    item.setWhatsThis(QLatin1String("whatsThis"));
    item.setSizeHint(QSize(64, 48));
    item.setFont(QFont());
    item.setTextAlignment(Qt::AlignLeft|Qt::AlignVCenter);
    item.setBackground(QColor(Qt::blue));
    item.setForeground(QColor(Qt::green));
    item.setCheckState(Qt::PartiallyChecked);
    item.setAccessibleText(QLatin1String("accessibleText"));
    item.setAccessibleDescription(QLatin1String("accessibleDescription"));
    item.setFlags(Qt::ItemIsEnabled | Qt::ItemIsDropEnabled);

    QStandardItem *clone = item.clone();
    QCOMPARE(clone->text(), item.text());
    QCOMPARE(clone->toolTip(), item.toolTip());
    QCOMPARE(clone->statusTip(), item.statusTip());
    QCOMPARE(clone->whatsThis(), item.whatsThis());
    QCOMPARE(clone->sizeHint(), item.sizeHint());
    QCOMPARE(clone->font(), item.font());
    QCOMPARE(clone->textAlignment(), item.textAlignment());
    QCOMPARE(clone->background(), item.background());
    QCOMPARE(clone->foreground(), item.foreground());
    QCOMPARE(clone->checkState(), item.checkState());
    QCOMPARE(clone->accessibleText(), item.accessibleText());
    QCOMPARE(clone->accessibleDescription(), item.accessibleDescription());
    QCOMPARE(clone->flags(), item.flags());
    QVERIFY(!(*clone < item));
    delete clone;
}
void NBioBSP_IndexSearch::on_btRmDB_pressed()
{
    QModelIndexList selectedRows = ui->tableReg->selectionModel()->selectedRows();
    NBioAPI_INDEXSEARCH_FP_INFO infoFP;
    QStandardItem* pItem;
    NBioAPI_RETURN nRet = NBioAPIERROR_NONE;

    for (int i = selectedRows.size() - 1; i >= 0; i--)  {
        pItem = pRegModel->item(selectedRows[i].row(), 0);
        infoFP.ID = pItem->text().toUInt();
        pItem = pRegModel->item(selectedRows[i].row(), 1);
        infoFP.FingerID = (NBioAPI_UINT8) pItem->text().toUShort();
        pItem = pRegModel->item(selectedRows[i].row(), 2);
        infoFP.SampleNumber = (NBioAPI_UINT8) pItem->text().toUShort();

        nRet = NBioAPI_RemoveDataFromIndexSearchDB(m_hNBioBSP, &infoFP);

        if (NBioAPIERROR_NONE == nRet)
            pRegModel->removeRow(selectedRows[i].row(), QModelIndex());
        else  {
            QString szError;

            szError.sprintf("NBioAPI_RemoveDataFromIndexSearchDB error: %04X", nRet);
            ui->labelStatus->setText(szError);
            break;
        }
    }

    if (NBioAPIERROR_NONE == nRet)
        ui->labelStatus->setText(QString("Remove data from DB [Count: %1]").arg(selectedRows.size()));

    UpdateTotalCount();
}
Beispiel #8
0
void KDEProjectsReaderTest::testsProperParse()
{
    KDEProjectsModel m;
    KDEProjectsReader reader(&m, 0);

    if(reader.hasErrors())
        qDebug() << "errors:" << reader.errors();

    QVERIFY(!reader.hasErrors());

    WAIT_FOR_SIGNAL(&reader,downloadDone());

    for(int i=0; i<m.rowCount(); i++) {
        QStandardItem* item = m.item(i,0);
        qDebug() << ":::::" << item->text() << item->icon() << item->data(KDEProjectsModel::VcsLocationRole);

        QVERIFY(item);
        QVERIFY(!item->text().isEmpty());

        QVariant urls = item->data(KDEProjectsModel::VcsLocationRole);
        QVERIFY(urls.isValid());
        QVERIFY(urls.canConvert(QVariant::Map));
        QVariantMap mapurls=urls.toMap();
        for(QVariantMap::const_iterator it=mapurls.constBegin(), itEnd=mapurls.constEnd(); it!=itEnd; ++it) {
            QVERIFY(!it.key().isEmpty());
            QVERIFY(!it.value().toString().isEmpty());
        }

        QVERIFY(!item->data(KDEProjectsModel::VcsLocationRole).toMap().isEmpty());
    }
}
void VegetationWidget::getSelectedTypes(std::vector<std::string>& returnTypeList)
{
	returnTypeList.clear();
	QWidget* curWidget = _tabWidget->currentWidget();
	if (curWidget == _treeListView)
	{
		QStandardItemModel* model = qobject_cast<QStandardItemModel*>(_treeListView->model());
		for (int j = 0; j < model->rowCount(); ++j)
		{
			QStandardItem* item = model->item(j);
			if (item->checkState() == Qt::Checked)
			{
				returnTypeList.push_back(chineseTextToUTF8String(item->text()));
			}
		}
	}
	else
	{
		QStandardItemModel* model = qobject_cast<QStandardItemModel*>(_grassListView->model());
		for (int j = 0; j < model->rowCount(); ++j)
		{
			QStandardItem* item = model->item(j);
			if (item->checkState() == Qt::Checked)
			{
				returnTypeList.push_back(chineseTextToUTF8String(item->text()));
			}
		}
	}
}
void AbstractCameraManager::cameraTree_itemClicked(const QModelIndex & index, QString &string, int &icon, bool &editable, bool &deleteable) {
    QStandardItem* clicked = getModel()->itemFromIndex(index);
    selectedItem = clicked;
    QStandardItem* first = NULL;


    string = clicked->text();
    editable = true;
    deleteable = true;
    if( clicked->data(CameraRole).isValid() ) {
        icon = 0;
        deleteable = false;
        first = clicked;
    } else {
        if( clicked == &newCameraList ) {
            qDebug() << "clicked == newCameraList";
            editable = false;
            deleteable = false;
        }
        first = cameraTree_recursiveFirstCamera(clicked);
        if( first == NULL )
            icon = 1;
        else {
            icon = 2;
            string = clicked->text() + " <br /> ("+ first->text() + ")";
        }
    }
    selectedCamera = (first == NULL) ? NULL : reinterpret_cast<AbstractCamera *>( first->data(CameraRole).value<quintptr>() );
    updateProperties();
}
Beispiel #11
0
void QgsOSMExportDialog::onOK()
{
  if ( !openDatabase() )
    return;

  QgsOSMDatabase::ExportType type;
  if ( radPoints->isChecked() )
    type = QgsOSMDatabase::Point;
  else if ( radPolylines->isChecked() )
    type = QgsOSMDatabase::Polyline;
  else
    type = QgsOSMDatabase::Polygon;

  buttonBox->setEnabled( false );
  QApplication::setOverrideCursor( Qt::WaitCursor );

  QStringList tagKeys;
  QStringList notNullTagKeys;

  for ( int i = 0; i < mTagsModel->rowCount(); ++i )
  {
    QStandardItem* item = mTagsModel->item( i, 0 );
    if ( item->checkState() == Qt::Checked )
      tagKeys << item->text();

    QStandardItem* item2 = mTagsModel->item( i, 2 );
    if ( item2->checkState() == Qt::Checked )
      notNullTagKeys << item->text();
  }

  bool res = mDatabase->exportSpatiaLite( type, editLayerName->text(), tagKeys, notNullTagKeys );

  // load the layer into canvas if that was requested
  if ( chkLoadWhenFinished->isChecked() )
  {
    QgsDataSourceUri uri;
    uri.setDatabase( editDbFileName->text() );
    uri.setDataSource( QString(), editLayerName->text(), "geometry" );
    QgsVectorLayer* vlayer = new QgsVectorLayer( uri.uri(), editLayerName->text(), "spatialite" );
    if ( vlayer->isValid() )
      QgsMapLayerRegistry::instance()->addMapLayer( vlayer );
  }

  QApplication::restoreOverrideCursor();
  buttonBox->setEnabled( true );

  if ( res )
  {
    QMessageBox::information( this, tr( "OpenStreetMap export" ), tr( "Export has been successful." ) );
  }
  else
  {
    QMessageBox::critical( this, tr( "OpenStreetMap export" ), tr( "Failed to export OSM data:\n%1" ).arg( mDatabase->errorString() ) );
  }

  mDatabase->close();
}
void VegetationWidget::slotViewSelected()
{
	QListView* view = qobject_cast<QListView*>(sender());
	QItemSelectionModel* selectionModel = view->selectionModel();
	QModelIndexList	modelList = selectionModel->selectedIndexes();
	if (modelList.size() < 1)
		return;
	QStandardItemModel* model = qobject_cast<QStandardItemModel*>(view->model());
	std::string dirString("");
	if (view == _treeListView)
	{
		std::string plantDir = g_SystemContext._workContextDir;
		plantDir.append(CONTEXT_DIR);
		plantDir.append("/Plant/");
		dirString = plantDir + "Tree/";
	}
	else
	{
		std::string plantDir = g_SystemContext._workContextDir;
		plantDir.append(CONTEXT_DIR);
		plantDir.append("/Plant/");
		dirString = plantDir + "Grass/";
	}
	QStandardItem* currentItem = model->itemFromIndex(modelList.at(0));
	dirString.append(chineseTextToUTF8String(currentItem->text()));
	osg::ref_ptr<osg::Node> node;
	if (currentItem->text().endsWith(".osgb"))
	{
		node = g_SystemContext._resourceLoader->getNodeByName(dirString, false);
	}
	else
	{
		osg::ref_ptr<osg::Image> image = g_SystemContext._resourceLoader->getImageByFileName(dirString);
		if (image.valid())
		{
			float s = image->s();
			float t = image->t();
			osg::ref_ptr<osg::Geometry> geometry = osg::createTexturedQuadGeometry(osg::Vec3(-s / 2.0f, -t / 2.0f, 0), osg::Vec3(s, 0, 0), osg::Vec3(0, t, 0));
			osg::ref_ptr<osg::Geode> geode = new osg::Geode;
			geode->addDrawable(geometry);
			osg::StateSet* ss = geode->getOrCreateStateSet();
			ss->setMode(GL_BLEND, osg::StateAttribute::ON);
			ss->setRenderingHint(osg::StateSet::TRANSPARENT_BIN);
			osg::Texture2D* texture = new osg::Texture2D(image);
			ss->setTextureAttributeAndModes(0, texture, osg::StateAttribute::ON);
			node = geode;
		}
	}
	if (node.valid())
	{
		_nodeViewDialog = new NodeViewDialog;
		_nodeViewDialog->setNode(node);
		_nodeViewDialog->exec();
		//_nodeViewDialog->setNode(NULL);
	}
}
void MangaListWidget::goToRead(QModelIndex modelIndex) {
  QStandardItem* currentItem = _model->itemFromIndex(modelIndex);
  QStandardItem* currentItemParent = currentItem->parent();

  if (currentItemParent == nullptr)
    return;

  markRead();

  emit chapterSelected(currentItemParent->text(), currentItem->text());
}
bool CMakeCacheModel::writeBack(const KUrl & path) const
{
    kDebug(9042) << "writing CMakeCache.txt at " << path;
    QFile file(path.toLocalFile());
    if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
    {
        kDebug(9032) << "Could not open " << path << " the file for writing";
        return false;
    }

    KUrl dir(path);
    dir.upUrl();
    QTextStream out(&file);
    out << "# This is the CMakeCache file." << endl;
    out << "# For build in directory: " << dir.pathOrUrl() << endl;
    out << "# It was generated by cmake and edited by KDevelop 4" << endl;
    out << "# You can edit this file to change values found and used by cmake." << endl;
    out << "# If you do not want to change any of the values, simply exit the editor." << endl;
    out << "# If you do want to change a value, simply edit, save, and exit the editor." << endl;
    out << "# The syntax for the file is as follows:" << endl;
    out << "# KEY:TYPE=VALUE" << endl;
    out << "# KEY is the name of a variable in the cache." << endl;
    out << "# TYPE is a hint to GUI's for the type of VALUE, DO NOT EDIT TYPE!." << endl;
    out << "# VALUE is the current value for the KEY." << endl << endl;

    out << "########################" << endl;
    out << "# EXTERNAL cache entries" << endl;
    out << "########################" << endl << endl;
    for(int i=0; i<rowCount(); i++)
    {
        if(i==m_internalBegin)
        {
            out << endl;
            out << "########################" << endl;
            out << "# INTERNAL cache entries" << endl;
            out << "########################" << endl << endl;
        }
        
        QStandardItem* name = item(i, 0);
        QStandardItem* type = item(i, 1);
        QStandardItem* valu = item(i, 2);
        QStandardItem* comm = item(i, 3);
        if(!name || !type || !comm || !valu)
            continue;
        if(!comm->text().isEmpty())
        {
            QStringList comments=comm->text().split('\n');
            foreach(const QString& commLine, comments)
            {
                out << "//";
                out << commLine;
                out << endl;
            }
        }
Beispiel #15
0
void TableFormWidget::updateWidgetFromData()
{
    QVector<DBAttribute> &attributes = table->getAttributes();

    if(model->rowCount()>attributes.size())
    {
        while(model->rowCount()!=attributes.size())
        {
            model->removeRow(model->rowCount()-1);
        }
    }

    for(int i=0;i<attributes.size();i++)
    {
        DBAttribute &attribute = attributes[i];

        QStandardItem *itemName = new QStandardItem(attribute.name);
        QStandardItem *itemType = new QStandardItem(attribute.type);
        QStandardItem *itemPK = new QStandardItem(attribute.PK);
        QStandardItem *itemNN = new QStandardItem(attribute.NN);
        QStandardItem *itemU = new QStandardItem(attribute.UNIQ);

        //model->setRowCount(0);

        model->setItem(i,0,itemName);
        model->setItem(i,1,itemType);
        if(itemPK->text().toInt()==1)
        {
            model->setData(model->index(i,2,QModelIndex()),2,Qt::CheckStateRole);
        }
        else
        {
            model->setData(model->index(i,2,QModelIndex()),0,Qt::CheckStateRole );
        }
        if(itemNN->text().toInt()==1)
        {
            model->setData(model->index(i,3,QModelIndex()),2,Qt::CheckStateRole);
        }
        else
        {
            model->setData(model->index(i,3,QModelIndex()),0,Qt::CheckStateRole );
        }
        if(itemU->text().toInt()==1)
        {
            model->setData(model->index(i,4,QModelIndex()),2,Qt::CheckStateRole);
        }
        else
        {
            model->setData(model->index(i,4,QModelIndex()),0,Qt::CheckStateRole );
        }
    }
}
Beispiel #16
0
	void ConsoleTableView::keyReleaseEvent(QKeyEvent *event)
	{
		if(event->matches(QKeySequence::Copy))
		{
			QStandardItemModel *standardItemModel = qobject_cast<QStandardItemModel *>(model());
			if(standardItemModel)
			{
				QStandardItem *item = standardItemModel->item(currentIndex().row(), 0);
				if(item && !item->text().isEmpty())
					QApplication::clipboard()->setText(item->text());
			}
		}
	}
void SortedSetKeyModel::updateValue(const QString& value, const QModelIndex *cellIndex)
{
    QStandardItem * currentItem = itemFromIndex(*cellIndex);    

    QString itemType = currentItem->data(KeyModel::KEY_VALUE_TYPE_ROLE).toString();

    if (itemType == "member") 
    {
        QStringList removeCmd;
        removeCmd << "ZREM"
            << keyName
            << currentItem->text();        

        db->addCommand(Command(removeCmd, this, dbIndex));

        QStandardItem * scoreItem = item(currentItem->row(), 1);

        QStringList addCmd;

        addCmd << "ZADD"
            << keyName
            << scoreItem->text()
            << value;

        db->addCommand(Command(addCmd, this, CALLMETHOD("loadedUpdateStatus"), dbIndex));

    } else if (itemType == "score") {

        bool converted = false;
        double changedScore = value.toDouble(&converted);

        if (!converted) 
            return;
        
        double currentScore = currentItem->text().toDouble();
        double incr = changedScore - currentScore;

        QStandardItem * memberItem = item(currentItem->row(), 0);

        QStringList updateCmd;
        updateCmd << "ZINCRBY"
            << keyName
            << QString::number(incr)
            << memberItem->text();        

        db->addCommand(Command(updateCmd, this, CALLMETHOD("loadedUpdateStatus"), dbIndex));
    }

    currentItem->setText(value);
}
void MangaListWidget::updateReadChapter(QString mangaName, QString chapterName) {
  for (int k = 0; k < _model->rowCount(); k++) {
    QStandardItem* currManga = _model->itemFromIndex(_model->index(k, 0));
    if (currManga->text() == mangaName) {
      for (int i = 0; i < currManga->rowCount(); i++) {
        QStandardItem* currChapter = currManga->child(i, 0);
        if (currChapter->text() == chapterName) {
          setTextAccordingToRead(currChapter, true);
          break;
        }
      }
    }
  }
}
Beispiel #19
0
	void SyncWidget::RemoveInvalidRows ()
	{
		for (int i = Model_->rowCount () - 1; i >= 0; --i)
		{
			QStandardItem *accItem = Model_->item (i, SyncItemDelegate::Account);
			QStandardItem *localDirItem = Model_->item (i, SyncItemDelegate::LocalDirectory);
			QStandardItem *remoteDirItem = Model_->item (i, SyncItemDelegate::RemoteDirectory);

			if (!accItem ||  accItem->data (SyncItemDelegate::AccountId).toByteArray ().isEmpty () ||
					!localDirItem || localDirItem->text ().isEmpty () ||
					!remoteDirItem || remoteDirItem->text ().isEmpty ())
				Model_->removeRow (i);
		}
	}
Beispiel #20
0
void DlvDebugger::showFrame(QModelIndex index)
{
    QStandardItem* file = m_framesModel->item( index.row(), 3 );
    QStandardItem* line = m_framesModel->item( index.row(), 4 );
    if( !file || !line ) {
        return;
    }
    QString filename = file->text();
    int lineno = line->text().toInt();
    if( lineno <= 0 ) {
        return;
    }
    emit setFrameLine(filename, lineno - 1 );
}
Beispiel #21
0
void RouteMapDock::btnDeleteClicked(bool)/*{{{*/
{
	QList<int> rows = getSelectedRows();
	if (!rows.isEmpty())
	{
		int id = rows.at(0);
		QStandardItem* item = _listModel->item(id, 1);
		if(item)
		{
			QString tname = item->text();
			tname = routePath + "/" + tname + ".orm";
			//printf("RouteMapDock::btnDeleteClicked() Deleting: %s\n", tname.toLatin1().constData());
			QFileInfo f(tname);
			if(f.exists() && f.isFile() && f.isWritable())
			{
				QFile file(f.filePath());
				if(QMessageBox::question(this, QString("OOMidi: Delete?"),
										tr("Are you sure you want to delete route map from disk?\n\n%1")
										.arg(file.fileName()), QMessageBox::Ok | QMessageBox::Cancel) == QMessageBox::Ok)
				{
					file.remove();
					populateTable(-1);
				}
			}
			//oom->loadRouteMapping(tname);
		}
	}
}/*}}}*/
Beispiel #22
0
bool CodeCompleterProxyModel::splitFilter(const QString &filter, QModelIndex &parent, QString &prefix)
{
    QStringList filterList = filter.split(".");
    if (filterList.size() == 1) {
        parent = QModelIndex();
        prefix = filter;
        return true;
    }
    prefix = filterList.last();
    filterList.removeLast();
    QStandardItem *root = 0;
    QStandardItem *item = 0;
    foreach (QString word, filterList) {
        item = 0;
        QModelIndex parent = m_model->indexFromItem(root);
        for (int i = 0; i < m_model->rowCount(parent); i++) {
            QModelIndex index = m_model->index(i,0,parent);
            item = m_model->itemFromIndex(index);
            if (item->text() == word) {
                break;
            }
        }
        if (item == 0) {
            break;
        }
        root = item;
    }
void PreferencesDialog::saveWaveInfo()
{
    // Change focus to force save of any open editors..
    ui->waveSearch->setFocus();

    int toprows = waveModel->rowCount();

    bool ok;
    for (int i=0; i < toprows; i++) {
        QStandardItem * topitem = waveModel->item(i,0);

        if (!topitem) continue;
        int rows = topitem->rowCount();
        for (int j=0; j< rows; ++j) {
            QStandardItem * item = topitem->child(j, 0);
            if (!item) continue;

            ChannelID id = item->data(Qt::UserRole).toUInt(&ok);
            schema::Channel & chan = schema::channel[id];
            if (chan.isNull()) continue;
            chan.setEnabled(item->checkState() == Qt::Checked ? true : false);
            chan.setFullname(item->text());
            chan.setDefaultColor(QColor(topitem->child(j,1)->data(Qt::UserRole).toUInt()));
            chan.setShowInOverview(topitem->child(j,2)->checkState() == Qt::Checked);
            chan.setLowerThreshold(topitem->child(j,3)->text().toDouble());
            chan.setUpperThreshold(topitem->child(j,4)->text().toDouble());
            chan.setLabel(topitem->child(j,5)->text());
            chan.setDescription(topitem->child(j,6)->text());
        }
    }
}
void ClassifierTrainer::add_selection_to_positives_slot()
{
    QModelIndexList indices = positivesTreeView->selectionModel()->selectedIndexes();
    if (indices.length() > 0)
    {
        QModelIndex index = indices[0];
        QStandardItem *item = positivesModel->item(index.row());
        AddSectionDialog *dialog = new AddSectionDialog(item->text(), this);
        dialog->setModal(true);
        int response = dialog->exec();

        if (response == 1) // accepted
        {
            Section s = dialog->section();
            int sectionRowCount = item->rowCount() + 1;

            // save contents to project config file
            project->load();
            if (project->addSectionToPositiveImage(s))
            {
                project->save();

                // update ui
                updatePositivesGroup();
            }
        }
    }
}
void ClassifierTrainer::del_image_from_negatives_slot()
{
    QModelIndexList indices = negativesTreeView->selectionModel()->selectedIndexes();
    if (indices.length() > 0)
    {
        QModelIndex index = indices[0];
        project->load();

        QStandardItem *item = negativesModel->itemFromIndex(index);
        qDebug() << "ABout to delete negative : " << item->text();
        project->removeNegativeImage(item->text());
        project->save();
        updateNegativesGroup();
    }

}
Beispiel #26
0
void DeliverOrderDelegate::setEditorData(QWidget * editor, const QModelIndex &index) const
{
    if (0 == index.column()) {
        return;
    } else if (2 == index.column()) {

        const QStandardItemModel * model = qobject_cast<const QStandardItemModel *>(index.model());
        FindProductDialog * w = qobject_cast<FindProductDialog *>(editor);
        QStandardItem * item = model->item(index.row(), 1);
        if (item)
            w->setCategory(item->text()); // Category

    } else if (3 == index.column()) {

        QSpinBox * w = qobject_cast<QSpinBox *>(editor);
        int value = index.data().toInt();
        if (0 == value)
            w->setValue(1);
        else
            w->setValue(value);

    } else {
       return QStyledItemDelegate::setEditorData(editor, index);
    }
}
Beispiel #27
0
void
pcl::cloud_composer::CloudView::rowsInserted (const QModelIndex& parent, int start, int end)
{
  for (int row = start; row <= end; ++row)
  {
    
    QModelIndex index = model_->index (row, 0);
    QStandardItem* item =  static_cast<QStandardItemModel*> (model_)->itemFromIndex (index);
    
    QString cloud_name = item->text ();
    QVariant cloud_ptr = item->data (CLOUD);
    sensor_msgs::PointCloud2::Ptr cloud_blob = cloud_ptr.value<sensor_msgs::PointCloud2::Ptr> ();
    QVariant color_ptr = item->data (COLOR);
    ColorHandler::ConstPtr color_handler = color_ptr.value<ColorHandler::ConstPtr> ();
    QVariant geometry_ptr = item->data (GEOMETRY);
    GeometryHandler::ConstPtr geometry_handler = geometry_ptr.value<GeometryHandler::ConstPtr> ();
    
    Eigen::Vector4f origin = item->data (ORIGIN).value<Eigen::Vector4f> (); 
    Eigen::Quaternionf orientation = item->data (ORIENTATION).value<Eigen::Quaternionf> (); 
    
    vis_->addPointCloud (cloud_blob, geometry_handler, color_handler, origin, orientation, cloud_name.toStdString ());
    
    
  }
  
  qvtk_->update ();

}
Beispiel #28
0
void RouteMapDock::btnCopyClicked(bool)/*{{{*/
{
	QList<int> rows = getSelectedRows();
	if (!rows.isEmpty())
	{
		int id = rows.at(0);
		QStandardItem* item = _listModel->item(id, 1);
		if(item)
		{
			QString tname = item->text();
			QString origname = routePath + "/" + tname + ".orm";
			QString part = " - Copy";
			QFileInfo f(origname);
			if(f.exists() && f.isFile() && f.isWritable())
			{
				QFile file(f.filePath());
				part += " ";
				for(int i = 1; true; ++i)
				{
					QString n;
					n.setNum(i);
					QString s = part + n;
					if(file.copy(routePath + "/" + tname + s + ".orm"))
						break;
				}
				populateTable(-1);
			}
		}
	}
}/*}}}*/
Beispiel #29
0
PreferencesWidget::ResultAction SpellCheckWidget::saveSettings()
{
    if (!m_isDirty) {
        return PreferencesWidget::ResultAction_None;
    }

    // Save the current dictionary's word list
    if (ui.userDictList->selectionModel()->hasSelection()) {
        int row = ui.userDictList->selectionModel()->selectedIndexes().first().row();
        QStandardItem *item = m_Model.item(row, 1);
        QString name = item->text();
        saveUserDictionaryWordList(name);
    }

    // Save dictionary information
    SettingsStore settings;
    settings.setEnabledUserDictionaries(EnabledDictionaries());
    settings.setDefaultUserDictionary(ui.defaultUserDictionary->text());
    settings.setDictionary(ui.dictionaries->itemData(ui.dictionaries->currentIndex()).toString());
    settings.setSpellCheck(ui.HighlightMisspelled->checkState() == Qt::Checked);

    SpellCheck *sc = SpellCheck::instance();
    sc->setDictionary(settings.dictionary(), true);

    return PreferencesWidget::ResultAction_RefreshSpelling;
}
void ItemViewWidget::setFilter(const QString filter)
{
	if (!m_model)
	{
		return;
	}

	for (int i = 0; i < m_model->rowCount(); ++i)
	{
		bool found = filter.isEmpty();

		if (!found)
		{
			for (int j = 0; j < m_model->columnCount(); ++j)
			{
				QStandardItem *item = m_model->item(i, j);

				if (item && item->text().contains(filter, Qt::CaseInsensitive))
				{
					found = true;

					break;
				}
			}
		}

		setRowHidden(i, m_model->invisibleRootItem()->index(), !found);
	}
}