The application now includes the folio number when displaying the properties of a selected element.

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/branches/0.3@1324 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
xavier
2011-09-08 19:03:13 +00:00
parent b903b2b6d1
commit 3930a2580e
5 changed files with 27 additions and 1 deletions

View File

@@ -1021,6 +1021,15 @@ void Diagram::setProject(QETProject *project) {
project_ = project;
}
/**
@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

View File

@@ -99,6 +99,7 @@ class Diagram : public QGraphicsScene {
// 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

View File

@@ -771,8 +771,12 @@ void DiagramView::editElement(Element *element) {
}
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());

View File

@@ -143,6 +143,17 @@ QList<Diagram *> QETProject::diagrams() const {
return(diagrams_);
}
/**
@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
*/

View File

@@ -73,6 +73,7 @@ class QETProject : public QObject {
public:
ProjectState state() const;
QList<Diagram *> diagrams() const;
int folioIndex(const Diagram *) const;
ElementsCollection *embeddedCollection() const;
QString filePath();
void setFilePath(const QString &);