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


C++ QComboBox::removeItem方法代码示例

本文整理汇总了C++中QComboBox::removeItem方法的典型用法代码示例。如果您正苦于以下问题:C++ QComboBox::removeItem方法的具体用法?C++ QComboBox::removeItem怎么用?C++ QComboBox::removeItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QComboBox的用法示例。


在下文中一共展示了QComboBox::removeItem方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: runEvent

 void runEvent()
 {
   if (remove)
     widget->removeItem( index );
   else
     widget->setCurrentIndex( index );
 }
开发者ID:0day-ci,项目名称:gcc,代码行数:7,代码来源:qtchoicepeer.cpp

示例2: redo

void HistoryElementRemoveWarp::redo()
{
    if(!m_scene)
        return;

    LvlScene* lvlScene;
    if(!(lvlScene = qobject_cast<LvlScene*>(m_scene)))
        return;


    lvlScene->doorPointsSync( m_removedDoor.meta.array_id, true);

    for(int i=0;i<lvlScene->m_data->doors.size();i++)
    {
        if(lvlScene->m_data->doors[i].meta.array_id==m_removedDoor.meta.array_id)
        {
            lvlScene->m_data->doors.removeAt(i);
            break;
        }
    }

    QComboBox* warplist = MainWinConnect::pMainWin->dock_LvlWarpProps->getWarpList();
    for(int i = 0; i < warplist->count(); i++){
        if((unsigned int)warplist->itemData(i).toInt() == m_removedDoor.meta.array_id){
            warplist->removeItem(i);
            break;
        }
    }

    if(warplist->count()<=0) MainWinConnect::pMainWin->dock_LvlWarpProps->setWarpRemoveButtonEnabled(false);

    MainWinConnect::pMainWin->dock_LvlWarpProps->setDoorData(-2);
}
开发者ID:Wohlhabend-Networks,项目名称:PGE-Project,代码行数:33,代码来源:historyelementremovewarp.cpp

示例3: eventFilter

bool DeleteHighlightedItemWhenShiftDelPressedEventFilter::eventFilter(QObject *obj, QEvent *event)
{
    if (event->type() == QEvent::KeyPress) {
        QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
        if (keyEvent->key() == Qt::Key_Delete) {
            QComboBox* combobox = reinterpret_cast<QComboBox *>(obj);
            combobox->removeItem(combobox->currentIndex());
            return true;
        }
    }
    return QObject::eventFilter(obj, event);
}
开发者ID:DINKIN,项目名称:Cockatrice,代码行数:12,代码来源:dlg_connect.cpp

示例4: typeBoxChanged

void MainWindow::typeBoxChanged(int index)
{
	QComboBox * snd = static_cast<QComboBox *>(sender());
	int playerIndex = 0;
	for (NgPlayerEdit const & pe : ngPlayerEdits)
	{
		QComboBox * cb = pe.typeBox;
		if (cb == snd)
			break;
		++playerIndex;
	}

	Player *& p = selectedPlayers[playerIndex];
	if (index != 3)
	{
		if (p != this)
			delete p;
		snd->removeItem(3);
	}
	switch (index)
	{
		case 0:
			p = 0;
			break;
		case 1:
			p = this;
			break;
		case 2:
		{
			if (playerSelector->exec() == QDialog::Accepted)
			{
				p = playerSelector->createPlayer();
				snd->addItem(playerSelector->playerDisplayName());
				snd->setCurrentIndex(3);
			}
			else
			{
				p = 0;
				snd->setCurrentIndex(0);
			}
		}
	}
}
开发者ID:TripleWhy,项目名称:Carcasum,代码行数:43,代码来源:mainwindow.cpp

示例5:

dmz::V8Value
dmz::JsModuleUiV8QtBasic::_combobox_remove_item (const v8::Arguments &Args) {

   v8::HandleScope scope;
   V8Value result = v8::Undefined ();

   JsModuleUiV8QtBasic *self = _to_self (Args);
   if (self) {

      QComboBox *cb = self->v8_to_qobject<QComboBox> (Args.This ());;
      if (cb) {

         if (Args.Length () > 0) {

            cb->removeItem (v8_to_number(Args[0]));
         }
      }
   }

   return scope.Close (result);
}
开发者ID:bstewart33,项目名称:js,代码行数:21,代码来源:dmzJsModuleUiV8QtBasicComboBox.cpp

示例6: removeLayer

void QgsSpatialQueryDialog::removeLayer( bool isTarget, QgsVectorLayer* lyr )
{
  QComboBox * cmb = isTarget ? cbTargetLayer : cbReferenceLayer;
  cmb->blockSignals( true );
  // Remove Combobox
  int index = getCbIndexLayer( isTarget, lyr );
  if ( index > -1 )
  {
    cmb->removeItem( index );
  }
  else
  {
    return;
  }
  // Set Layers (Target or Reference)
  QgsVectorLayer* lyrThis = mLayerTarget;
  if ( !isTarget )
  {
    lyrThis = mLayerReference;
  }
  if ( lyr == lyrThis )
  {
    lyrThis = NULL;
    if ( cmb->count() > 0 )
    {
      cmb->setCurrentIndex( 0 );
      setLayer( isTarget, 0 );
      evaluateCheckBoxLayer( isTarget );
      if ( isTarget )
      {
        if ( gbResultQuery->isVisible() )
        {
          visibleResult( false );
        }
      }
    }
  }
  cmb->blockSignals( false );
} // void QgsSpatialQueryDialog::removeLayer(bool isTarget, QgsVectorLayer* lyr)
开发者ID:AaronGaim,项目名称:QGIS,代码行数:39,代码来源:qgsspatialquerydialog.cpp

示例7: mRemoveFeatureFromSelectionButton_clicked

void QgsMergeAttributesDialog::mRemoveFeatureFromSelectionButton_clicked()
{
  if ( !mVectorLayer )
  {
    return;
  }

  //find out feature id of selected row
  QList<QTableWidgetItem *> selectionList = mTableWidget->selectedItems();
  if ( selectionList.isEmpty() )
  {
    return;
  }

  //assume all selected items to be in the same row
  QTableWidgetItem *selectedItem = selectionList[0];
  int selectedRow = selectedItem->row();
  QTableWidgetItem *selectedHeaderItem = mTableWidget->verticalHeaderItem( selectedRow );
  if ( !selectedHeaderItem )
  {
    return;
  }

  bool conversionSuccess;
  QgsFeatureId featureId = selectedHeaderItem->text().toLongLong( &conversionSuccess );
  if ( !conversionSuccess )
  {
    selectedRowChanged();
    return;
  }

  mTableWidget->removeRow( selectedRow );
  selectedRowChanged();

  //remove feature from the vector layer selection
  QgsFeatureIds selectedIds = mVectorLayer->selectedFeatureIds();
  selectedIds.remove( featureId );
  mVectorLayer->selectByIds( selectedIds );
  mMapCanvas->repaint();

  //remove feature option from the combo box (without altering the current merge values)
  for ( int i = 0; i < mTableWidget->columnCount(); ++i )
  {
    QComboBox *currentComboBox = qobject_cast<QComboBox *>( mTableWidget->cellWidget( 0, i ) );
    if ( !currentComboBox )
      continue;

    currentComboBox->blockSignals( true );
    currentComboBox->removeItem( currentComboBox->findData( QStringLiteral( "f%1" ).arg( FID_TO_STRING( featureId ) ) ) );
    currentComboBox->blockSignals( false );
  }

  //finally remove the feature from mFeatureList
  for ( QgsFeatureList::iterator f_it = mFeatureList.begin();
        f_it != mFeatureList.end();
        ++f_it )
  {
    if ( f_it->id() == featureId )
    {
      mFeatureList.erase( f_it );
      break;
    }
  }
}
开发者ID:alexbruy,项目名称:QGIS,代码行数:64,代码来源:qgsmergeattributesdialog.cpp

示例8: undo

void HistoryElementAddWarp::undo()
{
    if(!m_scene)
        return;

    LvlScene* lvlScene;
    if(!(lvlScene = qobject_cast<LvlScene*>(m_scene)))
        return;

    lvlScene->doorPointsSync((unsigned int)m_array_id,true);

    for(int i = 0; i < lvlScene->m_data->doors.size(); i++)
    {
        if(lvlScene->m_data->doors[i].meta.array_id==(unsigned int)m_array_id)
        {
            lvlScene->m_data->doors.removeAt(i);
            break;
        }
    }

    bool found = false;

    QComboBox* warplist = MainWinConnect::pMainWin->dock_LvlWarpProps->getWarpList();

    if((warplist->currentIndex()==m_listindex)&&(warplist->count()>2))
    {
        warplist->setCurrentIndex(warplist->currentIndex()-1);
    }


    LogDebug("HistoryManager -> check index");

    if(m_listindex < warplist->count()){
        if(m_array_id == warplist->itemData(m_listindex).toInt()){
            found = true;
            warplist->removeItem(m_listindex);
        }
    }
    LogDebug(QString("HistoryManager -> found = %1").arg(found));


    if(!found)
    {
        found=false;
        for(int i = 0; i < warplist->count(); i++)
        {
            if(m_array_id == warplist->itemData(i).toInt())
            {
                warplist->removeItem(i);
                found=true;
                break;
            }
        }
    }
    LogDebug(QString("HistoryManager -> found and removed = %1").arg(found));


    if(warplist->count()<=0) MainWinConnect::pMainWin->dock_LvlWarpProps->setWarpRemoveButtonEnabled(false);

    MainWinConnect::pMainWin->dock_LvlWarpProps->setDoorData(-2);

    //warplist->update();
    //warplist->repaint();


}
开发者ID:jpmac26,项目名称:PGE-Project,代码行数:66,代码来源:historyelementaddwarp.cpp

示例9: drv_combobox

int drv_combobox(int drvid, void *a0, void* a1, void* a2, void* a3, void* a4, void* a5, void* a6, void* a7, void* a8, void* a9)
{
    handle_head* head = (handle_head*)a0;
    QComboBox *self = (QComboBox*)head->native;
    switch (drvid) {
    case COMBOBOX_INIT: {
        drvNewObj(a0,new QComboBox);
        break;
    }
    case COMBOBOX_COUNT: {
        drvSetInt(a1,self->count());
        break;
    }
    case COMBOBOX_SETCURRENTINDEX: {
        self->setCurrentIndex(drvGetInt(a1));
        break;
    }
    case COMBOBOX_CURRENTINDEX: {
        drvSetInt(a1,self->currentIndex());
        break;
    }
    case COMBOBOX_CURRENTTEXT: {
        drvSetString(a1,self->currentText());
        break;
    }
    case COMBOBOX_SETEDITABLE: {
        self->setEditable(drvGetBool(a1));
        break;
    }
    case COMBOBOX_ISEDITABLE: {
        drvSetBool(a1,self->isEditable());
        break;
    }
    case COMBOBOX_SETMAXCOUNT: {
        self->setMaxCount(drvGetInt(a1));
        break;
    }
    case COMBOBOX_MAXCOUNT: {
        drvSetInt(a1,self->maxCount());
        break;
    }
    case COMBOBOX_SETMAXVISIBLEITEMS: {
        self->setMaxVisibleItems(drvGetInt(a1));
        break;
    }
    case COMBOBOX_MAXVISIBLEITEMS: {
        drvSetInt(a1,self->maxVisibleItems());
        break;
    }
    case COMBOBOX_SETMINIMUMCONTENTSLENGTH: {
        self->setMinimumContentsLength(drvGetInt(a1));
        break;
    }
    case COMBOBOX_MINIMUNCONTENTSLENGHT: {
        drvSetInt(a1,self->minimumContentsLength());
        break;
    }
    case COMBOBOX_ADDITEM: {
        self->addItem(drvGetString(a1));
        break;
    }
    case COMBOBOX_INSERTITEM: {
        self->insertItem(drvGetInt(a1),drvGetString(a2));
        break;
    }
    case COMBOBOX_REMOVEITEM: {
        self->removeItem(drvGetInt(a1));
        break;
    }
    case COMBOBOX_ITEMTEXT: {
        drvSetString(a2,self->itemText(drvGetInt(a1)));
        break;
    }
    case COMBOBOX_ONCURRENTINDEXCHANGED: {
        QObject::connect(self,SIGNAL(currentIndexChanged(int)),drvNewSignal(self,a1,a2),SLOT(call(int)));
        break;
    }
    default:
        return 0;
    }
    return 1;
}
开发者ID:weigj,项目名称:loongide,代码行数:82,代码来源:cdrv.cpp


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