当前位置: 首页>>代码示例>>C++>>正文


C++ QItemSelection函数代码示例

本文整理汇总了C++中QItemSelection函数的典型用法代码示例。如果您正苦于以下问题:C++ QItemSelection函数的具体用法?C++ QItemSelection怎么用?C++ QItemSelection使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了QItemSelection函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的QItemSelection函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。