本文整理汇总了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 );
}
示例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);
}
示例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);
}
示例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);
}
}
}
}
示例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);
}
示例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)
示例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;
}
}
}
示例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();
}
示例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;
}