Fix compilation warning (clang and gcc)

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@5301 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
blacksun
2018-04-05 18:49:28 +00:00
parent 5bfa58ad55
commit fa547a34c8
17 changed files with 35 additions and 45 deletions

View File

@@ -290,7 +290,7 @@ void NumPartEditorW::setType(NumPartEditorW::type t, bool fnum) {
* @param t, type used * @param t, type used
*/ */
void NumPartEditorW::setCurrentIndex(NumPartEditorW::type t) { void NumPartEditorW::setCurrentIndex(NumPartEditorW::type t) {
int i; int i=-1;
if (t == unit) if (t == unit)
i = ui->type_cb->findText(tr("Chiffre 1")); i = ui->type_cb->findText(tr("Chiffre 1"));
else if (t == unitfolio) else if (t == unitfolio)

View File

@@ -123,7 +123,11 @@ void ElementsPanel::panelContentChange() {
@param project Projet a inserer dans le panel d'elements @param project Projet a inserer dans le panel d'elements
@return Le QTreeWidgetItem insere le plus haut @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)); bool first_add = (first_reload_ || !projects_to_display_.contains(project));
// create the QTreeWidgetItem representing the project // create the QTreeWidgetItem representing the project

View File

@@ -74,7 +74,7 @@ class ElementsPanel : public GenericPanel {
void panelContentChange(); void panelContentChange();
private: private:
virtual QTreeWidgetItem *addProject (QETProject *); QTreeWidgetItem *addProject (QETProject *, QTreeWidgetItem * = nullptr, PanelOptions = AddAllChild) override;
QTreeWidgetItem *updateTemplatesCollectionItem(QTreeWidgetItem *, TitleBlockTemplatesCollection *, PanelOptions = AddAllChild, bool = false) override; QTreeWidgetItem *updateTemplatesCollectionItem(QTreeWidgetItem *, TitleBlockTemplatesCollection *, PanelOptions = AddAllChild, bool = false) override;
QTreeWidgetItem *updateTemplateItem (QTreeWidgetItem *, const TitleBlockTemplateLocation &, PanelOptions, bool = false) override; QTreeWidgetItem *updateTemplateItem (QTreeWidgetItem *, const TitleBlockTemplateLocation &, PanelOptions, bool = false) override;

View File

@@ -1020,7 +1020,13 @@ QDomElement Conductor::toXml(QDomDocument &dom_document, QHash<Terminal *, int>
// Export the properties and text // Export the properties and text
m_properties. toXml(dom_element); 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); return(dom_element);
} }

View File

@@ -78,22 +78,6 @@ void ConductorTextItem::fromXml(const QDomElement &e) {
} }
} }
/**
* @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 @return true si ce champ de texte a ete explictement deplace par
l'utilisateur, false sinon l'utilisateur, false sinon

View File

@@ -42,7 +42,6 @@ class ConductorTextItem : public DiagramTextItem
enum { Type = UserType + 1006 }; enum { Type = UserType + 1006 };
Conductor *parentConductor() const; Conductor *parentConductor() const;
void fromXml(const QDomElement &) override; void fromXml(const QDomElement &) override;
virtual void toXml (QDomElement &xml) const;
int type() const override { return Type; } int type() const override { return Type; }
virtual bool wasMovedByUser() const; virtual bool wasMovedByUser() const;
virtual bool wasRotateByUser() const; virtual bool wasRotateByUser() const;

View File

@@ -75,7 +75,7 @@ void CrossRefItem::init()
{ {
if(!m_element->diagram()) if(!m_element->diagram())
{ {
qDebug() << "CrossRefItem constructor", "element is not in a diagram"; qDebug() << "CrossRefItem constructor" << "element is not in a diagram";
return; return;
} }
@@ -253,6 +253,7 @@ bool CrossRefItem::sceneEvent(QEvent *event)
case QEvent::GraphicsSceneMouseDoubleClick: case QEvent::GraphicsSceneMouseDoubleClick:
mouseDoubleClickEvent(static_cast<QGraphicsSceneMouseEvent *>(event)); mouseDoubleClickEvent(static_cast<QGraphicsSceneMouseEvent *>(event));
break; break;
default:break;
} }
return true; return true;
} }

View File

@@ -648,6 +648,7 @@ bool CustomElement::parsePolygon(QDomElement &e, QPainter &qp, bool addtolist) {
@return true si l'analyse reussit, false sinon @return true si l'analyse reussit, false sinon
*/ */
bool CustomElement::parseText(QDomElement &e, QPainter &qp, bool addtolist) { bool CustomElement::parseText(QDomElement &e, QPainter &qp, bool addtolist) {
Q_UNUSED(addtolist);
qreal pos_x, pos_y; qreal pos_x, pos_y;
int size; int size;
if ( if (

View File

@@ -963,7 +963,7 @@ void DynamicElementTextItem::clearFormulaConnection()
void DynamicElementTextItem::updateReportFormulaConnection() void DynamicElementTextItem::updateReportFormulaConnection()
{ {
if(!m_parent_element.data()->linkType() & Element::AllReport) if(!(m_parent_element.data()->linkType() & Element::AllReport))
return; return;
removeConnectionForReportFormula(m_report_formula); removeConnectionForReportFormula(m_report_formula);
@@ -977,7 +977,7 @@ void DynamicElementTextItem::updateReportFormulaConnection()
*/ */
void DynamicElementTextItem::updateReportText() void DynamicElementTextItem::updateReportText()
{ {
if(!m_parent_element.data()->linkType() & Element::AllReport) if(!(m_parent_element.data()->linkType() & Element::AllReport))
return; return;
if (m_text_from == ElementInfo && m_info_name == "label" && m_other_report) if (m_text_from == ElementInfo && m_info_name == "label" && m_other_report)

View File

@@ -356,12 +356,6 @@ bool Element::valideXml(QDomElement &e) {
*/ */
bool Element::fromXml(QDomElement &e, QHash<int, Terminal *> &table_id_adr, bool handle_inputs_rotation) 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 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 ce recensement servira lors de la mise en place des fils

View File

@@ -78,11 +78,11 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
static const char RichTextDialogGroupC[] = "RichTextDialog"; //static const char RichTextDialogGroupC[] = "RichTextDialog";
static const char GeometryKeyC[] = "Geometry"; //static const char GeometryKeyC[] = "Geometry";
static const char TabKeyC[] = "Tab"; //static const char TabKeyC[] = "Tab";
const bool simplifyRichTextDefault = true; //const bool simplifyRichTextDefault = true;
namespace qdesigner_internal { namespace qdesigner_internal {
// Richtext simplification filter helpers: Elements to be discarded // Richtext simplification filter helpers: Elements to be discarded

View File

@@ -687,9 +687,9 @@ void QETTitleBlockTemplateEditor::updateEditorTitle() {
void QETTitleBlockTemplateEditor::updateActions() { void QETTitleBlockTemplateEditor::updateActions() {
save_ -> setEnabled(!read_only_); save_ -> setEnabled(!read_only_);
bool can_merge; bool can_merge = true;
bool can_split; bool can_split = true;
int count; int count = 0;
if (!read_only_) { if (!read_only_) {
template_edition_area_view_ -> analyzeSelectedCells(&can_merge, &can_split, &count); template_edition_area_view_ -> analyzeSelectedCells(&can_merge, &can_split, &count);
} }

View File

@@ -1255,6 +1255,7 @@ void DynamicElementTextModel::updateDataFromText(DynamicElementTextItem *deti, V
qsi->child(width_txt_row,1)->setData(deti->textWidth(), Qt::EditRole); qsi->child(width_txt_row,1)->setData(deti->textWidth(), Qt::EditRole);
break; break;
} }
default:break;
} }
m_block_dataChanged = false; m_block_dataChanged = false;
@@ -1296,6 +1297,7 @@ void DynamicElementTextModel::updateDataFromGroup(ElementTextItemGroup *group, D
enableGroupRotation(group); enableGroupRotation(group);
break; break;
} }
default:break;
} }
m_block_dataChanged = false; m_block_dataChanged = false;
@@ -1540,6 +1542,7 @@ bool DynamicTextItemDelegate::eventFilter(QObject *object, QEvent *event)
emit commitData(sb); break; emit commitData(sb); break;
case QEvent::Wheel: case QEvent::Wheel:
emit commitData(sb); break; emit commitData(sb); break;
default:break;
} }
return true; return true;
} }

View File

@@ -130,7 +130,7 @@ bool ImagePropertiesWidget::setLiveEdit(bool live_edit)
* @return the change in an undo command (ItemResizerCommand). * @return the change in an undo command (ItemResizerCommand).
* If there is no change return nullptr * If there is no change return nullptr
*/ */
QUndoCommand* ImagePropertiesWidget::associatedUndo() QUndoCommand* ImagePropertiesWidget::associatedUndo() const
{ {
qreal value = ui->m_scale_slider->value(); qreal value = ui->m_scale_slider->value();

View File

@@ -42,7 +42,7 @@ class ImagePropertiesWidget : public PropertiesEditorWidget
void apply() override; void apply() override;
void reset() override; void reset() override;
bool setLiveEdit(bool live_edit) override; bool setLiveEdit(bool live_edit) override;
QUndoCommand* associatedUndo(); QUndoCommand* associatedUndo() const override;
private: private:
void updateUi() override; void updateUi() override;

View File

@@ -31,8 +31,7 @@
RotateSelectionCommand::RotateSelectionCommand(Diagram *diagram, qreal angle, QUndoCommand *parent) : RotateSelectionCommand::RotateSelectionCommand(Diagram *diagram, qreal angle, QUndoCommand *parent) :
QUndoCommand(parent), QUndoCommand(parent),
m_diagram(diagram), m_diagram(diagram)
m_angle(angle)
{ {
setText(QObject::tr("Pivoter la selection")); setText(QObject::tr("Pivoter la selection"));

View File

@@ -40,7 +40,6 @@ class RotateSelectionCommand : public QUndoCommand
private: private:
Diagram *m_diagram =nullptr; Diagram *m_diagram =nullptr;
qreal m_angle;
QList<QPointer<ConductorTextItem>> m_cond_text; QList<QPointer<ConductorTextItem>> m_cond_text;
QHash<ConductorTextItem *, bool> m_rotate_by_user; QHash<ConductorTextItem *, bool> m_rotate_by_user;