void QgsComposerColumnSourceDelegate::setModelData( QWidget* editor, QAbstractItemModel* model, const QModelIndex& index ) const { QgsFieldExpressionWidget *fieldExpression = static_cast<QgsFieldExpressionWidget*>( editor ); QString field = fieldExpression->currentField(); model->setData( index, field, Qt::EditRole ); }
QMap< QString, QString > QgsDataDefinedSymbolDialog::dataDefinedProperties() const { QMap< QString, QString > propertyMap; int rowCount = mTreeWidget->topLevelItemCount(); for ( int i = 0; i < rowCount; ++i ) { QTreeWidgetItem* item = mTreeWidget->topLevelItem( i ); //property QString propertyKey = item->data( 0, Qt::UserRole ).toString(); //checked? bool checked = false; QCheckBox* cb = qobject_cast<QCheckBox*>( mTreeWidget->itemWidget( item, 0 ) ); if ( cb ) { checked = cb->isChecked(); } QString expressionString; if ( checked ) { QgsFieldExpressionWidget* few = qobject_cast<QgsFieldExpressionWidget*>( mTreeWidget->itemWidget( item, 1 ) ); expressionString = few->currentField(); } propertyMap.insert( propertyKey, expressionString ); } return propertyMap; }