本文整理汇总了C++中QStandardItem::text方法的典型用法代码示例。如果您正苦于以下问题:C++ QStandardItem::text方法的具体用法?C++ QStandardItem::text怎么用?C++ QStandardItem::text使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QStandardItem
的用法示例。
在下文中一共展示了QStandardItem::text方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: configAccepted
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();
}
示例2: on_screenshotListView_doubleClicked
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());
}
示例3: setTreeView
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);
}
}
示例4: optionChanged
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;
}
}
}
}
示例5: removeDomainEntries
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);
}
示例6: clone
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;
}
示例7: on_btRmDB_pressed
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();
}
示例8: testsProperParse
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());
}
}
示例9: getSelectedTypes
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()));
}
}
}
}
示例10: cameraTree_itemClicked
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();
}
示例11: onOK
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();
}
示例12: slotViewSelected
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);
}
}
示例13: goToRead
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());
}
示例14: writeBack
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;
}
}
示例15: updateWidgetFromData
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 );
}
}
}