[qet] qet/qet: [5301] Fix compilation warning (clang and gcc)

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


Revision: 5301
Author:   blacksun
Date:     2018-04-05 20:49:28 +0200 (Thu, 05 Apr 2018)
Log Message:
-----------
Fix compilation warning (clang and gcc)

Modified Paths:
--------------
    trunk/sources/autoNum/ui/numparteditorw.cpp
    trunk/sources/elementspanel.cpp
    trunk/sources/elementspanel.h
    trunk/sources/qetgraphicsitem/conductor.cpp
    trunk/sources/qetgraphicsitem/conductortextitem.cpp
    trunk/sources/qetgraphicsitem/conductortextitem.h
    trunk/sources/qetgraphicsitem/crossrefitem.cpp
    trunk/sources/qetgraphicsitem/customelement.cpp
    trunk/sources/qetgraphicsitem/dynamicelementtextitem.cpp
    trunk/sources/qetgraphicsitem/element.cpp
    trunk/sources/richtext/richtexteditor.cpp
    trunk/sources/titleblock/qettemplateeditor.cpp
    trunk/sources/ui/dynamicelementtextmodel.cpp
    trunk/sources/ui/imagepropertieswidget.cpp
    trunk/sources/ui/imagepropertieswidget.h
    trunk/sources/undocommand/rotateselectioncommand.cpp
    trunk/sources/undocommand/rotateselectioncommand.h

Modified: trunk/sources/autoNum/ui/numparteditorw.cpp
===================================================================
--- trunk/sources/autoNum/ui/numparteditorw.cpp	2018-04-05 09:52:35 UTC (rev 5300)
+++ trunk/sources/autoNum/ui/numparteditorw.cpp	2018-04-05 18:49:28 UTC (rev 5301)
@@ -290,7 +290,7 @@
  * @param t, type used
  */
 void NumPartEditorW::setCurrentIndex(NumPartEditorW::type t) {
-	int i;
+	int i=-1;
 	if (t == unit)
 		i = ui->type_cb->findText(tr("Chiffre 1"));
 	else if (t == unitfolio)

Modified: trunk/sources/elementspanel.cpp
===================================================================
--- trunk/sources/elementspanel.cpp	2018-04-05 09:52:35 UTC (rev 5300)
+++ trunk/sources/elementspanel.cpp	2018-04-05 18:49:28 UTC (rev 5301)
@@ -123,7 +123,11 @@
 	@param project Projet a inserer dans le panel d'elements
 	@return Le QTreeWidgetItem insere le plus haut
 */
-QTreeWidgetItem *ElementsPanel::addProject(QETProject *project) {
+QTreeWidgetItem *ElementsPanel::addProject(QETProject *project, QTreeWidgetItem *parent_item, PanelOptions options)
+{
+	Q_UNUSED(parent_item)
+	Q_UNUSED(options)
+	
 	bool first_add = (first_reload_ || !projects_to_display_.contains(project));
 	
 	// create the QTreeWidgetItem representing the project

Modified: trunk/sources/elementspanel.h
===================================================================
--- trunk/sources/elementspanel.h	2018-04-05 09:52:35 UTC (rev 5300)
+++ trunk/sources/elementspanel.h	2018-04-05 18:49:28 UTC (rev 5301)
@@ -74,9 +74,9 @@
 	void panelContentChange();
 	
 	private:
-	virtual QTreeWidgetItem *addProject   (QETProject *);
-	QTreeWidgetItem *updateTemplatesCollectionItem(QTreeWidgetItem *, TitleBlockTemplatesCollection *, PanelOptions = AddAllChild, bool = false) override;
-	QTreeWidgetItem *updateTemplateItem        (QTreeWidgetItem *, const TitleBlockTemplateLocation &,  PanelOptions, bool = false) override;
+		QTreeWidgetItem *addProject   (QETProject *, QTreeWidgetItem * = nullptr, PanelOptions = AddAllChild) override;
+		QTreeWidgetItem *updateTemplatesCollectionItem(QTreeWidgetItem *, TitleBlockTemplatesCollection *, PanelOptions = AddAllChild, bool = false) override;
+		QTreeWidgetItem *updateTemplateItem        (QTreeWidgetItem *, const TitleBlockTemplateLocation &,  PanelOptions, bool = false) override;
 	
 	// attributes
 	private:

Modified: trunk/sources/qetgraphicsitem/conductor.cpp
===================================================================
--- trunk/sources/qetgraphicsitem/conductor.cpp	2018-04-05 09:52:35 UTC (rev 5300)
+++ trunk/sources/qetgraphicsitem/conductor.cpp	2018-04-05 18:49:28 UTC (rev 5301)
@@ -1020,7 +1020,13 @@
 	
 		// Export the properties and text
 	m_properties. toXml(dom_element);
-	m_text_item -> toXml(dom_element);
+	if(m_text_item->wasMovedByUser())
+	{
+		dom_element.setAttribute("userx", QString::number(m_text_item->pos().x()));
+		dom_element.setAttribute("usery", QString::number(m_text_item->pos().y()));
+	}
+	if(m_text_item->wasRotateByUser())
+		dom_element.setAttribute("rotation", QString::number(m_text_item->rotation()));
 
 	return(dom_element);
 }

Modified: trunk/sources/qetgraphicsitem/conductortextitem.cpp
===================================================================
--- trunk/sources/qetgraphicsitem/conductortextitem.cpp	2018-04-05 09:52:35 UTC (rev 5300)
+++ trunk/sources/qetgraphicsitem/conductortextitem.cpp	2018-04-05 18:49:28 UTC (rev 5301)
@@ -79,22 +79,6 @@
 }
 
 /**
- * @brief ConductorTextItem::toXml
- * Export the properties of this text in the attribute of the xml element given in parameter
- * The properties exported are position and rotation (only if moved or rotate by user)
- * @param xml
- */
-void ConductorTextItem::toXml(QDomElement &xml) const {
-	if (moved_by_user_) {
-		xml.setAttribute("userx", QString("%1").arg(pos().x()));
-		xml.setAttribute("usery", QString("%1").arg(pos().y()));
-	}
-	if (rotate_by_user_) {
-		xml.setAttribute("rotation", QString("%1").arg(rotation()));
-	}
-}
-
-/**
 	@return true si ce champ de texte a ete explictement deplace par
 	l'utilisateur, false sinon
 */

Modified: trunk/sources/qetgraphicsitem/conductortextitem.h
===================================================================
--- trunk/sources/qetgraphicsitem/conductortextitem.h	2018-04-05 09:52:35 UTC (rev 5300)
+++ trunk/sources/qetgraphicsitem/conductortextitem.h	2018-04-05 18:49:28 UTC (rev 5301)
@@ -42,7 +42,6 @@
         enum { Type = UserType + 1006 };
         Conductor *parentConductor() const;
         void fromXml(const QDomElement &) override;
-        virtual void toXml  (QDomElement &xml) const;
         int type() const override { return Type; }
         virtual bool wasMovedByUser() const;
         virtual bool wasRotateByUser() const;

Modified: trunk/sources/qetgraphicsitem/crossrefitem.cpp
===================================================================
--- trunk/sources/qetgraphicsitem/crossrefitem.cpp	2018-04-05 09:52:35 UTC (rev 5300)
+++ trunk/sources/qetgraphicsitem/crossrefitem.cpp	2018-04-05 18:49:28 UTC (rev 5301)
@@ -75,7 +75,7 @@
 {
 	if(!m_element->diagram())
 	{
-		qDebug() << "CrossRefItem constructor", "element is not in a diagram";
+		qDebug() << "CrossRefItem constructor" << "element is not in a diagram";
 		return;
 	}
 	
@@ -253,6 +253,7 @@
 			case QEvent::GraphicsSceneMouseDoubleClick:
 				mouseDoubleClickEvent(static_cast<QGraphicsSceneMouseEvent *>(event));
 				break;
+			default:break;
 		}
 		return true;
 	}

Modified: trunk/sources/qetgraphicsitem/customelement.cpp
===================================================================
--- trunk/sources/qetgraphicsitem/customelement.cpp	2018-04-05 09:52:35 UTC (rev 5300)
+++ trunk/sources/qetgraphicsitem/customelement.cpp	2018-04-05 18:49:28 UTC (rev 5301)
@@ -648,6 +648,7 @@
 	@return true si l'analyse reussit, false sinon
 */
 bool CustomElement::parseText(QDomElement &e, QPainter &qp, bool addtolist) {
+	Q_UNUSED(addtolist);
 	qreal pos_x, pos_y;
 	int size;
 	if (

Modified: trunk/sources/qetgraphicsitem/dynamicelementtextitem.cpp
===================================================================
--- trunk/sources/qetgraphicsitem/dynamicelementtextitem.cpp	2018-04-05 09:52:35 UTC (rev 5300)
+++ trunk/sources/qetgraphicsitem/dynamicelementtextitem.cpp	2018-04-05 18:49:28 UTC (rev 5301)
@@ -963,7 +963,7 @@
 
 void DynamicElementTextItem::updateReportFormulaConnection()
 {
-	if(!m_parent_element.data()->linkType() & Element::AllReport)
+	if(!(m_parent_element.data()->linkType() & Element::AllReport))
 		return;
 	
 	removeConnectionForReportFormula(m_report_formula);
@@ -977,7 +977,7 @@
  */
 void DynamicElementTextItem::updateReportText()
 {
-	if(!m_parent_element.data()->linkType() & Element::AllReport)
+	if(!(m_parent_element.data()->linkType() & Element::AllReport))
 		return;
 	
 	if (m_text_from == ElementInfo && m_info_name == "label" && m_other_report)

Modified: trunk/sources/qetgraphicsitem/element.cpp
===================================================================
--- trunk/sources/qetgraphicsitem/element.cpp	2018-04-05 09:52:35 UTC (rev 5300)
+++ trunk/sources/qetgraphicsitem/element.cpp	2018-04-05 18:49:28 UTC (rev 5301)
@@ -356,12 +356,6 @@
  */
 bool Element::fromXml(QDomElement &e, QHash<int, Terminal *> &table_id_adr, bool handle_inputs_rotation)
 {
-	QDomDocument doc = e.ownerDocument();
-	QDomElement root = doc.documentElement();
-	double saved_version = -1;
-	if(root.tagName() == "project")
-		saved_version = root.attribute("version", "-1").toDouble();
-		
 	/*
 		les bornes vont maintenant etre recensees pour associer leurs id a leur adresse reelle
 		ce recensement servira lors de la mise en place des fils
@@ -776,7 +770,7 @@
         //Dynamic texts
     QDomElement dyn_text = document.createElement("dynamic_texts");
     for (DynamicElementTextItem *deti : m_dynamic_text_list)
-        dyn_text.appendChild(deti->toXml(document));
+		dyn_text.appendChild(deti->toXml(document));
 	
 	QDomElement texts_group = document.createElement("texts_groups");
 	

Modified: trunk/sources/richtext/richtexteditor.cpp
===================================================================
--- trunk/sources/richtext/richtexteditor.cpp	2018-04-05 09:52:35 UTC (rev 5300)
+++ trunk/sources/richtext/richtexteditor.cpp	2018-04-05 18:49:28 UTC (rev 5301)
@@ -78,11 +78,11 @@
 
 QT_BEGIN_NAMESPACE
 
-static const char RichTextDialogGroupC[] = "RichTextDialog";
-static const char GeometryKeyC[] = "Geometry";
-static const char TabKeyC[] = "Tab";
+//static const char RichTextDialogGroupC[] = "RichTextDialog";
+//static const char GeometryKeyC[] = "Geometry";
+//static const char TabKeyC[] = "Tab";
 
-const bool simplifyRichTextDefault = true;
+//const bool simplifyRichTextDefault = true;
 
 namespace qdesigner_internal {
 	// Richtext simplification filter helpers: Elements to be discarded

Modified: trunk/sources/titleblock/qettemplateeditor.cpp
===================================================================
--- trunk/sources/titleblock/qettemplateeditor.cpp	2018-04-05 09:52:35 UTC (rev 5300)
+++ trunk/sources/titleblock/qettemplateeditor.cpp	2018-04-05 18:49:28 UTC (rev 5301)
@@ -687,9 +687,9 @@
 void QETTitleBlockTemplateEditor::updateActions() {
 	save_ -> setEnabled(!read_only_);
 	
-	bool can_merge;
-	bool can_split;
-	int count;
+	bool can_merge = true;
+	bool can_split = true;
+	int count = 0;
 	if (!read_only_) {
 		template_edition_area_view_ -> analyzeSelectedCells(&can_merge, &can_split, &count);
 	}

Modified: trunk/sources/ui/dynamicelementtextmodel.cpp
===================================================================
--- trunk/sources/ui/dynamicelementtextmodel.cpp	2018-04-05 09:52:35 UTC (rev 5300)
+++ trunk/sources/ui/dynamicelementtextmodel.cpp	2018-04-05 18:49:28 UTC (rev 5301)
@@ -1255,6 +1255,7 @@
 			qsi->child(width_txt_row,1)->setData(deti->textWidth(), Qt::EditRole);
 			break;
 		}
+	default:break;
 	}
 	
 	m_block_dataChanged = false;
@@ -1296,6 +1297,7 @@
 			enableGroupRotation(group);
 			break;
 		}
+		default:break;
 	}
 	
 	m_block_dataChanged = false;
@@ -1540,6 +1542,7 @@
 				emit commitData(sb); break;
 			case QEvent::Wheel:
 				emit commitData(sb); break;
+			default:break;
 		}
 		return true;
 	}

Modified: trunk/sources/ui/imagepropertieswidget.cpp
===================================================================
--- trunk/sources/ui/imagepropertieswidget.cpp	2018-04-05 09:52:35 UTC (rev 5300)
+++ trunk/sources/ui/imagepropertieswidget.cpp	2018-04-05 18:49:28 UTC (rev 5301)
@@ -130,7 +130,7 @@
  * @return the change in an undo command (ItemResizerCommand).
  * If there is no change return nullptr
  */
-QUndoCommand* ImagePropertiesWidget::associatedUndo()
+QUndoCommand* ImagePropertiesWidget::associatedUndo() const
 {
 
 	qreal value = ui->m_scale_slider->value();

Modified: trunk/sources/ui/imagepropertieswidget.h
===================================================================
--- trunk/sources/ui/imagepropertieswidget.h	2018-04-05 09:52:35 UTC (rev 5300)
+++ trunk/sources/ui/imagepropertieswidget.h	2018-04-05 18:49:28 UTC (rev 5301)
@@ -42,7 +42,7 @@
 		void apply() override;
 		void reset() override;
 		bool setLiveEdit(bool live_edit) override;
-		QUndoCommand* associatedUndo();
+		QUndoCommand* associatedUndo() const override;
 
 	private:
 		void updateUi() override;

Modified: trunk/sources/undocommand/rotateselectioncommand.cpp
===================================================================
--- trunk/sources/undocommand/rotateselectioncommand.cpp	2018-04-05 09:52:35 UTC (rev 5300)
+++ trunk/sources/undocommand/rotateselectioncommand.cpp	2018-04-05 18:49:28 UTC (rev 5301)
@@ -31,8 +31,7 @@
 
 RotateSelectionCommand::RotateSelectionCommand(Diagram *diagram, qreal angle, QUndoCommand *parent) :
 QUndoCommand(parent),
-m_diagram(diagram),
-m_angle(angle)
+m_diagram(diagram)
 {
 	setText(QObject::tr("Pivoter la selection"));
 	

Modified: trunk/sources/undocommand/rotateselectioncommand.h
===================================================================
--- trunk/sources/undocommand/rotateselectioncommand.h	2018-04-05 09:52:35 UTC (rev 5300)
+++ trunk/sources/undocommand/rotateselectioncommand.h	2018-04-05 18:49:28 UTC (rev 5301)
@@ -40,7 +40,6 @@
 	
 	private:
 		Diagram *m_diagram =nullptr;
-		qreal m_angle;
 		
 		QList<QPointer<ConductorTextItem>> m_cond_text;
 		QHash<ConductorTextItem *, bool> m_rotate_by_user;


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