mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 20:50:34 +01:00
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
This commit is contained in:
@@ -627,6 +627,7 @@ void DiagramView::editElement(Element *element) {
|
|||||||
// titre et boutons du dialogue
|
// titre et boutons du dialogue
|
||||||
QString description_title = tr("Propri\351t\351s de l'\351l\351ment s\351lectionn\351");
|
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 *find_in_panel = new QPushButton(tr("Retrouver dans le panel"));
|
||||||
|
QPushButton *edit_element = new QPushButton(tr("Editer l'\351l\351ment"));
|
||||||
|
|
||||||
// dialogue en lui-meme
|
// dialogue en lui-meme
|
||||||
QMessageBox edit_element_dialog;
|
QMessageBox edit_element_dialog;
|
||||||
@@ -635,13 +636,21 @@ void DiagramView::editElement(Element *element) {
|
|||||||
edit_element_dialog.setText(description_title);
|
edit_element_dialog.setText(description_title);
|
||||||
edit_element_dialog.setInformativeText(description_string);
|
edit_element_dialog.setInformativeText(description_string);
|
||||||
edit_element_dialog.addButton(find_in_panel, QMessageBox::ApplyRole);
|
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.addButton(QMessageBox::Ok);
|
||||||
edit_element_dialog.setDefaultButton(QMessageBox::Ok);
|
edit_element_dialog.setDefaultButton(QMessageBox::Ok);
|
||||||
edit_element_dialog.exec();
|
edit_element_dialog.exec();
|
||||||
|
|
||||||
|
// Permet de trouver l'element dans la collection
|
||||||
if (edit_element_dialog.clickedButton() == find_in_panel) {
|
if (edit_element_dialog.clickedButton() == find_in_panel) {
|
||||||
emit(findElementRequired(custom_element -> location()));
|
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()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -93,6 +93,8 @@ class DiagramView : public QGraphicsView {
|
|||||||
void aboutToAddElement();
|
void aboutToAddElement();
|
||||||
/// Signal emis lorsque l'utilisateur souhaite retrouver un element du schema dans les collections
|
/// Signal emis lorsque l'utilisateur souhaite retrouver un element du schema dans les collections
|
||||||
void findElementRequired(const ElementsLocation &);
|
void findElementRequired(const ElementsLocation &);
|
||||||
|
/// Signal emis lorsque l'utilisateur souhaite editer un element du schema
|
||||||
|
void editElementRequired(const ElementsLocation &);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void selectNothing();
|
void selectNothing();
|
||||||
|
|||||||
@@ -300,6 +300,7 @@ void ProjectView::addDiagram(DiagramView *diagram) {
|
|||||||
rebuildDiagramsMap();
|
rebuildDiagramsMap();
|
||||||
connect(diagram, SIGNAL(titleChanged(DiagramView *, const QString &)), this, SLOT(updateTabTitle(DiagramView *, const QString &)));
|
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(findElementRequired(const ElementsLocation &)), this, SIGNAL(findElementRequired(const ElementsLocation &)));
|
||||||
|
connect(diagram, SIGNAL(editElementRequired(const ElementsLocation &)), this, SIGNAL(editElementRequired(const ElementsLocation &)));
|
||||||
|
|
||||||
// signale l'ajout du schema
|
// signale l'ajout du schema
|
||||||
emit(diagramAdded(diagram));
|
emit(diagramAdded(diagram));
|
||||||
|
|||||||
@@ -71,7 +71,9 @@ class ProjectView : public QWidget {
|
|||||||
void diagramActivated(DiagramView *);
|
void diagramActivated(DiagramView *);
|
||||||
void diagramOrderChanged(ProjectView *, int, int);
|
void diagramOrderChanged(ProjectView *, int, int);
|
||||||
void projectClosed(ProjectView *);
|
void projectClosed(ProjectView *);
|
||||||
|
// Pour relayer les signaux
|
||||||
void findElementRequired(const ElementsLocation &);
|
void findElementRequired(const ElementsLocation &);
|
||||||
|
void editElementRequired(const ElementsLocation &);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void loadDiagrams();
|
void loadDiagrams();
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
#include "projectview.h"
|
#include "projectview.h"
|
||||||
#include "recentfiles.h"
|
#include "recentfiles.h"
|
||||||
#include "qeticons.h"
|
#include "qeticons.h"
|
||||||
|
#include "qetelementeditor.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
constructeur
|
constructeur
|
||||||
@@ -1236,7 +1237,10 @@ void QETDiagramEditor::addProjectView(ProjectView *project_view) {
|
|||||||
|
|
||||||
// gere les demandes consistant a retrouver un element dans le panel
|
// gere les demandes consistant a retrouver un element dans le panel
|
||||||
connect(project_view, SIGNAL(findElementRequired(const ElementsLocation &)), this, SLOT(findElementInPanel(const ElementsLocation &)));
|
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
|
// affiche la fenetre
|
||||||
if (maximise) project_view -> showMaximized();
|
if (maximise) project_view -> showMaximized();
|
||||||
else project_view -> show();
|
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
|
@return Les proprietes par defaut pour le cartouche d'un schema
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -144,6 +144,7 @@ class QETDiagramEditor : public QMainWindow {
|
|||||||
void diagramWasRemoved(DiagramView *);
|
void diagramWasRemoved(DiagramView *);
|
||||||
void diagramTitleChanged(DiagramView *);
|
void diagramTitleChanged(DiagramView *);
|
||||||
void findElementInPanel(const ElementsLocation &);
|
void findElementInPanel(const ElementsLocation &);
|
||||||
|
void editElementInEditor(const ElementsLocation &);
|
||||||
|
|
||||||
// attributs
|
// attributs
|
||||||
public:
|
public:
|
||||||
|
|||||||
Reference in New Issue
Block a user