本文整理汇总了C++中qmodelindexlist::iterator::column方法的典型用法代码示例。如果您正苦于以下问题:C++ iterator::column方法的具体用法?C++ iterator::column怎么用?C++ iterator::column使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qmodelindexlist::iterator
的用法示例。
在下文中一共展示了iterator::column方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sel
vtkIdType *
SpreadsheetTable::selectedColumnIndices(int &nvals) const
{
vtkIdType *ids = 0;
nvals = 0;
QModelIndexList sel(selectedIndexes());
nvals = model()->rowCount();
if(nvals > 0)
{
int col = 0;
ids = new vtkIdType[nvals];
for(QModelIndexList::iterator it = sel.begin(); it != sel.end(); ++it)
{
col = it->column();
break;
}
for(int row = 0; row < nvals; ++row)
ids[nvals-1-row] = (vtkIdType)model()->index(row, col).internalId();
}
return ids;
}
示例2: matchSelToMain
void NotesModel::matchSelToMain()
{
QModelIndexList lSelFiles (m_pCommonData->m_pFilesG->selectionModel()->selection().indexes());
set<int> sSel;
for (QModelIndexList::iterator it = lSelFiles.begin(), end = lSelFiles.end(); it != end; ++it)
{
int nCol (it->column());
if (nCol > 0) // skip file name
{
sSel.insert(nCol - 1);
}
}
QItemSelectionModel* pNotesSelModel (m_pCommonData->m_pNotesG->selectionModel());
pNotesSelModel->clearSelection();
bool bFirstFound (false);
for (int i = 0, nNoteCnt = cSize(m_pCommonData->getCrtNotes()); i < nNoteCnt; ++i)
{
const Note* pNote (m_pCommonData->getCrtNotes()[i]);
int nPos (m_pCommonData->findPos(pNote));
if (sSel.count(nPos) > 0)
{
if (!bFirstFound)
{
bFirstFound = true;
m_pCommonData->m_pNotesG->setCurrentIndex(index(i, 0));
}
pNotesSelModel->select(index(i, 0), QItemSelectionModel::Select | QItemSelectionModel::Rows);
}
}
}
示例3: fixSelection
void FilesModel::fixSelection() // deselects cells that are selected but are on a different row from the "current" cell and selects the file name
{
// it works OK when getFltHandlers() is empty
QItemSelectionModel* pSelModel (m_pCommonData->m_pFilesG->selectionModel());
QModelIndexList lstSel (pSelModel->selection().indexes());
QModelIndex crt (m_pCommonData->m_pFilesG->selectionModel()->currentIndex());
int nCrtRow (crt.row());
int nCrtCol (crt.column());
if (0 == nCrtCol)
{
for (QModelIndexList::iterator it = lstSel.begin(), end = lstSel.end(); it != end; ++it)
{
if (0 != it->column())
{
pSelModel->select(*it, QItemSelectionModel::Deselect);
}
}
}
else
{
set<int> sSelectableColumns;
sSelectableColumns.insert(0);
for (int i = 0, n = cSize(m_pCommonData->getCrtNotes()); i < n; ++i) // ttt2 poor performance
{
const Note* pNote (m_pCommonData->getCrtNotes()[i]);
sSelectableColumns.insert(m_pCommonData->findPos(pNote) + 1);
}
for (QModelIndexList::iterator it = lstSel.begin(), end = lstSel.end(); it != end; ++it)
{
if ((it->row() != nCrtRow && 0 != it->column()) || 0 == sSelectableColumns.count(it->column()))
{
pSelModel->select(*it, QItemSelectionModel::Deselect);
}
}
if (nCrtRow >= 0)
{
pSelModel->select(index(nCrtRow, 0), QItemSelectionModel::Select);
}
}
}
示例4: removeRows
void CommandDataModel::removeRows(QModelIndexList indices)
{
while (!indices.empty()) {
const int row = indices.takeFirst().row();
if (row >= mCommands.size())
continue;
beginRemoveRows(QModelIndex(), row, row);
mCommands.removeAt(row);
// Decrement later indices since we removed a row
for (QModelIndexList::iterator i = indices.begin(); i != indices.end();
++i)
if (i->row() > row)
*i = i->sibling(i->row() - 1, i->column());
endRemoveRows();
}
}