[qet] qet/qet: [5356] fix crash when the properties of a element text item group

[ Thread Index | Date Index | More lists.tuxfamily.org/qet Archives ]


Revision: 5356
Author:   blacksun
Date:     2018-05-12 13:17:40 +0200 (Sat, 12 May 2018)
Log Message:
-----------
fix crash when the properties of a element text item group

Modified Paths:
--------------
    trunk/sources/ui/dynamicelementtextmodel.cpp

Modified: trunk/sources/ui/dynamicelementtextmodel.cpp
===================================================================
--- trunk/sources/ui/dynamicelementtextmodel.cpp	2018-05-12 08:27:48 UTC (rev 5355)
+++ trunk/sources/ui/dynamicelementtextmodel.cpp	2018-05-12 11:17:40 UTC (rev 5356)
@@ -466,13 +466,6 @@
 			new QPropertyUndoCommand(deti, "compositeText", QVariant(deti->compositeText()), QVariant(composite_text), undo);
 	}
 	
-	Qt::Alignment alignment = text_qsi->child(align_txt_row, 1)->data(Qt::UserRole+2).value<Qt::Alignment>();
-	if (alignment != deti->alignment())
-	{
-		QPropertyUndoCommand *quc = new QPropertyUndoCommand(deti, "alignment", QVariant(deti->alignment()), QVariant(alignment), undo);
-		quc->setText(tr("Modifier l'alignement d'un texte d'élément"));
-	}
-	
 	int fs = text_qsi->child(size_txt_row,1)->data(Qt::EditRole).toInt();
 	if (fs != deti->fontSize())
 	{
@@ -527,6 +520,17 @@
 			quc->setText(tr("Pivoter un texte d'élément"));
 		}
 	}
+		
+		//When text is in a groupe, they're isn't item for alignment of the text
+	if(text_qsi->child(align_txt_row, 1))
+	{
+		Qt::Alignment alignment = text_qsi->child(align_txt_row, 1)->data(Qt::UserRole+2).value<Qt::Alignment>();
+		if (alignment != deti->alignment())
+		{
+			QPropertyUndoCommand *quc = new QPropertyUndoCommand(deti, "alignment", QVariant(deti->alignment()), QVariant(alignment), undo);
+			quc->setText(tr("Modifier l'alignement d'un texte d'élément"));
+		}
+	}
 	
 	return undo;
 }


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/