[qet] qet/qet: [4898] Replace QSort function has been deprecated

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


Revision: 4898
Author:   scorpio810
Date:     2017-02-03 14:48:42 +0100 (Fri, 03 Feb 2017)
Log Message:
-----------
Replace QSort function has been deprecated

Modified Paths:
--------------
    trunk/qelectrotech.pro
    trunk/sources/diagramcontext.cpp
    trunk/sources/editor/elementscene.cpp
    trunk/sources/qetgraphicsitem/element.h
    trunk/sources/qetprintpreviewdialog.cpp
    trunk/sources/qtextorientationwidget.cpp

Modified: trunk/qelectrotech.pro
===================================================================
--- trunk/qelectrotech.pro	2017-02-02 18:00:53 UTC (rev 4897)
+++ trunk/qelectrotech.pro	2017-02-03 13:48:42 UTC (rev 4898)
@@ -59,6 +59,10 @@
 # Commenter la ligne ci-dessous pour desactiver l'option --config-dir
 DEFINES += QET_ALLOW_OVERRIDE_CD_OPTION
 
+# warn on *any* usage of deprecated APIs
+#DEFINES += QT_DEPRECATED_WARNINGS
+
+
 ######################################################################
 
 include(sources/PropertiesEditor/PropertiesEditor.pri)

Modified: trunk/sources/diagramcontext.cpp
===================================================================
--- trunk/sources/diagramcontext.cpp	2017-02-02 18:00:53 UTC (rev 4897)
+++ trunk/sources/diagramcontext.cpp	2017-02-03 13:48:42 UTC (rev 4898)
@@ -18,6 +18,7 @@
 #include "diagramcontext.h"
 #include <QRegExp>
 #include "qet.h"
+#include <algorithm>
 
 /**
 	@return a list containing all the keys in the context object.
@@ -30,7 +31,7 @@
 		if (order == Alphabetical) {
 			qSort(keys_list);
 		} else {
-			qSort(keys_list.begin(), keys_list.end(), DiagramContext::stringLongerThan);
+			std::sort(keys_list.begin(), keys_list.end(), DiagramContext::stringLongerThan);
 		}
 		return(keys_list);
 	}

Modified: trunk/sources/editor/elementscene.cpp
===================================================================
--- trunk/sources/editor/elementscene.cpp	2017-02-02 18:00:53 UTC (rev 4897)
+++ trunk/sources/editor/elementscene.cpp	2017-02-03 13:48:42 UTC (rev 4898)
@@ -32,6 +32,7 @@
 #include "nameslist.h"
 #include "ui/elementpropertieseditorwidget.h"
 #include "eseventinterface.h"
+#include <algorithm>
 
 #include <QKeyEvent>
 
@@ -749,7 +750,7 @@
 	
 	// ordonne les parties par leur zValue
 	if (options & SortByZValue) {
-		qSort(all_items_list.begin(), all_items_list.end(), ElementScene::zValueLessThan);
+		std::sort (all_items_list.begin(), all_items_list.end(), ElementScene::zValueLessThan);
 	}
 	
 	// rajoute eventuellement les bornes

Modified: trunk/sources/qetgraphicsitem/element.h
===================================================================
--- trunk/sources/qetgraphicsitem/element.h	2017-02-02 18:00:53 UTC (rev 4897)
+++ trunk/sources/qetgraphicsitem/element.h	2017-02-03 13:48:42 UTC (rev 4898)
@@ -22,6 +22,7 @@
 #include "qetgraphicsitem.h"
 #include "diagramcontext.h"
 #include "assignvariables.h"
+#include <algorithm>
 
 class ElementTextItem;
 class QETProject;
@@ -248,7 +249,7 @@
  * @return the list of linked elements, the list is sorted by position
  */
 inline QList <Element *> Element::linkedElements() {
-	 qSort(connected_elements.begin(), connected_elements.end(), comparPos);
+	 std::sort(connected_elements.begin(), connected_elements.end(), comparPos);
 	return connected_elements;
 }
 

Modified: trunk/sources/qetprintpreviewdialog.cpp
===================================================================
--- trunk/sources/qetprintpreviewdialog.cpp	2017-02-02 18:00:53 UTC (rev 4897)
+++ trunk/sources/qetprintpreviewdialog.cpp	2017-02-03 13:48:42 UTC (rev 4898)
@@ -23,6 +23,7 @@
 
 #include <QPrintPreviewWidget>
 #include <QPageSetupDialog>
+#include <algorithm>
 
 /**
 	Constructeur
@@ -400,7 +401,7 @@
 	// ajout du zoom en cours
 	if (current_zoom_is_not_null && (!zooms_real.contains(current_zoom))) {
 		zooms_real << current_zoom;
-		qSort(zooms_real.begin(), zooms_real.end());
+		std::sort(zooms_real.begin(), zooms_real.end());
 	}
 	
 	// remplissage de la liste deroulante

Modified: trunk/sources/qtextorientationwidget.cpp
===================================================================
--- trunk/sources/qtextorientationwidget.cpp	2017-02-02 18:00:53 UTC (rev 4897)
+++ trunk/sources/qtextorientationwidget.cpp	2017-02-03 13:48:42 UTC (rev 4898)
@@ -16,6 +16,7 @@
 	along with QElectroTech.  If not, see <http://www.gnu.org/licenses/>.
 */
 #include "qtextorientationwidget.h"
+#include <algorithm>
 
 /**
 	Constructeur
@@ -283,7 +284,7 @@
 	// recupere les longueurs a disposition
 	QList<qreal> available_lengths = text_size_hash_.values();
 	// trie les longueurs par ordre croissant
-	qSort(available_lengths.begin(), available_lengths.end());
+	std::sort(available_lengths.begin(), available_lengths.end());
 	// recherche la position ou l'on insererait le rayon
 	QList<qreal>::const_iterator i = qUpperBound(available_lengths, radius);
 	


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