Git commit 21adedd4bca11875e67afd9d417c26a91c8a41fb by Jos=C3=A9 Manuel San= tamar=C3=ADa Lema. Committed on 08/04/2016 at 11:55. Pushed by joselema into branch 'master'. Use the global completion objects in the delegate. M +6 -19 src/dialogs/recipeinput/ingredientnamedelegate.cpp http://commits.kde.org/krecipes/21adedd4bca11875e67afd9d417c26a91c8a41fb diff --git a/src/dialogs/recipeinput/ingredientnamedelegate.cpp b/src/dialo= gs/recipeinput/ingredientnamedelegate.cpp index 2a24b9f..d4934b3 100644 --- a/src/dialogs/recipeinput/ingredientnamedelegate.cpp +++ b/src/dialogs/recipeinput/ingredientnamedelegate.cpp @@ -102,26 +102,13 @@ QWidget * IngredientNameDelegate::createEditor(QWidge= t *parent, const QStyleOpti editor->setEditable( true ); editor->setCompletionMode( KGlobalSettings::CompletionPopup ); = - //Order - editor->completionObject()->setOrder( KCompletion::Sorted ); - - editor->setModel( m_database->allIngredientsModels()->ingredientNameModel= () ); - - //Fill the items and the completion objects - int i =3D 0; - QHash::const_iterator it; - QHash::const_iterator it_end; - if ( index.data(IngredientsEditor::IsHeaderRole).toBool() ) { - it =3D m_idToHeaderMap.constBegin(); - it_end =3D m_idToHeaderMap.constEnd(); + //Set the models and the completion objects + if ( !index.data(IngredientsEditor::IsHeaderRole).toBool() ) { + editor->setModel( m_database->allIngredientsModels()->ingredientNameMode= l() ); + editor->setCompletionObject( + m_database->allIngredientsModels()->ingredientNameCompletion() ); } else { - it =3D m_idToIngredientMap.constBegin(); - it_end =3D m_idToIngredientMap.constEnd(); - } - while( it !=3D it_end ) { - editor->completionObject()->addItem( it.value().name ); - ++i; - ++it; + //TODO: set models and completion for headers } = return editor;