Example #1
0
 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)));
 }
Example #2
0
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);
}
Example #3
0
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);
}
Example #4
0
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);
}
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);
}
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);
}
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());
    }
}
Example #8
0
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);
}
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();
}
Example #10
0
void ActionDialog::setOutputTabs(const QStringList &tabs,
                                 const QString &currentTabName)
{
    QComboBox *w = ui->comboBoxOutputTab;
    w->clear();
    w->addItem("");
    w->addItems(tabs);
    w->setEditText(currentTabName);
}
Example #11
0
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 ) );
        }
    }
}
 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
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);
}
Example #14
0
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 );
}
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);
}
Example #16
0
void ExoplanetsDialog::populateDiagramsList()
{
	Q_ASSERT(ui->comboAxisX);
	Q_ASSERT(ui->comboAxisY);

	QComboBox* axisX = ui->comboAxisX;
	QComboBox* axisY = ui->comboAxisY;

	//Save the current selection to be restored later
	axisX->blockSignals(true);
	axisY->blockSignals(true);
	int indexX = axisX->currentIndex();
	int indexY = axisY->currentIndex();
	QVariant selectedAxisX = axisX->itemData(indexX);
	QVariant selectedAxisY = axisY->itemData(indexY);
	axisX->clear();
	axisY->clear();

	QList<axisPair> axis;
	axis.append(qMakePair(q_("Orbital Eccentricity"), 0));
	axis.append(qMakePair(q_("Orbit Semi-Major Axis, AU"), 1));
	axis.append(qMakePair(q_("Planetary Mass, Mjup"), 2));
	axis.append(qMakePair(q_("Planetary Radius, Rjup"), 3));
	axis.append(qMakePair(q_("Orbital Period, days"), 4));
	axis.append(qMakePair(q_("Angular Distance, arcsec."), 5));

	for(int i=0; i<axis.size(); ++i)
	{
		axisX->addItem(axis.at(i).first, axis.at(i).second);
		axisY->addItem(axis.at(i).first, axis.at(i).second);
	}

	//Restore the selection
	indexX = axisX->findData(selectedAxisX, Qt::UserRole, Qt::MatchCaseSensitive);
	indexY = axisY->findData(selectedAxisY, Qt::UserRole, Qt::MatchCaseSensitive);
	axisX->setCurrentIndex(indexX);
	axisY->setCurrentIndex(indexY);
	axisX->blockSignals(false);
	axisY->blockSignals(false);
}
Example #17
0
void PopupMenuControl::update (int pId)
{
  uicontrol::properties& up = properties<uicontrol> ();
  QComboBox* box = qWidget<QComboBox> ();

  switch (pId)
    {
    case uicontrol::properties::ID_STRING:
      m_blockUpdate = true;
	{
	  int oldCurrent = box->currentIndex ();

	  box->clear ();
	  box->addItems (Utils::fromStdString
			 (up.get_string_string ()).split ('|'));
	  if (box->count() > 0
	      && oldCurrent >= 0
	      && oldCurrent < box->count ())
	    {
	      box->setCurrentIndex (oldCurrent);
	    }
	  else
	    {
	      gh_manager::post_set (m_handle, "value",
				    octave_value (box->count () > 0
						  ? 1.0 : 0.0),
				    false);
	    }
	}
      m_blockUpdate = false;
      break;
    case uicontrol::properties::ID_VALUE:
	{
	  Matrix value = up.get_value ().matrix_value ();

	  if (value.numel () > 0)
	    {
	      int newIndex = int (value(0)) - 1;

	      if (newIndex >= 0 && newIndex < box->count ()
		  && newIndex != box->currentIndex ())
		{
		  box->setCurrentIndex (newIndex);
		}
	    }
	}
      break;
    default:
      BaseControl::update (pId);
      break;
    }
}
Example #18
0
void Setting::lord(const QString& section, const QString& prefix, QComboBox& cmb, bool all)
{
    cmb.clear();

    QSettings& store = storage();

    QStringList keys, vals;

    store.beginGroup(section);

    keys = store.childKeys();
    qint32 n = keys.size();
    if (n > 0)
    {
        QString tval;
        QString tkey = prefix + SET_PFX_CMBTXT;

        keys.sort();

        while (n--)
        {
            QString k = keys[n];
            if (k.startsWith(prefix))
            {
                QString v = store.value(k).toString().trimmed();
                if (k == tkey)
                    tval = v;
                else if (all && !v.isEmpty())
                    vals.append(v);
            }
        }

        vals.removeDuplicates();

        n = vals.count();
        if (n > 0)
        {
            if (n > SET_MAX_CMBITM)
                n = SET_MAX_CMBITM;

            while (n--)
                cmb.addItem(vals[n]);
        }

        if (!tval.isEmpty())
            cmb.setEditText(tval);
    }

    store.endGroup();
}
Example #19
0
//! Returns an editor widget, or NULL if it doesn't supply one
QWidget* VObjectProperty::createEditor(QWidget * parent, const QStyleOptionViewItem& options,
                                       const QAbstractItemDelegate* delegate)
{
    Q_UNUSED(options);
    Q_UNUSED(delegate);
    QComboBox* tmpEditor = new QComboBox(parent);
    tmpEditor->clear();
    FillList(tmpEditor, objects);
    tmpEditor->setCurrentIndex(tmpEditor->findData(VProperty::d_ptr->VariantValue.toUInt()));
    connect(tmpEditor, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
                     &VObjectProperty::currentIndexChanged);

    VProperty::d_ptr->editor = tmpEditor;
    return VProperty::d_ptr->editor;
}
void TerminalConsole::fillPortsInfo(QComboBox &comboxBox)
{
    comboxBox.clear();
    foreach (const QSerialPortInfo &info, QSerialPortInfo::availablePorts()) {
        QStringList list;
        list << info.portName()
             << info.description()
             << info.manufacturer()
             << info.systemLocation()
             << (info.vendorIdentifier() ? QString::number(info.vendorIdentifier(), 16) : QString())
             << (info.productIdentifier() ? QString::number(info.productIdentifier(), 16) : QString());

        comboxBox.insertItem(0,list.first(), list);
        qDebug() << "Inserting " << list.first();
    }
Example #21
0
void ComInterfacesDelegate::setEditorData( QWidget* editor, const QModelIndex& index ) const {
	switch (index.column()) {
		case NAME_COLUMN: 
		case DESCRIPTION_COLUMN: {
			QLineEdit* edit = qobject_cast<QLineEdit*>(editor);
			Q_ASSERT(edit);

			const QString text = index.model()->data(index, Qt::DisplayRole).toString();
			edit->setText(text);
			break;
								 }
		case COM_DEF_COLUMN: {
			Q_ASSERT(false);
			break;
							 }
		case TRANSFER_TYPE_COLUMN: {
			QComboBox* combo = qobject_cast<QComboBox*>(editor);
			Q_ASSERT(combo);

			// remove the previous items
			combo->clear();

			// add the possible options for transfer types.
			QStringList types = index.model()->data(index, TRANSFER_TYPE_OPTIONS).toStringList();
			combo->addItem("");
			combo->addItems(types);

			// select the right option
			QString selected = index.model()->data(index, Qt::DisplayRole).toString();
			int comboIndex = combo->findText(selected);
			combo->setCurrentIndex(comboIndex);
			break;
								   }
		case DIRECTION_COLUMN: {
			QComboBox* combo = qobject_cast<QComboBox*>(editor);
			Q_ASSERT(combo);

			QString dir = index.model()->data(index, Qt::DisplayRole).toString();
			int comboIndex = combo->findText(dir);
			combo->setCurrentIndex(comboIndex);
			break;
							   }
		default: {
			QStyledItemDelegate::setEditorData(editor, index);
			break;
				 }
	}
}
Example #22
0
void MainWindow::updateObjectComboBox()
{
    QComboBox *comboBox = ui->objectSelectorComboBox;

    int previousIndex = comboBox->currentIndex();
    int previousSize = comboBox->count();

    comboBox->clear();
    for(int i = 0; i < levelObjects.count(); i++)
    {
        comboBox->addItem(QString(levelObjects.at(i).value("type").toString() + " - " + levelObjects.at(i).value("name").toString()));
    }

    if(previousSize == comboBox->count())
        comboBox->setCurrentIndex(previousIndex);
}
    void update_combobox(int size)
    {
        combobox_.clear();
        for (int i = 0; i < size; ++i) {
            enum { Buffer_size = 32 };
            char buffer[Buffer_size];
            snprintf(buffer, Buffer_size, "Camera %d", i);
            combobox_.addItem(buffer);
        }

        bool is_device_exist = (size > 0) ? true : false;
        if (is_device_exist) {
            combobox_.setCurrentIndex(size - 1);
        }
        button_.setEnabled(is_device_exist);
    }
Example #24
0
void SoundPref::getMixerDevices(int mode)
{
	snd_mixer_t *mixer;
	QComboBox *cmb;
	if (mode == modePlayback)
		cmb = ui.playbackMixerDeviceCmb;
	else {
		// TODO : capture mixer devices
	}
	cmb->clear();

	int err;
	if ((err = snd->getMixer(&mixer, mixerCard)) < 0) {
		return;
	}

	snd_mixer_elem_t *elem;
	snd_mixer_selem_id_t *sid;
	snd_mixer_selem_id_alloca(&sid);
	int indx = 0;
	int current = -1;

	cmb->addItem("");

	for (elem = snd_mixer_first_elem(mixer); elem; elem = snd_mixer_elem_next(elem)) {
		snd_mixer_selem_get_id(elem, sid);
		if (!snd_mixer_selem_is_active(elem))
			continue;
		QString device = snd_mixer_selem_id_get_name(sid);
		if (mode == modePlayback) {
			if (snd_mixer_selem_has_playback_volume(elem))
				cmb->addItem(device);
		} else if (mode == modeCapture) {
			// TODO:
		} else
			continue;
		if (device == mixerDevice) {
			current = indx;
		}
		indx ++;
	}
	if (current >= 0)
		cmb->setCurrentIndex(current+1);
	
	snd_mixer_close(mixer);
}
void ViewController::fillPortsInfo()
{
    QComboBox* cb = parentWidget()->findChild<QComboBox*>("comboBox_comport");
    if(cb) {
        if(cb->count() == 1) {
            cb->clear();
            
            foreach (const QextPortInfo &info, QextSerialEnumerator::getPorts()) {
                QStringList list;
                list << info.portName
                << info.friendName
                << info.physName
                << (info.vendorID ? QString::number(info.vendorID, 16) : QString())
                << (info.productID ? QString::number(info.productID, 16) : QString());

                cb->addItem(list.first(), list);
            }
        }
Example #26
0
    void UICanvasTestEdit::RefreshCanvases()
    {
        if (!editor_widget_)
            return;
                
        Foundation::ModuleSharedPtr ui_module = framework_->GetModuleManager()->GetModule("UiServices").lock();

        UiServices::UiModule *ui_services = dynamic_cast<UiServices::UiModule*>(ui_module.get());
        const QList<UiServices::UiProxyWidget *> proxy_widgets = ui_services->GetSceneManager()->GetAllProxyWidgets();
        
        QComboBox* combo = editor_widget_->findChild<QComboBox*>("combo_canvas");    
        if (!combo)
            return;
                
        combo->clear();
        foreach(UiServices::UiProxyWidget *proxy_widget, proxy_widgets)
            combo->addItem(proxy_widget->getWidgetProperties().getWidgetName());
    }
dmz::V8Value
dmz::JsModuleUiV8QtBasic::_combobox_clear (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) {

         cb->clear ();
      }
   }

   return scope.Close (result);

}
void SearchDialog::populateSimbadServerList()
{
	Q_ASSERT(ui->serverListComboBox);

	QComboBox* servers = ui->serverListComboBox;
	//Save the current selection to be restored later
	servers->blockSignals(true);
	int index = servers->currentIndex();
	QVariant selectedUrl = servers->itemData(index);
	servers->clear();
	//For each server, display the localized description and store the URL as user data.
	servers->addItem(q_("University of Strasbourg (France)"), DEF_SIMBAD_URL);
	servers->addItem(q_("Harvard University (USA)"), "http://simbad.harvard.edu/");

	//Restore the selection
	index = servers->findData(selectedUrl, Qt::UserRole, Qt::MatchCaseSensitive);
	servers->setCurrentIndex(index);
	servers->model()->sort(0);
	servers->blockSignals(false);
}
void LocationDialog::populatePlanetList()
{
	Q_ASSERT(ui);
	Q_ASSERT(ui->planetNameComboBox);

	QComboBox* planets = ui->planetNameComboBox;
	SolarSystem* ssystem = GETSTELMODULE(SolarSystem);
	QStringList planetNames(ssystem->getAllPlanetEnglishNames());

	//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)
	{
		planets->addItem(q_(name), name);
	}
Example #30
0
void ComPortPicker::populate(QComboBox &box, const QString &settingsKey)
{
	const QList<QextPortInfo> ports = QextSerialEnumerator::getPorts();
	const QString defaultPortName = SettingsManager::value(settingsKey).toString();
	box.clear();

	for (const QextPortInfo &info : ports) {
		const QRegExp portNameRegexp("COM\\d+", Qt::CaseInsensitive);
		if (portNameRegexp.indexIn(info.portName) != -1) {
			const QString portName = portNameRegexp.cap();
			box.addItem(portName);
		}
	}

	const int defaultIndex = box.findText(defaultPortName);
	if (defaultIndex != -1) {
		box.setCurrentIndex(defaultIndex);
	} else if (box.isEditable()) {
		box.setCurrentText(defaultPortName);
	}
}