本文整理汇总了C++中QComboBox::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ QComboBox::clear方法的具体用法?C++ QComboBox::clear怎么用?C++ QComboBox::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QComboBox
的用法示例。
在下文中一共展示了QComboBox::clear方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RefreshSubmeshes
void UICanvasTestEdit::RefreshSubmeshes()
{
if (!editor_widget_)
return;
uint numsubmeshes = 0;
Scene::ScenePtr scene = framework_->GetDefaultWorldScene();
if (scene.get())
{
Scene::EntityPtr entity = scene->GetEntity(last_entity_id_);
if (entity.get())
{
OgreRenderer::EC_OgreMesh* mesh = entity->GetComponent<OgreRenderer::EC_OgreMesh>().get();
OgreRenderer::EC_OgreCustomObject* custom = entity->GetComponent<OgreRenderer::EC_OgreCustomObject>().get();
if (mesh)
numsubmeshes = mesh->GetNumMaterials();
if (custom)
numsubmeshes = custom->GetNumMaterials();
}
}
QComboBox* combo = editor_widget_->findChild<QComboBox*>("combo_subobject");
if (!combo)
return;
combo->clear();
for (uint i = 0; i < numsubmeshes; ++i)
combo->addItem(QString::fromStdString(ToString<uint>(i)));
}
示例2: populateEphemerisTimeStepsList
void AstroCalcDialog::populateEphemerisTimeStepsList()
{
Q_ASSERT(ui->ephemerisStepComboBox);
QComboBox* steps = ui->ephemerisStepComboBox;
steps->blockSignals(true);
int index = steps->currentIndex();
QVariant selectedStepId = steps->itemData(index);
steps->clear();
steps->addItem(q_("10 minutes"), "1");
steps->addItem(q_("1 hour"), "2");
steps->addItem(q_("1 day"), "3");
steps->addItem(q_("5 days"), "4");
steps->addItem(q_("10 days"), "5");
steps->addItem(q_("15 days"), "6");
steps->addItem(q_("30 days"), "7");
steps->addItem(q_("60 days"), "8");
index = steps->findData(selectedStepId, Qt::UserRole, Qt::MatchCaseSensitive);
if (index<0)
index = 2;
steps->setCurrentIndex(index);
steps->blockSignals(false);
}
示例3: populateGroupCelestialBodyList
void AstroCalcDialog::populateGroupCelestialBodyList()
{
Q_ASSERT(ui->object2ComboBox);
QComboBox* groups = ui->object2ComboBox;
groups->blockSignals(true);
int index = groups->currentIndex();
QVariant selectedGroupId = groups->itemData(index);
groups->clear();
groups->addItem(q_("Solar system"), "0");
groups->addItem(q_("Planets"), "1");
groups->addItem(q_("Asteroids"), "2");
groups->addItem(q_("Plutinos"), "3");
groups->addItem(q_("Comets"), "4");
groups->addItem(q_("Dwarf planets"), "5");
groups->addItem(q_("Cubewanos"), "6");
groups->addItem(q_("Scattered disc objects"), "7");
groups->addItem(q_("Oort cloud objects"), "8");
index = groups->findData(selectedGroupId, Qt::UserRole, Qt::MatchCaseSensitive);
if (index<0)
index = groups->findData("1", Qt::UserRole, Qt::MatchCaseSensitive);
groups->setCurrentIndex(index);
groups->model()->sort(0);
groups->blockSignals(false);
}
示例4: populateMajorPlanetList
void AstroCalcDialog::populateMajorPlanetList()
{
Q_ASSERT(ui->object1ComboBox); // object 1 is always major planet
QComboBox* majorPlanet = ui->object1ComboBox;
QList<PlanetP> planets = solarSystem->getAllPlanets();
const StelTranslator& trans = StelApp::getInstance().getLocaleMgr().getSkyTranslator();
//Save the current selection to be restored later
majorPlanet->blockSignals(true);
int index = majorPlanet->currentIndex();
QVariant selectedPlanetId = majorPlanet->itemData(index);
majorPlanet->clear();
//For each planet, display the localized name and store the original as user
//data. Unfortunately, there's no other way to do this than with a cycle.
foreach(const PlanetP& planet, planets)
{
if (planet->getPlanetType()==Planet::isPlanet && planet->getEnglishName()!=core->getCurrentPlanet()->getEnglishName())
majorPlanet->addItem(trans.qtranslate(planet->getNameI18n()), planet->getEnglishName());
}
//Restore the selection
index = majorPlanet->findData(selectedPlanetId, Qt::UserRole, Qt::MatchCaseSensitive);
if (index<0)
index = majorPlanet->findData("Mercury", Qt::UserRole, Qt::MatchCaseSensitive);;
majorPlanet->setCurrentIndex(index);
majorPlanet->model()->sort(0);
majorPlanet->blockSignals(false);
}
示例5: populateCoordinateSystemsList
void PointerCoordinatesWindow::populateCoordinateSystemsList()
{
Q_ASSERT(ui->coordinateSystemComboBox);
QComboBox* csys = ui->coordinateSystemComboBox;
//Save the current selection to be restored later
csys->blockSignals(true);
int index = csys->currentIndex();
QVariant selectedSystemId = csys->itemData(index);
csys->clear();
//For each algorithm, display the localized name and store the key as user
//data. Unfortunately, there's no other way to do this than with a cycle.
csys->addItem(q_("Right ascension/Declination (J2000.0)"), "RaDecJ2000");
csys->addItem(q_("Right ascension/Declination"), "RaDec");
csys->addItem(q_("Hour angle/Declination"), "HourAngle");
csys->addItem(q_("Ecliptic Longitude/Latitude"), "Ecliptic");
csys->addItem(q_("Ecliptic Longitude/Latitude (J2000.0)"), "EclipticJ2000");
csys->addItem(q_("Altitude/Azimuth"), "AltAzi");
csys->addItem(q_("Galactic Longitude/Latitude"), "Galactic");
//Restore the selection
index = csys->findData(selectedSystemId, Qt::UserRole, Qt::MatchCaseSensitive);
csys->setCurrentIndex(index);
csys->blockSignals(false);
}
示例6: populateCoordinateSystemsList
void SearchDialog::populateCoordinateSystemsList()
{
Q_ASSERT(ui->coordinateSystemComboBox);
QComboBox* csys = ui->coordinateSystemComboBox;
//Save the current selection to be restored later
csys->blockSignals(true);
int index = csys->currentIndex();
QVariant selectedSystemId = csys->itemData(index);
csys->clear();
//For each coordinate system, display the localized name and store the key as user
//data. Unfortunately, there's no other way to do this than with a cycle.
csys->addItem(qc_("Equatorial (J2000.0)", "coordinate system"), "equatorialJ2000");
csys->addItem(qc_("Equatorial", "coordinate system"), "equatorial");
csys->addItem(qc_("Horizontal", "coordinate system"), "horizontal");
csys->addItem(qc_("Galactic", "coordinate system"), "galactic");
csys->addItem(qc_("Ecliptic", "coordinate system"), "ecliptic");
csys->addItem(qc_("Ecliptic (J2000.0)", "coordinate system"), "eclipticJ2000");
//Restore the selection
index = csys->findData(selectedSystemId, Qt::UserRole, Qt::MatchCaseSensitive);
csys->setCurrentIndex(index);
csys->blockSignals(false);
}
示例7: onMediaDevicesListChanged
void CdoSampleAppWindow::onMediaDevicesListChanged(int devType,
QVariantMap devs)
{
QComboBox * targetCombo;
switch (devType)
{
case AUDIO_IN:
targetCombo = ui->micCombo;
break;
case AUDIO_OUT:
targetCombo = ui->spkCombo;
break;
case VIDEO_IN:
targetCombo = ui->camCombo;
break;
case SCREEN:
targetCombo = ui->screenCombo;
break;
}
targetCombo->clear();
QVariantMap::iterator i;
for (i = devs.begin(); i != devs.end(); ++i)
{
qDebug() << "Adding device: " << i.key();
targetCombo->addItem(QIcon(), i.value().toString(), i.key());
}
}
示例8: populateCelestialBodyList
void AstroCalcDialog::populateCelestialBodyList()
{
Q_ASSERT(ui->celestialBodyComboBox);
QComboBox* planets = ui->celestialBodyComboBox;
QStringList planetNames(solarSystem->getAllPlanetEnglishNames());
const StelTranslator& trans = StelApp::getInstance().getLocaleMgr().getSkyTranslator();
//Save the current selection to be restored later
planets->blockSignals(true);
int index = planets->currentIndex();
QVariant selectedPlanetId = planets->itemData(index);
planets->clear();
//For each planet, display the localized name and store the original as user
//data. Unfortunately, there's no other way to do this than with a cycle.
foreach(const QString& name, planetNames)
{
if (name!="Solar System Observer" && name!="Sun" && name!=core->getCurrentPlanet()->getEnglishName())
planets->addItem(trans.qtranslate(name), name);
}
//Restore the selection
index = planets->findData(selectedPlanetId, Qt::UserRole, Qt::MatchCaseSensitive);
if (index<0)
index = planets->findData("Moon", Qt::UserRole, Qt::MatchCaseSensitive);;
planets->setCurrentIndex(index);
planets->model()->sort(0);
planets->blockSignals(false);
}
示例9: on_toolButton_save_maker_clicked
void DialogMySQLConfig::on_toolButton_save_maker_clicked()
{
QApplication::setOverrideCursor(Qt::WaitCursor);
int m_id = m_ui->comboBox_makers->itemData(m_ui->comboBox_makers->currentIndex()).toInt();
QSqlQuery q;
q.prepare("UPDATE makers SET maker = ? , header =? WHERE id= ? ");
q.addBindValue(m_ui->comboBox_makers->currentText());
q.addBindValue(m_ui->textEdit_doc_header->toHtml());
q.addBindValue(m_id);
if(q.exec()){
m_ui->comboBox_makers->setMaxCount(0);
QSqlQuery query;
query.prepare("SELECT * FROM makers ORDER BY id");
QComboBox *qcb = this->parentWidget()->findChild<QComboBox *>("comboBox_maker");
qcb->clear();
if (query.exec()){
m_ui->comboBox_makers->setMaxCount(1000);
while (query.next()) {
m_ui->comboBox_makers->addItem(query.value(1).toString(),query.value(0).toString());
qcb->addItem(query.value(1).toString(),query.value(0).toString());
}
}
m_ui->comboBox_makers->setCurrentIndex( m_ui->comboBox_makers->findData(m_id));
}
QApplication::restoreOverrideCursor();
}
示例10: setOutputTabs
void ActionDialog::setOutputTabs(const QStringList &tabs,
const QString ¤tTabName)
{
QComboBox *w = ui->comboBoxOutputTab;
w->clear();
w->addItem("");
w->addItems(tabs);
w->setEditText(currentTabName);
}
示例11: CarregaCombo
void Funcoes::CarregaCombo(QComboBox &combo, QString tabela, QString campo, QString valorPrimeiroIndice
, QString campoItemData, bool limparComboAntes, QString condicao)
{
QSqlQuery sql( ConexaoBanco::Banco() );
QString consulta;
bool ok;
consulta = "SELECT " + campo + ( campoItemData.isEmpty() ? "" : ", " + campoItemData )
+ " FROM " + tabela + ( condicao.isEmpty() ? "" : " WHERE " + condicao ) ;
ok = sql.exec( consulta );
if( !ok )
{
ErroSQL( sql, "funcoes.CarregaCombo<br><b>" + consulta + "</b></br>");
return ;
}
if( limparComboAntes )
combo.clear();
if( !valorPrimeiroIndice.isEmpty() )
{
combo.clear();
combo.addItem( valorPrimeiroIndice );
}
if( campoItemData.isEmpty() )
{
while( sql.next() )
{
combo.addItem( sql.record().value( campo ).toString() );
}
}
else
{
while( sql.next() )
{
combo.addItem( sql.record().value( campo ).toString() );
combo.setItemData( combo.count() - 1, sql.record().value( campoItemData ) );
}
}
}
示例12: retranslateUi
void retranslateUi(QDialog *MemberEditDialog)
{
MemberEditDialog->setWindowTitle(QApplication::translate("MemberEditDialog", "Dialog", 0));
titleLabel->setText(QApplication::translate("MemberEditDialog", "Title", 0));
firstNameLabel->setText(QApplication::translate("MemberEditDialog", "First Name", 0));
lastNameLabel->setText(QApplication::translate("MemberEditDialog", "Last Name", 0));
streetLabel->setText(QApplication::translate("MemberEditDialog", "Street", 0));
zipLabel->setText(QApplication::translate("MemberEditDialog", "Zip", 0));
numberLabel->setText(QApplication::translate("MemberEditDialog", "Nr.", 0));
cityLabel->setText(QApplication::translate("MemberEditDialog", "City", 0));
comboBox->clear();
comboBox->insertItems(0, QStringList()
<< QString()
<< QApplication::translate("MemberEditDialog", "Herr", 0)
<< QApplication::translate("MemberEditDialog", "Frau", 0)
);
maritalCBox->clear();
maritalCBox->insertItems(0, QStringList()
<< QString()
<< QApplication::translate("MemberEditDialog", "Ledig", 0)
<< QApplication::translate("MemberEditDialog", "Verheiratet", 0)
);
titleExtLabel->setText(QString());
phoneLabel->setText(QApplication::translate("MemberEditDialog", "Phone", 0));
cellLabel->setText(QApplication::translate("MemberEditDialog", "Mobile Phone", 0));
emailLabel->setText(QApplication::translate("MemberEditDialog", "E-Mail", 0));
maritalLabel->setText(QApplication::translate("MemberEditDialog", "Stand", 0));
tabWidget->setTabText(tabWidget->indexOf(generalTab), QApplication::translate("MemberEditDialog", "General", 0));
ibanLabel->setText(QApplication::translate("MemberEditDialog", "IBAN", 0));
bicLabel->setText(QApplication::translate("MemberEditDialog", "BIC", 0));
ownerLabel->setText(QApplication::translate("MemberEditDialog", "Owner", 0));
noteLabel->setText(QApplication::translate("MemberEditDialog", "Note", 0));
addButton->setText(QApplication::translate("MemberEditDialog", "Add", 0));
editButton->setText(QApplication::translate("MemberEditDialog", "Edit", 0));
deleteButton->setText(QApplication::translate("MemberEditDialog", "Delete", 0));
tabWidget->setTabText(tabWidget->indexOf(accountTab), QApplication::translate("MemberEditDialog", "Account", 0));
okButton->setText(QApplication::translate("MemberEditDialog", "Ok", 0));
applyButton->setText(QApplication::translate("MemberEditDialog", "Apply", 0));
leaveButton->setText(QApplication::translate("MemberEditDialog", "Austritt", 0));
cancelButton->setText(QApplication::translate("MemberEditDialog", "Cancel", 0));
} // retranslateUi
示例13: eraseCPUTable
void TaskAllocationWindow::eraseCPUTable(){
map<unsigned int, QComboBox*>::iterator it;
QComboBox *box;
for (it=cpuBoxMap.begin(); it != cpuBoxMap.end(); it++){
box = it->second;
box->clear();
}
ui->cpuTable->setRowCount(0);
}
示例14: conditionFilterChanged
void TFilters::conditionFilterChanged( int index )
{
int row = getIndexActiveFilter( 1, sender() );
if ( row < 0 ) return;
TFilter *filter = activeFilters[row];
filter->setCondition( index );
QStringList args = filter->getCurrentArgumentsList();
QComboBox *comboBox = (QComboBox*)ui.filtersGridLayout->itemAtPosition ( row, 2 )->widget();
comboBox->clear();
comboBox->addItems( args );
}
示例15: eraseTaskTable
void TaskAllocationWindow::eraseTaskTable(){
map<QString, QComboBox*>::iterator it;
QComboBox *box;
for (it=taskBoxMap.begin(); it != taskBoxMap.end(); it++){
box = it->second;
box->clear();
}
ui->taskTable->setRowCount(0);
}