[qet] qet/qet: [4917] Replace deprecated qSort function

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


Revision: 4917
Author:   blacksun
Date:     2017-02-16 15:10:30 +0100 (Thu, 16 Feb 2017)
Log Message:
-----------
Replace deprecated qSort function

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

Modified: trunk/sources/diagramcontext.cpp
===================================================================
--- trunk/sources/diagramcontext.cpp	2017-02-16 13:27:26 UTC (rev 4916)
+++ trunk/sources/diagramcontext.cpp	2017-02-16 14:10:30 UTC (rev 4917)
@@ -23,13 +23,16 @@
 /**
 	@return a list containing all the keys in the context object.
 */
-QList<QString> DiagramContext::keys(DiagramContext::KeyOrder order) const {
+QList<QString> DiagramContext::keys(DiagramContext::KeyOrder order) const
+{
 	if (order == None) {
-		return content_.keys();
-	} else {
-		QList<QString> keys_list = content_.keys();
+		return m_content.keys();
+	}
+	else
+	{
+		QList<QString> keys_list = m_content.keys();
 		if (order == Alphabetical) {
-			qSort(keys_list);
+			std::sort(keys_list.begin(), keys_list.end());
 		} else {
 			std::sort(keys_list.begin(), keys_list.end(), DiagramContext::stringLongerThan);
 		}
@@ -42,7 +45,7 @@
 	@return true if that key is known to the diagram context, false otherwise
 */
 bool DiagramContext::contains(const QString &key) const {
-	return(content_.contains(key));
+	return(m_content.contains(key));
 }
 
 /**
@@ -49,7 +52,7 @@
 	@param key
 */
 const QVariant DiagramContext::operator[](const QString &key) const {
-	return(content_[key]);
+	return(m_content[key]);
 }
 
 /**
@@ -64,8 +67,8 @@
 */
 bool DiagramContext::addValue(const QString &key, const QVariant &value, bool show) {
 	if (keyIsAcceptable(key)) {
-		content_.insert(key, value);
-		content_show.insert(key, show);
+		m_content.insert(key, value);
+		m_content_show.insert(key, show);
 		return(true);
 		}
 	return(false);
@@ -75,8 +78,8 @@
 	Clear the content of this diagram context.
 */
 void DiagramContext::clear() {
-	content_.clear();
-	content_show.clear();
+	m_content.clear();
+	m_content_show.clear();
 }
 
 /**
@@ -83,7 +86,7 @@
 	@return the number of key/value pairs stored in this object.
 */
 int DiagramContext::count() {
-	return(content_.count());
+	return(m_content.count());
 }
 
 /**
@@ -91,14 +94,14 @@
  * @return the value pairs with key, if key no found, return false
  */
 bool DiagramContext::keyMustShow(const QString &key) const {
-	if (content_show.contains(key))
-		return content_show[key];
+	if (m_content_show.contains(key))
+		return m_content_show[key];
 	return false;
 }
 
 bool DiagramContext::operator==(const DiagramContext &dc) const {
-	return(content_     == dc.content_ &&
-		   content_show == dc.content_show);
+	return(m_content     == dc.m_content &&
+		   m_content_show == dc.m_content_show);
 }
 
 bool DiagramContext::operator!=(const DiagramContext &dc) const {
@@ -113,8 +116,8 @@
 	foreach (QString key, keys()) {
 		QDomElement property = e.ownerDocument().createElement(tag_name);
 		property.setAttribute("name", key);
-		property.setAttribute("show",content_show[key]);
-		QDomText value = e.ownerDocument().createTextNode(content_[key].toString());
+		property.setAttribute("show",m_content_show[key]);
+		QDomText value = e.ownerDocument().createTextNode(m_content[key].toString());
 		property.appendChild(value);
 		e.appendChild(property);
 	}
@@ -128,7 +131,7 @@
 	foreach (QDomElement property, QET::findInDomElement(e, tag_name)) {
 		if (!property.hasAttribute("name")) continue;
 		addValue(property.attribute("name"), QVariant(property.text()));
-		content_show.insert(property.attribute("name"), property.attribute("show", "1").toInt());
+		m_content_show.insert(property.attribute("name"), property.attribute("show", "1").toInt());
 	}
 }
 
@@ -139,10 +142,10 @@
 void DiagramContext::toSettings(QSettings &settings, const QString &array_name) const {
 	settings.beginWriteArray(array_name);
 	int i = 0;
-	foreach (QString key, content_.keys()) {
+	foreach (QString key, m_content.keys()) {
 		settings.setArrayIndex(i);
 		settings.setValue("name", key);
-		settings.setValue("value", content_[key].toString());
+		settings.setValue("value", m_content[key].toString());
 		++ i;
 	}
 	settings.endArray();

Modified: trunk/sources/diagramcontext.h
===================================================================
--- trunk/sources/diagramcontext.h	2017-02-16 13:27:26 UTC (rev 4916)
+++ trunk/sources/diagramcontext.h	2017-02-16 14:10:30 UTC (rev 4917)
@@ -75,7 +75,7 @@
 	static bool stringLongerThan(const QString &, const QString &);
 	bool keyIsAcceptable(const QString &) const;
 	/// Diagram context data (key/value pairs)
-	QHash<QString, QVariant> content_;
-	QHash<QString, bool> content_show;
+	QHash<QString, QVariant> m_content;
+	QHash<QString, bool> m_content_show;
 };
 #endif


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