void VCMatrixPresetSelection::slotPropertyComboChanged(QString value) { qDebug() << "Property combo changed to" << value; QComboBox *combo = (QComboBox *)sender(); QString pName = combo->property("pName").toString(); m_properties[pName] = value; }
void ComboBoxDelegate::updateData() { QComboBox* comboBox = qobject_cast<QComboBox*>(sender()); QModelIndex index = comboBox->property("combobox-delegate-index").value<QModelIndex>(); const_cast<QAbstractItemModel*>(index.model())->setData(index, comboBox->currentIndex()); }
//------------------------------------------------------------------------- void SetupDialog::fontWeightChanged(int index) { QComboBox * combobox = (QComboBox *)sender(); int id = combobox->property( SYNTAX_ELT_ID ).toInt(); int weight = combobox->itemData( index ).toInt(); QColor color = mFontColorMap[id]->property( BUTTON_COLOR ).value<QColor>(); mMainWindow->setHighlighter( id , color , weight ); }
void CameraParamsWidget::updateComboBox() { QComboBox* s = (QComboBox*)sender(); calibration::SetCameraParamRequest::Ptr req = boost::make_shared<calibration::SetCameraParamRequest>(); req->param.id = s->property("paramID").toInt(); req->param.value = s->itemData(s->currentIndex()).toInt(); emit setParam(req); }
void QMwMaterialLayersWidget::LayerColorOperationChanged(int index) { QComboBox *sender = (QComboBox*)QObject::sender(); int layerIndex = sender->property("layerIndex").toInt(); MwColorOperation colorOp = (MwColorOperation)sender->itemData(index).toInt(); this->material->shaderSlots[layerIndex].colorOp = colorOp; this->material->UpdateShader(); this->SetMessage(); }
void TelemetryCustomScreen::barSourceChanged(int index) { if (!lock) { QComboBox * cb = qobject_cast<QComboBox*>(sender()); int line = cb->property("index").toInt(); screen.body.bars[line].source = index; screen.body.bars[line].barMin = 0; screen.body.bars[line].barMax = 0; updateBar(line); emit modified(); } }
void ShaderParamsDialog::onScaleComboBoxIndexChanged(int) { QComboBox *comboBox = qobject_cast<QComboBox*>(sender()); QVariant passVariant; int pass = 0; bool ok = false; struct video_shader *menu_shader = NULL; struct video_shader *video_shader = NULL; getShaders(&menu_shader, &video_shader); if (!comboBox) return; passVariant = comboBox->property("pass"); if (!passVariant.isValid()) return; pass = passVariant.toInt(&ok); if (!ok) return; if (menu_shader && pass >= 0 && pass < static_cast<int>(menu_shader->passes)) { QVariant data = comboBox->currentData(); if (data.isValid()) { unsigned scale = data.toUInt(&ok); if (ok) { if (menu_shader) { menu_shader->pass[pass].fbo.scale_x = scale; menu_shader->pass[pass].fbo.scale_y = scale; menu_shader->pass[pass].fbo.valid = scale; } if (video_shader) { video_shader->pass[pass].fbo.scale_x = scale; video_shader->pass[pass].fbo.scale_y = scale; video_shader->pass[pass].fbo.valid = scale; } command_event(CMD_EVENT_SHADERS_APPLY_CHANGES, NULL); } } } }
void QMwMaterialLayersWidget::LayerShaderOperationChanged(int index) { QComboBox *sender = (QComboBox*)QObject::sender(); int layerIndex = sender->property("layerIndex").toInt(); MwShaderOperation shaderOp = (MwShaderOperation)sender->itemData(index).toInt(); MwColorOperation colorOp = this->material->shaderSlots[layerIndex].colorOp; this->material->RemoveShaderSlot(layerIndex); this->material->InsertShaderSlot(shaderOp, colorOp, layerIndex); this->material->UpdateShader(); this->SetMessage(); this->editor->UpdateResourceProperties(this->material); }
void MTPageNym_AltLocation::on_comboBox_currentIndexChanged(int nIndex) { QComboBox * pComboBox = qobject_cast<QComboBox*>(sender()); if (nullptr != pComboBox) { // Note: the internal data representation is updated at the // bottom, in the call to moveSingleContactItem, which calls // deleteSingleContractItem, which updates the data. (So no // need to do it in here.) // ------------------------------------------------------------- // ALSO: MOVE the contact data item widget from the current group box, // to a different group box, since after all, its type has just changed. // (We have a different group box for each type.) uint32_t newSectionType = 0; QWidget * pItemWidget = VPtr<QWidget>::asPtr(pComboBox->property("contactitemwidget")); QLineEdit * pLineEdit = nullptr; GroupBoxContactItems * pGroupBoxOld = nullptr; GroupBoxContactItems * pGroupBoxNew = nullptr; if (nullptr == pItemWidget) { return; } // ---------------------------------------------------------- pLineEdit = VPtr<QLineEdit>::asPtr(pItemWidget->property("lineedit")); if (nullptr == pLineEdit) { return; } // ---------------------------------------------------------- pGroupBoxOld = VPtr<GroupBoxContactItems>::asPtr(pItemWidget->property("groupbox")); if (nullptr == pGroupBoxOld) { return; } // ---------------------------------------------------------- // Let's get the section type of the NEW group box // (the one that was just selected in the combo box.) // QVariant qvarSectionType = pComboBox->itemData(nIndex); if (qvarSectionType.isValid()) // Always should be valid. We could assert here. { newSectionType = qvarSectionType.toUInt(); } // ------------------------------------- if (0 == newSectionType) { return; } // ------------------------------------- // Both the old AND the new groupbox are both found on this list. QList<GroupBoxContactItems *> * pListGroupBoxes = pGroupBoxOld->pListGroupBoxes_; if (nullptr == pListGroupBoxes) // should never be null. Could assert here. { return; } // ------------------------------------- // Iterate the list and find the groupbox that contains the new section type // we're looking for. // for (QList<GroupBoxContactItems *>::iterator it_boxes = pListGroupBoxes->begin(); it_boxes != pListGroupBoxes->end(); ++it_boxes) { GroupBoxContactItems * pGroupBox = *it_boxes; if (nullptr != pGroupBox) // should never be null. { if (pGroupBox->indexSectionType_ == newSectionType) // Found it! { pGroupBoxNew = pGroupBox; break; } } } // ------------------------------------- if (nullptr == pGroupBoxNew) { return; } // ------------------------------------- // By this point we know for sure that both group boxes, as well as the // contact data item widget, are all NOT null. // So now we can perform the move: // if (!moveSingleContactItem(pGroupBoxOld, pGroupBoxNew, pItemWidget, nIndex, pLineEdit->text())) { // qDebug() << "Failure..."; return; } } }
void QgsRelationReferenceWidget::filterChanged() { QVariant nullValue = QgsApplication::nullRepresentation(); QMap<QString, QString> filters; QgsAttributeList attrs; QComboBox *scb = qobject_cast<QComboBox *>( sender() ); Q_ASSERT( scb ); QgsFeature f; QgsFeatureIds featureIds; QString filterExpression; // comboboxes have to be disabled before building filters if ( mChainFilters ) disableChainedComboBoxes( scb ); // build filters const auto constMFilterComboBoxes = mFilterComboBoxes; for ( QComboBox *cb : constMFilterComboBoxes ) { if ( cb->currentIndex() != 0 ) { const QString fieldName = cb->property( "Field" ).toString(); if ( cb->currentText() == nullValue.toString() ) { filters[fieldName] = QStringLiteral( "\"%1\" IS NULL" ).arg( fieldName ); } else { filters[fieldName] = QgsExpression::createFieldEqualityExpression( fieldName, cb->currentText() ); } attrs << mReferencedLayer->fields().lookupField( fieldName ); } } if ( mChainFilters ) { QComboBox *ccb = nullptr; const auto constMFilterComboBoxes = mFilterComboBoxes; for ( QComboBox *cb : constMFilterComboBoxes ) { if ( !ccb ) { if ( cb == scb ) ccb = cb; continue; } if ( ccb->currentIndex() != 0 ) { const QString fieldName = cb->property( "Field" ).toString(); cb->blockSignals( true ); cb->clear(); cb->addItem( cb->property( "FieldAlias" ).toString() ); // ccb = scb // cb = scb + 1 QStringList texts; const auto txts { mFilterCache[ccb->property( "Field" ).toString()][ccb->currentText()] }; for ( const QString &txt : txts ) { QMap<QString, QString> filtersAttrs = filters; filtersAttrs[fieldName] = QgsExpression::createFieldEqualityExpression( fieldName, txt ); QString expression = filtersAttrs.values().join( QStringLiteral( " AND " ) ); QgsAttributeList subset = attrs; subset << mReferencedLayer->fields().lookupField( fieldName ); QgsFeatureIterator it( mReferencedLayer->getFeatures( QgsFeatureRequest().setFilterExpression( expression ).setSubsetOfAttributes( subset ) ) ); bool found = false; while ( it.nextFeature( f ) ) { if ( !featureIds.contains( f.id() ) ) featureIds << f.id(); found = true; } // item is only provided if at least 1 feature exists if ( found ) texts << txt; } texts.sort(); cb->addItems( texts ); cb->setEnabled( true ); cb->blockSignals( false ); ccb = cb; } } } filterExpression = filters.values().join( QStringLiteral( " AND " ) ); mComboBox->setFilterExpression( filterExpression ); }