[qet] qet/qet: [5424] fix "fail to build from source" with Qt < 5.7, and in the same occasion fix a memory leak

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


Revision: 5424
Author:   blacksun
Date:     2018-07-02 15:48:47 +0200 (Mon, 02 Jul 2018)
Log Message:
-----------
fix "fail to build from source" with Qt < 5.7, and in the same occasion fix a memory leak

Modified Paths:
--------------
    trunk/sources/diagramview.cpp
    trunk/sources/diagramview.h

Modified: trunk/sources/diagramview.cpp
===================================================================
--- trunk/sources/diagramview.cpp	2018-07-02 09:26:16 UTC (rev 5423)
+++ trunk/sources/diagramview.cpp	2018-07-02 13:48:47 UTC (rev 5424)
@@ -92,6 +92,13 @@
 		MultiPasteDialog d(this->m_diagram, this);
 		d.exec();
 	});
+	
+		//setup three separators, to be use in context menu
+	for(int i=0 ; i<3 ; ++i)
+	{
+		m_separators << new QAction(this);
+		m_separators.last()->setSeparator(true);
+	}
 
 	connect(m_diagram, SIGNAL(showDiagram(Diagram*)), this, SIGNAL(showDiagram(Diagram*)));
 	connect(m_diagram, SIGNAL(selectionChanged()), this, SIGNAL(selectionChanged()));
@@ -1019,8 +1026,7 @@
 		if (m_diagram->selectedItems().isEmpty())
 		{
 			list << m_paste_here;
-			list << new QAction;
-			list.last()->setSeparator(true);
+			list << m_separators.at(0);
 			list << qde->m_edit_diagram_properties;
 			list << qde->m_row_column_actions_group.actions();
 		}
@@ -1029,14 +1035,11 @@
 			list << qde->m_cut;
 			list << qde->m_copy;
 			list << m_multi_paste;
-			list << new QAction();
-			list.last()->setSeparator(true);
+			list << m_separators.at(0);
 			list << qde->m_conductor_reset;
-			list << new QAction();
-			list.last()->setSeparator(true);
+			list << m_separators.at(1);
 			list << qde->m_selection_actions_group.actions();
-			list << new QAction();
-			list.last()->setSeparator(true);
+			list << m_separators.at(2);
 			list << qde->m_depth_action_group->actions();
 		}
 		

Modified: trunk/sources/diagramview.h
===================================================================
--- trunk/sources/diagramview.h	2018-07-02 09:26:16 UTC (rev 5423)
+++ trunk/sources/diagramview.h	2018-07-02 13:48:47 UTC (rev 5424)
@@ -56,6 +56,7 @@
 		QPointF           m_rubber_band_origin;
 		bool              m_fresh_focus_in,
 						  m_first_activation = true;
+		QList<QAction *>  m_separators;
 	public:
 		QString title() const;
 		void editDiagramProperties();


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