EnvironmentSelectionWidgetPrivate( EnvironmentSelectionWidget* _owner )
     : comboBox( new KComboBox( _owner ) )
     , model( new EnvironmentSelectionModel( _owner ) )
     , owner( _owner )
 {
     comboBox->setModel( model );
     comboBox->setEditable( false );
 }
Example #2
0
QWidget * IngredientNameDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &/* option */,
	const QModelIndex & index ) const
{
	//Set up the combo box
	KComboBox * editor = new KComboBox( parent );
	editor->setAutoFillBackground( true );
	editor->setEditable( true );
	editor->setCompletionMode( KGlobalSettings::CompletionPopup );

	//Set the models and the completion objects
	if ( !index.data(IngredientsEditor::IsHeaderRole).toBool() ) {
		editor->setModel( m_database->allIngredientsModels()->ingredientNameModel() );
		editor->setCompletionObject(
			m_database->allIngredientsModels()->ingredientNameCompletion() );
	} else {
		editor->setModel( m_database->allIngHeadersModels()->ingHeaderNameModel() );
		editor->setCompletionObject(
			m_database->allIngHeadersModels()->ingHeaderNameCompletion() );
	}

	return editor;
}