本文整理汇总了C++中QItemSelection函数的典型用法代码示例。如果您正苦于以下问题:C++ QItemSelection函数的具体用法?C++ QItemSelection怎么用?C++ QItemSelection使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了QItemSelection函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: slotEnableButtons
void TreeRegions::slotEnableButtons()
{
slotEnableButtons(QItemSelection(), QItemSelection());
/*if (m_editMode)
{
ui->action_Edit->setEnabled(false);
ui->action_Delete->setEnabled(false);
ui->action_New->setEnabled(false);
ui->action_NewRoot->setEnabled(false);
ui->action_Yes->setEnabled(m_model->allowSave());
ui->action_No->setEnabled(true);
}
else
{
ui->action_New->setEnabled(true);
ui->action_NewRoot->setEnabled(true);
ui->action_Yes->setEnabled(false);
ui->action_No->setEnabled(false);
if (ui->treeView->selectionModel()->selectedRows().count() == 1)
{
ui->action_Delete->setEnabled(true);
ui->action_Edit->setEnabled(true);
}
else
{
ui->action_Delete->setEnabled(false);
ui->action_Edit->setEnabled(false);
}
}*/
}
开发者ID:AnyaIliyina,项目名称:GEOcmake,代码行数:31,代码来源:TreeRegions.cpp
示例2: selectionChanged
void GraphicalUriArray::moveItems( int step )
{
QModelIndexList selected = m_listView->selectionModel()->selectedRows();
QModelIndexList::iterator it = selected.begin();
QStringList items = m_model->stringList();
QList<int> newSelection;
// move the elements
for( ; it != selected.end() ; ++it )
{
int row = it->row();
int newRow = row + step;
// if( newRow >= 0 && newRow < items.count() )
items.move( row, newRow ); // move the row
newSelection.append( newRow );
}
m_model->setStringList(items); // set the new items
// select items that were just moved
QList<int>::iterator itNewSelect = newSelection.begin();
for( ; itNewSelect != newSelection.end(); ++ itNewSelect)
m_listView->selectionModel()->select( m_model->index(*itNewSelect), QItemSelectionModel::Select );
// update buttons enabled states
selectionChanged(QItemSelection(), QItemSelection());
}
开发者ID:Ivor23,项目名称:coolfluid3,代码行数:28,代码来源:GraphicalUriArray.cpp
示例3: updateActions
void KUI_project::openFileSlot()
{
updateActions(QItemSelection(), QItemSelection());
KUrl url;
url.setDirectory( path );
QString modelPath = KFileDialog::getOpenFileName(url, QString("*.xui"), this, QString("Open"));
if ( modelPath.isEmpty() )
return;
url.setPath( modelPath );
path = url.directory();
QDir::setCurrent( path );
qDebug() << "New path: " << path;
if (modelPath.isEmpty()) {
return;
}
modelSetup( modelPath );
}
开发者ID:mluscon,项目名称:KDE-Usability-Inspector,代码行数:26,代码来源:KUI_project.cpp
示例4: currentItemType
void QgsStyleManagerDialog::populateSymbols( const QStringList& symbolNames, bool check )
{
QStandardItemModel* model = qobject_cast<QStandardItemModel*>( listItems->model() );
model->clear();
int type = currentItemType();
for ( int i = 0; i < symbolNames.count(); ++i )
{
QString name = symbolNames[i];
QgsSymbol* symbol = mStyle->symbol( name );
if ( symbol && symbol->type() == type )
{
QStandardItem* item = new QStandardItem( name );
QIcon icon = QgsSymbolLayerUtils::symbolPreviewIcon( symbol, listItems->iconSize() );
item->setIcon( icon );
item->setData( name ); // used to find out original name when user edited the name
item->setCheckable( check );
item->setToolTip( name );
// add to model
model->appendRow( item );
}
delete symbol;
}
selectedSymbolsChanged( QItemSelection(), QItemSelection() );
symbolSelected( listItems->currentIndex() );
}
开发者ID:3liz,项目名称:Quantum-GIS,代码行数:27,代码来源:qgsstylemanagerdialog.cpp
示例5: QItemSelection
QItemSelection ListExtension::itemSelection( const QModelIndex & first, const QModelIndex & last ) const
{
if (!first.isValid() && !last.isValid())
{
return QItemSelection();
}
if (!first.isValid() && last.isValid())
{
return QItemSelection( last, last );
}
if (first.isValid() && !last.isValid())
{
return QItemSelection( first, first );
}
assert( first.column() == 0 && !first.parent().isValid() );
assert( last.column() == 0 && !last.parent().isValid() );
auto begin = first;
auto end = last;
if (begin.row() > end.row())
{
std::swap(begin, end);
}
return QItemSelection( begin, end );
}
开发者ID:bw-github,项目名称:wgtf,代码行数:28,代码来源:list_extension.cpp
示例6: switch
void QtScrollerFilter::stateChanged_QAbstractItemView(QAbstractItemView *view, QtScroller::State state)
{
switch (state) {
case QtScroller::Pressed:
if (view->selectionModel()) {
oldSelection = view->selectionModel()->selection();
oldCurrent = view->selectionModel()->currentIndex();
} else {
oldSelection = QItemSelection();
oldCurrent = QModelIndex();
}
break;
case QtScroller::Dragging:
// restore the old selection if we really start scrolling
if (view->selectionModel()) {
view->selectionModel()->select(oldSelection, QItemSelectionModel::ClearAndSelect);
view->selectionModel()->setCurrentIndex(oldCurrent, QItemSelectionModel::NoUpdate);
}
// fall through
default:
oldSelection = QItemSelection();
oldCurrent = QModelIndex();
break;
}
}
开发者ID:nhinze,项目名称:rhodes,代码行数:27,代码来源:qtscrollerfilter.cpp
示例7: QItemSelection
void tst_QAbstractProxyModel::mapSelectionToSource_data()
{
QTest::addColumn<QItemSelection>("selection");
QTest::addColumn<QItemSelection>("mapSelectionToSource");
QTest::newRow("null") << QItemSelection() << QItemSelection();
QTest::newRow("empty") << QItemSelection(QModelIndex(), QModelIndex()) << QItemSelection(QModelIndex(), QModelIndex());
}
开发者ID:RS102839,项目名称:qt,代码行数:7,代码来源:tst_qabstractproxymodel.cpp
示例8: updateDetails
void AuthorGroupPage::setData(const ModXData *data)
{
model->setList(data->authorGroup);
if (data->authorGroup.isEmpty())
{
updateDetails(QItemSelection(), QItemSelection());
}
else
{
ui.authorList->selectionModel()->select(model->index(0, 0), QItemSelectionModel::SelectCurrent);
}
}
开发者ID:phpbb,项目名称:modx_editor,代码行数:12,代码来源:authorgrouppage.cpp
示例9: QWidget
ScreenTab::ScreenTab(QWidget *parent) :
QWidget(parent),
ui(new Ui::ScreenTab),
_currentMedia(NULL),
_screen(NULL),
_desktopMediaPlayer(new DesktopMediaPlayer(this))
{
ui->setupUi(this);
setScreen(new Screen(this));
// ui->currentDisplaySpinBox->setMaximum(QApplication::desktop()->screenCount() - 1);
ui->splitter->setStretchFactor(0, 1);
ui->splitter->setSizes(QList<int>() << 10000 << 1);
setContextMenuPolicy(Qt::PreventContextMenu);
addAction(ui->actionStartStopPlaying);
ui->mediaListTableView->horizontalHeader()->setResizeMode(MediaTableModel::FilePatch, QHeaderView::Stretch);
ui->mediaListTableView->horizontalHeader()->setResizeMode(MediaTableModel::NumberToShow, QHeaderView::ResizeToContents);
ui->mediaListTableView->horizontalHeader()->setResizeMode(MediaTableModel::RandomWeigth, QHeaderView::ResizeToContents);
ui->mediaListTableView->addAction(ui->actionAddMedia);
ui->mediaListTableView->addAction(ui->actionAddExtension);
ui->mediaListTableView->addAction(ui->actionRemoveRow);
ui->mediaListTableView->addAction(ui->actionMoveMediaUp);
ui->mediaListTableView->addAction(ui->actionMoveMediaDown);
ui->mediaListTableView->setContextMenuPolicy(Qt::ActionsContextMenu);
connect(ui->actionAddMedia, SIGNAL(triggered()), this, SLOT(addMedia()));
connect(ui->actionAddExtension, SIGNAL(triggered()), this, SLOT(addExtension()));
connect(ui->actionRemoveRow, SIGNAL(triggered()), this, SLOT(removeMedia()));
connect(ui->actionMoveMediaUp, SIGNAL(triggered()), this, SLOT(moveMediaUp()));
connect(ui->actionMoveMediaDown, SIGNAL(triggered()), this, SLOT(moveMediaDown()));
connect(ui->actionStartStopPlaying, SIGNAL(triggered()), this, SLOT(startStopPlaying()));
connect(ui->actionSave, SIGNAL(triggered()), this, SLOT(save()));
connect(ui->actionLoad, SIGNAL(triggered()), this, SLOT(load()));
// connect(ui->currentDisplaySpinBox, SIGNAL(valueChanged(int)), this, SLOT(onCurrentDisplaySpinBoxChanged(int)));
connect(_desktopMediaPlayer, SIGNAL(graphicSceneChanged(QGraphicsScene*)), this, SLOT(setSceneToPreview(QGraphicsScene*)));
connect(_desktopMediaPlayer, SIGNAL(escKeyPressed()), this, SLOT(stopPlaying()));
mediaListSelectedChanded(QItemSelection(), QItemSelection());
//Законектим изменение данных в энжайне расширений со слотом обновления расширений
connect(MDVPlayerApplication::instance(), SIGNAL(extensionEngineDataChanged()), this, SLOT(updateExtensions()));
onCurrentDisplaySpinBoxChanged(1);
// onCurrentDisplaySpinBoxChanged(ui->currentDisplaySpinBox->value());
}
开发者ID:0x6368656174,项目名称:iqMultipleDesktopVideo,代码行数:49,代码来源:screentab.cpp
示例10: signalSave
void ViewDepartments::slotCancel()
{
if (m_model->cancel())
{
m_editMode = false;
emit signalSave(-1, false);
}
else
QMessageBox::critical(this, "", "Не удалось отменить изменения", QMessageBox::Ok);
auto index = ui->tableView->selectionModel()->currentIndex();
ui->tableView->reset();
ui->tableView->selectionModel()->setCurrentIndex(index, QItemSelectionModel::Select |
QItemSelectionModel::Rows);
slotSelectionChanged(QItemSelection(), QItemSelection());
}
开发者ID:AnyaIliyina,项目名称:lessFiles,代码行数:15,代码来源:ViewDepartments.cpp
示例11: QWidget
ItemListWidget::ItemListWidget(QWidget *parent)
: QWidget(parent),
ui(new Ui::ItemListWidget),
mModel(new ItemListModel(this))
{
ui->setupUi(this);
QAbstractItemModel *oldModel = ui->itemsListView->model();
ui->itemsListView->setModel(mModel);
delete oldModel;
connect(ui->itemsListView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(selectionChanged(QItemSelection,QItemSelection)));
selectionChanged(QItemSelection(), QItemSelection());
}
开发者ID:sakazuki,项目名称:actiona,代码行数:15,代码来源:itemlistwidget.cpp
示例12: ui
TreeRegions::TreeRegions(QWidget * parent): ui(new Ui::TreeRegions) // ??
{
ui->setupUi(this);
setupModel();
QObject::connect(ui->action_New, SIGNAL(triggered()), this, SLOT(slotAdd()));
QObject::connect(ui->action_NewRoot, SIGNAL(triggered()), this, SLOT(slotAddRoot()));
QObject::connect(ui->action_Delete, SIGNAL(triggered()), this, SLOT(slotDelete()));
QObject::connect(ui->action_Edit, SIGNAL(triggered()), this, SLOT(slotEdit()));
QObject::connect(ui->action_Yes, SIGNAL(triggered()), this, SLOT(slotSave()));
QObject::connect(ui->action_No, SIGNAL(triggered()), this, SLOT(slotCancel()));
QObject::connect(ui->treeView->selectionModel(), SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)),
this, SLOT(slotEnableButtons(const QItemSelection &, const QItemSelection &)));
QObject::connect(this, SIGNAL(signalChangeEditMode()), this, SLOT(slotEnableButtons()));
slotEnableButtons(QItemSelection(), QItemSelection());
}
开发者ID:AnyaIliyina,项目名称:GEOcmake,代码行数:15,代码来源:TreeRegions.cpp
示例13: qabstractproxymodel
void tst_QAbstractProxyModel::qabstractproxymodel()
{
SubQAbstractProxyModel model;
model.data(QModelIndex());
model.flags(QModelIndex());
model.headerData(0, Qt::Vertical, 0);
model.itemData(QModelIndex());
model.mapFromSource(QModelIndex());
model.mapSelectionFromSource(QItemSelection());
model.mapSelectionToSource(QItemSelection());
model.mapToSource(QModelIndex());
model.revert();
model.setSourceModel(0);
QCOMPARE(model.sourceModel(), (QAbstractItemModel*)0);
model.submit();
}
开发者ID:RS102839,项目名称:qt,代码行数:16,代码来源:tst_qabstractproxymodel.cpp
示例14: QDialog
ServerLogDialog::ServerLogDialog(QWidget *parent)
: QDialog(parent)
{
m_ui = new Ui_ServerLogDialog;
m_ui->setupUi(this);
m_eventlogProxy = new QSortFilterProxyModel(this);
m_ui->view->setModel(m_eventlogProxy);
m_eventlogProxy->setFilterCaseSensitivity(Qt::CaseInsensitive);
connect(m_ui->filter, &QLineEdit::textChanged, m_eventlogProxy, &QSortFilterProxyModel::setFilterFixedString);
m_userlistProxy = new QSortFilterProxyModel(this);
m_ui->userlistView->setModel(m_userlistProxy);
m_userlistProxy->setFilterKeyColumn(0);
m_userlistProxy->setFilterRole(Qt::DisplayRole);
m_userlistProxy->setFilterCaseSensitivity(Qt::CaseInsensitive);
connect(m_ui->userlistFilter, &QLineEdit::textChanged, m_userlistProxy, &QSortFilterProxyModel::setFilterFixedString);
connect(m_ui->inspectMode, &QPushButton::toggled, this, &ServerLogDialog::setInspectMode);
connect(m_ui->kickUser, &QPushButton::clicked, this, &ServerLogDialog::kickSelected);
connect(m_ui->banUser, &QPushButton::clicked, this, &ServerLogDialog::banSelected);
connect(m_ui->undoUser, &QPushButton::clicked, this, &ServerLogDialog::undoSelected);
connect(m_ui->redoUser, &QPushButton::clicked, this, &ServerLogDialog::redoSelected);
userSelected(QItemSelection());
}
开发者ID:callaa,项目名称:Drawpile,代码行数:28,代码来源:serverlogdialog.cpp
示例15: selectionCommand
void QgsFeatureListView::selectRow( const QModelIndex &index, bool anchor )
{
QItemSelectionModel::SelectionFlags command = selectionCommand( index );
int row = index.row();
if ( anchor )
mRowAnchor = row;
if ( selectionMode() != QListView::SingleSelection
&& command.testFlag( QItemSelectionModel::Toggle ) )
{
if ( anchor )
mCtrlDragSelectionFlag = mFeatureSelectionModel->isSelected( index )
? QItemSelectionModel::Deselect : QItemSelectionModel::Select;
command &= ~QItemSelectionModel::Toggle;
command |= mCtrlDragSelectionFlag;
if ( !anchor )
command |= QItemSelectionModel::Current;
}
QModelIndex tl = model()->index( std::min( mRowAnchor, row ), 0 );
QModelIndex br = model()->index( std::max( mRowAnchor, row ), model()->columnCount() - 1 );
mFeatureSelectionModel->selectFeatures( QItemSelection( tl, br ), command );
}
开发者ID:dmarteau,项目名称:QGIS,代码行数:25,代码来源:qgsfeaturelistview.cpp
示例16: Q_D
void KLinkItemSelectionModel::select(const QModelIndex &index, QItemSelectionModel::SelectionFlags command)
{
Q_D(KLinkItemSelectionModel);
// When an item is removed, the current index is set to the top index in the model.
// That causes a selectionChanged signal with a selection which we do not want.
if (d->m_ignoreCurrentChanged) {
return;
}
// Do *not* replace next line with: QItemSelectionModel::select(index, command)
//
// Doing so would end up calling KLinkItemSelectionModel::select(QItemSelection, QItemSelectionModel::SelectionFlags)
//
// This is because the code for QItemSelectionModel::select(QModelIndex, QItemSelectionModel::SelectionFlags) looks like this:
// {
// QItemSelection selection(index, index);
// select(selection, command);
// }
// So it calls KLinkItemSelectionModel overload of
// select(QItemSelection, QItemSelectionModel::SelectionFlags)
//
// When this happens and the selection flags include Toggle, it causes the
// selection to be toggled twice.
QItemSelectionModel::select(QItemSelection(index, index), command);
if (index.isValid())
d->m_linkedItemSelectionModel->select(d->m_indexMapper->mapSelectionLeftToRight(QItemSelection(index, index)), command);
else {
d->m_linkedItemSelectionModel->clearSelection();
}
}
开发者ID:barycz,项目名称:whs-trace,代码行数:29,代码来源:klinkitemselectionmodel.cpp
示例17: view
bool QAccessibleTable::unselectColumn(int column)
{
if (!view()->model() || !view()->selectionModel())
return false;
QModelIndex index = view()->model()->index(0, column, view()->rootIndex());
if (!index.isValid())
return false;
QItemSelection selection(index, index);
switch (view()->selectionMode()) {
case QAbstractItemView::SingleSelection:
//In SingleSelection and ContiguousSelection once an item
//is selected, there's no way for the user to unselect all items
if (selectedColumnCount() == 1)
return false;
break;
case QAbstractItemView::ContiguousSelection:
if (selectedColumnCount() == 1)
return false;
if ((!column || view()->selectionModel()->isColumnSelected(column - 1, view()->rootIndex()))
&& view()->selectionModel()->isColumnSelected(column + 1, view()->rootIndex())) {
//If there are columns selected both at the left of the current row and at the right
//of the current rown, the ones which are at the right will be deselected
selection = QItemSelection(index, view()->model()->index(0, columnCount() - 1, view()->rootIndex()));
}
default:
break;
}
view()->selectionModel()->select(selection, QItemSelectionModel::Deselect | QItemSelectionModel::Columns);
return true;
}
开发者ID:2gis,项目名称:2gisqt5android,代码行数:35,代码来源:itemviews.cpp
示例18: GraphicalValue
GraphicalUriArray::GraphicalUriArray(const QString& sep, QWidget * parent)
: GraphicalValue(parent)
{
m_groupBox = new QGroupBox(parent);
m_editAdd = new QLineEdit(m_groupBox);
m_model = new QStringListModel(m_groupBox);
m_listView = new QListView(m_groupBox);
m_btAdd = new QPushButton("+", m_groupBox);
m_btRemove = new QPushButton("-", m_groupBox);
m_btUp = new QPushButton("Up", m_groupBox);
m_btDown = new QPushButton("Down", m_groupBox);
m_comboType = new QComboBox(m_groupBox);
m_separator = sep;
m_buttonsLayout = new QVBoxLayout();
m_boxLayout = new QGridLayout(m_groupBox);
m_listView->setModel(m_model);
m_listView->setSelectionMode(QAbstractItemView::ExtendedSelection);
// m_listView->setDragDropMode(QAbstractItemView::InternalMove);
// m_listView->setDragEnabled(true);
// m_listView->setAcceptDrops(true);
setProtocols(std::vector<std::string>());
m_buttonsLayout->addWidget(m_btUp);
m_buttonsLayout->addWidget(m_btDown);
m_boxLayout->addWidget(m_comboType, 0, 0);
m_boxLayout->addWidget(m_editAdd, 0, 1);
m_boxLayout->addWidget(m_btAdd, 0, 2);
m_boxLayout->addWidget(m_btRemove, 0, 3);
m_boxLayout->addWidget(m_listView, 1, 0, 1, 4);
m_boxLayout->addLayout(m_buttonsLayout, 1, 4);
m_layout->addWidget(m_groupBox);
selectionChanged(QItemSelection(), QItemSelection());
connect(m_btAdd, SIGNAL(clicked()), this, SLOT(btAddClicked()));
connect(m_btRemove, SIGNAL(clicked()), this, SLOT(btRemoveClicked()));
connect(m_comboType, SIGNAL(activated(QString)), this, SLOT(changeType(QString)));
connect(m_btUp, SIGNAL(clicked()), this, SLOT(moveUp()));
connect(m_btDown, SIGNAL(clicked()), this, SLOT(moveDown()));
connect(m_listView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
this, SLOT(selectionChanged(QItemSelection,QItemSelection)));
}
开发者ID:Ivor23,项目名称:coolfluid3,代码行数:47,代码来源:GraphicalUriArray.cpp
示例19: peerLayoutChanged
void RPCConsole::peerLayoutChanged()
{
if (!clientModel)
return;
const CNodeCombinedStats *stats = NULL;
bool fUnselect = false;
bool fReselect = false;
if (cachedNodeid == -1) // no node selected yet
return;
// find the currently selected row
int selectedRow;
QModelIndexList selectedModelIndex = ui->peerWidget->selectionModel()->selectedIndexes();
if (selectedModelIndex.isEmpty())
selectedRow = -1;
else
selectedRow = selectedModelIndex.first().row();
// check if our detail node has a row in the table (it may not necessarily
// be at selectedRow since its position can change after a layout change)
int detailNodeRow = clientModel->getPeerTableModel()->getRowByNodeId(cachedNodeid);
if (detailNodeRow < 0)
{
// detail node dissapeared from table (node disconnected)
fUnselect = true;
cachedNodeid = -1;
ui->detailWidget->hide();
ui->peerHeading->setText(tr("Select a peer to view detailed information."));
}
else
{
if (detailNodeRow != selectedRow)
{
// detail node moved position
fUnselect = true;
fReselect = true;
}
// get fresh stats on the detail node.
stats = clientModel->getPeerTableModel()->getNodeStats(detailNodeRow);
}
if (fUnselect && selectedRow >= 0)
{
ui->peerWidget->selectionModel()->select(QItemSelection(selectedModelIndex.first(), selectedModelIndex.last()),
QItemSelectionModel::Deselect);
}
if (fReselect)
{
ui->peerWidget->selectRow(detailNodeRow);
}
if (stats)
updateNodeDetail(stats);
}
开发者ID:mazaclub,项目名称:mazacoin-new,代码行数:59,代码来源:rpcconsole.cpp
示例20: userSelected
void ServerLogDialog::setOperatorMode(bool op)
{
m_opMode = op;
if(m_ui->userlistView->selectionModel())
userSelected(m_ui->userlistView->selectionModel()->selection());
else
userSelected(QItemSelection());
}
开发者ID:callaa,项目名称:Drawpile,代码行数:8,代码来源:serverlogdialog.cpp
注:本文中的QItemSelection函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论