[qet] [1324] The application now includes the folio number when displaying the properties of a selected element . |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/qet Archives
]
Revision: 1324
Author: xavier
Date: 2011-09-08 21:03:13 +0200 (Thu, 08 Sep 2011)
Log Message:
-----------
The application now includes the folio number when displaying the properties of a selected element.
Modified Paths:
--------------
branches/0.3/sources/diagram.cpp
branches/0.3/sources/diagram.h
branches/0.3/sources/diagramview.cpp
branches/0.3/sources/qetproject.cpp
branches/0.3/sources/qetproject.h
Modified: branches/0.3/sources/diagram.cpp
===================================================================
--- branches/0.3/sources/diagram.cpp 2011-09-07 17:36:13 UTC (rev 1323)
+++ branches/0.3/sources/diagram.cpp 2011-09-08 19:03:13 UTC (rev 1324)
@@ -1022,6 +1022,15 @@
}
/**
+ @return the folio number of this diagram within its parent project, or -1
+ if it is has no parent project
+*/
+int Diagram::folioIndex() const {
+ if (!project_) return(-1);
+ return(project_ -> folioIndex(this));
+}
+
+/**
@param fallback_to_project When a diagram does not have a declared version,
this method will use the one declared by its parent project only if
fallback_to_project is true.
Modified: branches/0.3/sources/diagram.h
===================================================================
--- branches/0.3/sources/diagram.h 2011-09-07 17:36:13 UTC (rev 1323)
+++ branches/0.3/sources/diagram.h 2011-09-08 19:03:13 UTC (rev 1324)
@@ -99,6 +99,7 @@
// fonctions relatives au projet parent
QETProject *project() const;
void setProject(QETProject *);
+ int folioIndex() const;
qreal declaredQElectroTechVersion(bool = true) const;
// fonctions relatives a la lecture seule
Modified: branches/0.3/sources/diagramview.cpp
===================================================================
--- branches/0.3/sources/diagramview.cpp 2011-09-07 17:36:13 UTC (rev 1323)
+++ branches/0.3/sources/diagramview.cpp 2011-09-08 19:03:13 UTC (rev 1324)
@@ -771,8 +771,12 @@
}
description_string += "\n";
- // nom, nombre de bornes, dimensions
+ // nom, nombre de bornes, dimensions
description_string += QString(tr("Nom\240: %1\n")).arg(element -> name());
+ int folio_index = scene -> folioIndex();
+ if (folio_index != -1) {
+ description_string += QString(tr("Folio\240: %1\n")).arg(folio_index + 1);
+ }
description_string += QString(tr("Position\240: %1\n")).arg(scene -> convertPosition(element -> scenePos()).toString());
description_string += QString(tr("Dimensions\240: %1\327%2\n")).arg(element -> size().width()).arg(element -> size().height());
description_string += QString(tr("Bornes\240: %1\n")).arg(element -> terminals().count());
Modified: branches/0.3/sources/qetproject.cpp
===================================================================
--- branches/0.3/sources/qetproject.cpp 2011-09-07 17:36:13 UTC (rev 1323)
+++ branches/0.3/sources/qetproject.cpp 2011-09-08 19:03:13 UTC (rev 1324)
@@ -144,6 +144,17 @@
}
/**
+ @param diagram Pointer to a Diagram object
+ @return the folio number of the given diagram object within the project,
+ or -1 if it is not part of this project.
+ Note: this returns 0 for the first diagram, not 1
+*/
+int QETProject::folioIndex(const Diagram *diagram) const {
+ // QList::indexOf returns -1 if no item matched.
+ return(diagrams_.indexOf(const_cast<Diagram *>(diagram)));
+}
+
+/**
@return la collection embarquee de ce projet
*/
ElementsCollection *QETProject::embeddedCollection() const {
Modified: branches/0.3/sources/qetproject.h
===================================================================
--- branches/0.3/sources/qetproject.h 2011-09-07 17:36:13 UTC (rev 1323)
+++ branches/0.3/sources/qetproject.h 2011-09-08 19:03:13 UTC (rev 1324)
@@ -73,6 +73,7 @@
public:
ProjectState state() const;
QList<Diagram *> diagrams() const;
+ int folioIndex(const Diagram *) const;
ElementsCollection *embeddedCollection() const;
QString filePath();
void setFilePath(const QString &);