[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [krecipes] src/dialogs/recipeinput: Disconnect changed() from itemChanged() when needed.
From:       José_Manuel_Santamaría_Lema <panfaust () gmail ! com>
Date:       2016-03-31 15:00:31
Message-ID: E1ale5H-00028X-7t () scm ! kde ! org
[Download RAW message or body]

Git commit 3a58e8103bbac04d7eb05d2c3bc63cd38fbdd7a8 by José Manuel Santamaría Lema.
Committed on 31/03/2016 at 14:39.
Pushed by joselema into branch 'master'.

Disconnect changed() from itemChanged() when needed.

M  +31   -0    src/dialogs/recipeinput/ingredientseditor.cpp

http://commits.kde.org/krecipes/3a58e8103bbac04d7eb05d2c3bc63cd38fbdd7a8

diff --git a/src/dialogs/recipeinput/ingredientseditor.cpp \
b/src/dialogs/recipeinput/ingredientseditor.cpp index 094b555..1472d94 100644
--- a/src/dialogs/recipeinput/ingredientseditor.cpp
+++ b/src/dialogs/recipeinput/ingredientseditor.cpp
@@ -147,6 +147,10 @@ void IngredientsEditor::setRecipeTitle( const QString & title )
 
 void IngredientsEditor::loadIngredientList( IngredientList * ingredientList )
 {
+	//Disconnect the changed signal temporarily
+	disconnect( m_sourceModel, SIGNAL(itemChanged(QStandardItem*)),
+		this, SIGNAL(changed()) );
+
 	m_ingredientList = ingredientList;
 
 	m_sourceModel->setRowCount( 0 );
@@ -205,6 +209,10 @@ void IngredientsEditor::loadIngredientList( IngredientList * \
ingredientList )  
 	//Update the nutrient information status
 	updateNutrientInfoDetailsSlot();
+
+	//Re-connect the changed signal
+	connect( m_sourceModel, SIGNAL(itemChanged(QStandardItem*)),
+		this, SIGNAL(changed()) );
 }
 
 void IngredientsEditor::setRowData( int row, const Ingredient & ingredient )
@@ -588,6 +596,10 @@ void IngredientsEditor::itemChangedSlot( QStandardItem * item )
 
 void IngredientsEditor::ingredientCreatedDBSlot( const Element & newIngredient )
 {
+	//Disconnect the changed signal temporarily
+	disconnect( m_sourceModel, SIGNAL(itemChanged(QStandardItem*)),
+		this, SIGNAL(changed()) );
+
 	QModelIndex index;
 	QStandardItem * item;
 	QStandardItem * child;
@@ -625,10 +637,17 @@ void IngredientsEditor::ingredientCreatedDBSlot( const Element \
& newIngredient )  
 	}
 
+	//Re-connect the changed signal
+	connect( m_sourceModel, SIGNAL(itemChanged(QStandardItem*)),
+		this, SIGNAL(changed()) );
 }
 
 void IngredientsEditor::ingredientModifiedDBSlot( const Ingredient & newIngredient )
 {
+	//Disconnect the changed signal temporarily
+	disconnect( m_sourceModel, SIGNAL(itemChanged(QStandardItem*)),
+		this, SIGNAL(changed()) );
+
 	QModelIndex index;
 	QStandardItem * item;
 	QStandardItem * child;
@@ -653,10 +672,18 @@ void IngredientsEditor::ingredientModifiedDBSlot( const \
Ingredient & newIngredie  }
 
 	}
+
+	//Re-connect the changed signal
+	connect( m_sourceModel, SIGNAL(itemChanged(QStandardItem*)),
+		this, SIGNAL(changed()) );
 }
 
 void IngredientsEditor::ingredientRemovedDBSlot( RecipeDB::IdType \
ingredientRemovedId )  {
+	//Disconnect the changed signal temporarily
+	disconnect( m_sourceModel, SIGNAL(itemChanged(QStandardItem*)),
+		this, SIGNAL(changed()) );
+
 	QModelIndex index;
 	QStandardItem * item;
 	QStandardItem * child;
@@ -686,6 +713,10 @@ void IngredientsEditor::ingredientRemovedDBSlot( \
RecipeDB::IdType ingredientRemo  }
 		}
 	}
+
+	//Re-connect the changed signal
+	connect( m_sourceModel, SIGNAL(itemChanged(QStandardItem*)),
+		this, SIGNAL(changed()) );
 }
 
 Ingredient IngredientsEditor::readIngredientFromRow( int row )


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic