From 9abcca9aefc8f7eb6b28c72bb65b34a4538c17e5 Mon Sep 17 00:00:00 2001 From: cfdev Date: Wed, 8 Jul 2009 09:41:20 +0000 Subject: [PATCH] Ajout d'un bouton pour editer un element sans devoir le retrouver dans le panel d'elements. git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@717 bfdf4180-ca20-0410-9c96-a3a8aa849046 --- sources/diagramview.cpp | 9 +++++++++ sources/diagramview.h | 2 ++ sources/projectview.cpp | 1 + sources/projectview.h | 2 ++ sources/qetdiagrameditor.cpp | 18 +++++++++++++++++- sources/qetdiagrameditor.h | 1 + 6 files changed, 32 insertions(+), 1 deletion(-) diff --git a/sources/diagramview.cpp b/sources/diagramview.cpp index 67f7b6771..173a81f9a 100644 --- a/sources/diagramview.cpp +++ b/sources/diagramview.cpp @@ -627,6 +627,7 @@ void DiagramView::editElement(Element *element) { // titre et boutons du dialogue QString description_title = tr("Propri\351t\351s de l'\351l\351ment s\351lectionn\351"); QPushButton *find_in_panel = new QPushButton(tr("Retrouver dans le panel")); + QPushButton *edit_element = new QPushButton(tr("Editer l'\351l\351ment")); // dialogue en lui-meme QMessageBox edit_element_dialog; @@ -635,13 +636,21 @@ void DiagramView::editElement(Element *element) { edit_element_dialog.setText(description_title); edit_element_dialog.setInformativeText(description_string); edit_element_dialog.addButton(find_in_panel, QMessageBox::ApplyRole); + edit_element_dialog.addButton(edit_element, QMessageBox::ApplyRole); edit_element_dialog.addButton(QMessageBox::Ok); edit_element_dialog.setDefaultButton(QMessageBox::Ok); edit_element_dialog.exec(); + // Permet de trouver l'element dans la collection if (edit_element_dialog.clickedButton() == find_in_panel) { emit(findElementRequired(custom_element -> location())); } + + // Trouve l'element dans la collection et l'edite + if (edit_element_dialog.clickedButton() == edit_element) { + emit(findElementRequired(custom_element -> location())); + emit(editElementRequired(custom_element -> location())); + } } /** diff --git a/sources/diagramview.h b/sources/diagramview.h index 124c1ccd8..209d4bafe 100644 --- a/sources/diagramview.h +++ b/sources/diagramview.h @@ -93,6 +93,8 @@ class DiagramView : public QGraphicsView { void aboutToAddElement(); /// Signal emis lorsque l'utilisateur souhaite retrouver un element du schema dans les collections void findElementRequired(const ElementsLocation &); + /// Signal emis lorsque l'utilisateur souhaite editer un element du schema + void editElementRequired(const ElementsLocation &); public slots: void selectNothing(); diff --git a/sources/projectview.cpp b/sources/projectview.cpp index c6f9f20c1..7325bd003 100644 --- a/sources/projectview.cpp +++ b/sources/projectview.cpp @@ -300,6 +300,7 @@ void ProjectView::addDiagram(DiagramView *diagram) { rebuildDiagramsMap(); connect(diagram, SIGNAL(titleChanged(DiagramView *, const QString &)), this, SLOT(updateTabTitle(DiagramView *, const QString &))); connect(diagram, SIGNAL(findElementRequired(const ElementsLocation &)), this, SIGNAL(findElementRequired(const ElementsLocation &))); + connect(diagram, SIGNAL(editElementRequired(const ElementsLocation &)), this, SIGNAL(editElementRequired(const ElementsLocation &))); // signale l'ajout du schema emit(diagramAdded(diagram)); diff --git a/sources/projectview.h b/sources/projectview.h index e0ac4addf..e000482eb 100644 --- a/sources/projectview.h +++ b/sources/projectview.h @@ -71,7 +71,9 @@ class ProjectView : public QWidget { void diagramActivated(DiagramView *); void diagramOrderChanged(ProjectView *, int, int); void projectClosed(ProjectView *); + // Pour relayer les signaux void findElementRequired(const ElementsLocation &); + void editElementRequired(const ElementsLocation &); private: void loadDiagrams(); diff --git a/sources/qetdiagrameditor.cpp b/sources/qetdiagrameditor.cpp index 7a8d067ed..3331d8e98 100644 --- a/sources/qetdiagrameditor.cpp +++ b/sources/qetdiagrameditor.cpp @@ -25,6 +25,7 @@ #include "projectview.h" #include "recentfiles.h" #include "qeticons.h" +#include "qetelementeditor.h" /** constructeur @@ -1236,7 +1237,10 @@ void QETDiagramEditor::addProjectView(ProjectView *project_view) { // gere les demandes consistant a retrouver un element dans le panel connect(project_view, SIGNAL(findElementRequired(const ElementsLocation &)), this, SLOT(findElementInPanel(const ElementsLocation &))); - + + // gere les demandes pour l'edition d'un element + connect(project_view, SIGNAL(editElementRequired(const ElementsLocation &)), this, SLOT(editElementInEditor(const ElementsLocation &))); + // affiche la fenetre if (maximise) project_view -> showMaximized(); else project_view -> show(); @@ -1700,6 +1704,18 @@ void QETDiagramEditor::findElementInPanel(const ElementsLocation &location) { } } + +/** + Lance l'editeur d'element pour l'element filename + @param location Emplacement de l'element a editer +*/ +void QETDiagramEditor::editElementInEditor(const ElementsLocation &location) { + QETElementEditor *editor = new QETElementEditor(); + editor -> fromLocation(location); + editor -> show(); +} + + /** @return Les proprietes par defaut pour le cartouche d'un schema */ diff --git a/sources/qetdiagrameditor.h b/sources/qetdiagrameditor.h index db65ba209..55dc5e372 100644 --- a/sources/qetdiagrameditor.h +++ b/sources/qetdiagrameditor.h @@ -144,6 +144,7 @@ class QETDiagramEditor : public QMainWindow { void diagramWasRemoved(DiagramView *); void diagramTitleChanged(DiagramView *); void findElementInPanel(const ElementsLocation &); + void editElementInEditor(const ElementsLocation &); // attributs public: