本文整理汇总了C++中qmodelindexlist::const_iterator::column方法的典型用法代码示例。如果您正苦于以下问题:C++ const_iterator::column方法的具体用法?C++ const_iterator::column怎么用?C++ const_iterator::column使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qmodelindexlist::const_iterator
的用法示例。
在下文中一共展示了const_iterator::column方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: keyPressEvent
void TorrentContentTreeView::keyPressEvent(QKeyEvent *event) {
if (event->key() != Qt::Key_Space && event->key() != Qt::Key_Select) {
QTreeView::keyPressEvent(event);
return;
}
event->accept();
QModelIndex current = currentNameCell();
QVariant value = current.data(Qt::CheckStateRole);
if (!value.isValid()) {
Q_ASSERT(false);
return;
}
Qt::CheckState state = (static_cast<Qt::CheckState>(value.toInt()) == Qt::Checked
? Qt::Unchecked : Qt::Checked);
QModelIndexList selection = selectionModel()->selectedRows(TorrentContentModelItem::COL_NAME);
for (QModelIndexList::const_iterator i = selection.begin(); i != selection.end(); ++i) {
QModelIndex index = *i;
Q_ASSERT(i->column() == TorrentContentModelItem::COL_NAME);
model()->setData(index, state, Qt::CheckStateRole);
}
}
示例2: QObjectVector
// Convert indexes to object vectors taking into account that
// some index lists are multicolumn ranges
static inline QObjectVector indexesToObjects(const ObjectInspectorModel *model, const QModelIndexList &indexes)
{
if (indexes.empty())
return QObjectVector();
QObjectVector rc;
rc.reserve(indexes.size());
const QModelIndexList::const_iterator icend = indexes.constEnd();
for (QModelIndexList::const_iterator it = indexes.constBegin(); it != icend; ++it)
if (it->column() == 0)
rc.push_back(model->objectAt(*it));
return rc;
}
示例3: removeTransform
void QgsDatumTransformTableModel::removeTransform( const QModelIndexList &indexes )
{
QgsCoordinateReferenceSystem sourceCrs;
QgsCoordinateReferenceSystem destinationCrs;
for ( QModelIndexList::const_iterator it = indexes.constBegin(); it != indexes.constEnd(); it ++ )
{
if ( it->column() == SourceCrsColumn )
{
sourceCrs = QgsCoordinateReferenceSystem( data( *it, Qt::DisplayRole ).toString() );
}
if ( it->column() == DestinationCrsColumn )
{
destinationCrs = QgsCoordinateReferenceSystem( data( *it, Qt::DisplayRole ).toString() );
}
if ( sourceCrs.isValid() && destinationCrs.isValid() )
{
mTransformContext.removeSourceDestinationDatumTransform( sourceCrs, destinationCrs );
reset();
break;
}
}
}
示例4: editDatumTransform
void QgsDatumTransformTableWidget::editDatumTransform()
{
QModelIndexList selectedIndexes = mTableView->selectionModel()->selectedIndexes();
if ( selectedIndexes.count() > 0 )
{
QgsCoordinateReferenceSystem sourceCrs;
QgsCoordinateReferenceSystem destinationCrs;
int sourceTransform = -1;
int destinationTransform = -1;
for ( QModelIndexList::const_iterator it = selectedIndexes.constBegin(); it != selectedIndexes.constEnd(); it ++ )
{
switch ( it->column() )
{
case QgsDatumTransformTableModel::SourceCrsColumn:
sourceCrs = QgsCoordinateReferenceSystem( mModel->data( *it, Qt::DisplayRole ).toString() );
break;
case QgsDatumTransformTableModel::DestinationCrsColumn:
destinationCrs = QgsCoordinateReferenceSystem( mModel->data( *it, Qt::DisplayRole ).toString() );
break;
case QgsDatumTransformTableModel::SourceTransformColumn:
sourceTransform = mModel->data( *it, Qt::UserRole ).toInt();
break;
case QgsDatumTransformTableModel::DestinationTransformColumn:
destinationTransform = mModel->data( *it, Qt::UserRole ).toInt();
break;
default:
break;
}
}
if ( sourceCrs.isValid() && destinationCrs.isValid() &&
( sourceTransform != -1 || destinationTransform != -1 ) )
{
QgsDatumTransformDialog dlg( sourceCrs, destinationCrs, qMakePair( sourceTransform, destinationTransform ) );
if ( dlg.exec() )
{
QPair< QPair<QgsCoordinateReferenceSystem, int>, QPair<QgsCoordinateReferenceSystem, int > > dt = dlg.selectedDatumTransforms();
QgsCoordinateTransformContext context = mModel->transformContext();
// QMap::insert takes care of replacing existing value
context.addSourceDestinationDatumTransform( sourceCrs, destinationCrs, dt.first.second, dt.second.second );
mModel->setTransformContext( context );
}
}
}
}
示例5: removeColumns
void SheetTableView::removeColumns()
{
assert(sheet != 0);
QModelIndexList cols = selectionModel()->selectedColumns();
std::vector<int> sortedColumns;
/* Make sure rows are sorted in descending order */
for (QModelIndexList::const_iterator it = cols.begin(); it != cols.end(); ++it)
sortedColumns.push_back(it->column());
std::sort(sortedColumns.begin(), sortedColumns.end(), std::greater<int>());
/* Remove columns */
Gui::Command::openCommand("Remove rows");
for (std::vector<int>::const_iterator it = sortedColumns.begin(); it != sortedColumns.end(); ++it)
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.removeColumns('%s', %d)", sheet->getNameInDocument(),
columnName(*it).c_str(), 1);
Gui::Command::commitCommand();
Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.recompute()");
}
示例6:
void ObjectInspector::ObjectInspectorPrivate::selectIndexRange(const QModelIndexList &indexes, unsigned flags)
{
if (indexes.empty())
return;
QItemSelectionModel::SelectionFlags selectFlags = QItemSelectionModel::Select|QItemSelectionModel::Rows;
if (!(flags & AddToSelection))
selectFlags |= QItemSelectionModel::Clear;
if (flags & MakeCurrent)
selectFlags |= QItemSelectionModel::Current;
QItemSelectionModel *selectionModel = m_treeView->selectionModel();
const QModelIndexList::const_iterator cend = indexes.constEnd();
for (QModelIndexList::const_iterator it = indexes.constBegin(); it != cend; ++it)
if (it->column() == 0) {
selectionModel->select(*it, selectFlags);
selectFlags &= ~(QItemSelectionModel::Clear|QItemSelectionModel::Current);
}
if (flags & MakeCurrent)
m_treeView->scrollTo(indexes.front(), QAbstractItemView::EnsureVisible);
}
示例7: getDirDetailsFromSelect
void RetroshareDirModel::getDirDetailsFromSelect (const QModelIndexList &list, std::vector <DirDetails>& dirVec)
{
dirVec.clear();
/* Fire off requests */
QModelIndexList::const_iterator it;
for(it = list.begin(); it != list.end(); it++)
{
if(it->column()==1)
{
void *ref = it -> internalPointer();
const DirDetails *details = requestDirDetails(ref, RemoteMode);
if (!details)
continue;
dirVec.push_back(*details);
}
}
}
示例8: insertColumns
void SheetTableView::insertColumns()
{
assert(sheet != 0);
QModelIndexList cols = selectionModel()->selectedColumns();
std::vector<int> sortedColumns;
/* Make sure rows are sorted in ascending order */
for (QModelIndexList::const_iterator it = cols.begin(); it != cols.end(); ++it)
sortedColumns.push_back(it->column());
std::sort(sortedColumns.begin(), sortedColumns.end());
/* Insert columns */
Gui::Command::openCommand("Insert columns");
std::vector<int>::const_reverse_iterator it = sortedColumns.rbegin();
while (it != sortedColumns.rend()) {
int prev = *it;
int count = 1;
/* Collect neighbouring columns into one chunk */
++it;
while (it != sortedColumns.rend()) {
if (*it == prev - 1) {
prev = *it;
++count;
++it;
}
else
break;
}
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.insertColumns('%s', %d)", sheet->getNameInDocument(),
columnName(prev).c_str(), count);
}
Gui::Command::commitCommand();
Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.recompute()");
}