mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-21 16:50:53 +01:00
revamp and improve some code
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4214 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -477,22 +477,15 @@ void DiagramView::pasteHere() {
|
|||||||
Manage the events press click :
|
Manage the events press click :
|
||||||
* click to add an independent text field
|
* click to add an independent text field
|
||||||
*/
|
*/
|
||||||
void DiagramView::mousePressEvent(QMouseEvent *e) {
|
void DiagramView::mousePressEvent(QMouseEvent *e)
|
||||||
|
{
|
||||||
if (fresh_focus_in_) {
|
if (fresh_focus_in_)
|
||||||
|
{
|
||||||
switchToVisualisationModeIfNeeded(e);
|
switchToVisualisationModeIfNeeded(e);
|
||||||
fresh_focus_in_ = false;
|
fresh_focus_in_ = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_event_interface) {
|
if (m_event_interface && m_event_interface->mousePressEvent(e)) return;
|
||||||
if (m_event_interface -> mousePressEvent(e)) {
|
|
||||||
if (m_event_interface->isFinish()) {
|
|
||||||
emit (itemAdded());
|
|
||||||
delete m_event_interface; m_event_interface = nullptr;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Start drag view when hold the middle button
|
//Start drag view when hold the middle button
|
||||||
if (e->button() == Qt::MidButton)
|
if (e->button() == Qt::MidButton)
|
||||||
@@ -508,17 +501,9 @@ void DiagramView::mousePressEvent(QMouseEvent *e) {
|
|||||||
* @brief DiagramView::mouseMoveEvent
|
* @brief DiagramView::mouseMoveEvent
|
||||||
* Manage the event move mouse
|
* Manage the event move mouse
|
||||||
*/
|
*/
|
||||||
void DiagramView::mouseMoveEvent(QMouseEvent *e) {
|
void DiagramView::mouseMoveEvent(QMouseEvent *e)
|
||||||
|
{
|
||||||
if (m_event_interface) {
|
if (m_event_interface && m_event_interface->mouseMoveEvent(e)) return;
|
||||||
if (m_event_interface -> mouseMoveEvent(e)) {
|
|
||||||
if (m_event_interface->isFinish()) {
|
|
||||||
emit (itemAdded());
|
|
||||||
delete m_event_interface; m_event_interface = nullptr;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Drag the view
|
//Drag the view
|
||||||
if (e->buttons() == Qt::MidButton)
|
if (e->buttons() == Qt::MidButton)
|
||||||
@@ -538,17 +523,10 @@ void DiagramView::mouseMoveEvent(QMouseEvent *e) {
|
|||||||
* @brief DiagramView::mouseReleaseEvent
|
* @brief DiagramView::mouseReleaseEvent
|
||||||
* Manage event release click mouse
|
* Manage event release click mouse
|
||||||
*/
|
*/
|
||||||
void DiagramView::mouseReleaseEvent(QMouseEvent *e) {
|
void DiagramView::mouseReleaseEvent(QMouseEvent *e)
|
||||||
|
{
|
||||||
|
if (m_event_interface && m_event_interface->mouseReleaseEvent(e)) return;
|
||||||
|
|
||||||
if (m_event_interface) {
|
|
||||||
if (m_event_interface -> mouseReleaseEvent(e)) {
|
|
||||||
if (m_event_interface->isFinish()) {
|
|
||||||
emit (itemAdded());
|
|
||||||
delete m_event_interface; m_event_interface = nullptr;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//Stop drag view
|
//Stop drag view
|
||||||
if (e -> button() == Qt::MidButton) viewport()->setCursor(Qt::ArrowCursor);
|
if (e -> button() == Qt::MidButton) viewport()->setCursor(Qt::ArrowCursor);
|
||||||
|
|
||||||
@@ -569,16 +547,9 @@ bool DiagramView::gestures() const
|
|||||||
Manage wheel event of mouse
|
Manage wheel event of mouse
|
||||||
@param e QWheelEvent
|
@param e QWheelEvent
|
||||||
*/
|
*/
|
||||||
void DiagramView::wheelEvent(QWheelEvent *e) {
|
void DiagramView::wheelEvent(QWheelEvent *e)
|
||||||
if (m_event_interface) {
|
{
|
||||||
if (m_event_interface -> wheelEvent(e)) {
|
if (m_event_interface && m_event_interface->wheelEvent(e)) return;
|
||||||
if (m_event_interface->isFinish()) {
|
|
||||||
emit (itemAdded());
|
|
||||||
delete m_event_interface; m_event_interface = nullptr;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Zoom and scrolling
|
//Zoom and scrolling
|
||||||
if ( gestures() ) {
|
if ( gestures() ) {
|
||||||
@@ -633,15 +604,8 @@ void DiagramView::focusInEvent(QFocusEvent *e) {
|
|||||||
mode if needed.
|
mode if needed.
|
||||||
*/
|
*/
|
||||||
void DiagramView::keyPressEvent(QKeyEvent *e) {
|
void DiagramView::keyPressEvent(QKeyEvent *e) {
|
||||||
if (m_event_interface) {
|
if (m_event_interface && m_event_interface->keyPressEvent(e)) return;
|
||||||
if (m_event_interface -> keyPressEvent(e)) {
|
|
||||||
if (m_event_interface->isFinish()) {
|
|
||||||
emit (itemAdded());
|
|
||||||
delete m_event_interface; m_event_interface = nullptr;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
switchToVisualisationModeIfNeeded(e);
|
switchToVisualisationModeIfNeeded(e);
|
||||||
QGraphicsView::keyPressEvent(e);
|
QGraphicsView::keyPressEvent(e);
|
||||||
}
|
}
|
||||||
@@ -651,15 +615,8 @@ void DiagramView::keyPressEvent(QKeyEvent *e) {
|
|||||||
mode if needed.
|
mode if needed.
|
||||||
*/
|
*/
|
||||||
void DiagramView::keyReleaseEvent(QKeyEvent *e) {
|
void DiagramView::keyReleaseEvent(QKeyEvent *e) {
|
||||||
if (m_event_interface) {
|
if (m_event_interface && m_event_interface->KeyReleaseEvent(e)) return;
|
||||||
if (m_event_interface -> KeyReleaseEvent(e)) {
|
|
||||||
if (m_event_interface->isFinish()) {
|
|
||||||
emit (itemAdded());
|
|
||||||
delete m_event_interface; m_event_interface = nullptr;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
switchToSelectionModeIfNeeded(e);
|
switchToSelectionModeIfNeeded(e);
|
||||||
QGraphicsView::keyReleaseEvent(e);
|
QGraphicsView::keyReleaseEvent(e);
|
||||||
}
|
}
|
||||||
@@ -1083,10 +1040,14 @@ void DiagramView::editSelection() {
|
|||||||
/**
|
/**
|
||||||
* @brief DiagramView::setEventInterface
|
* @brief DiagramView::setEventInterface
|
||||||
* Set an event interface to diagram view.
|
* Set an event interface to diagram view.
|
||||||
|
* If diagram view already have an event interface, he delete it before.
|
||||||
|
* Diagram view take ownership of event interface and delete it when event interface is finish
|
||||||
*/
|
*/
|
||||||
void DiagramView::setEventInterface(DVEventInterface *event_interface) {
|
void DiagramView::setEventInterface(DVEventInterface *event_interface)
|
||||||
|
{
|
||||||
if (m_event_interface) delete m_event_interface;
|
if (m_event_interface) delete m_event_interface;
|
||||||
m_event_interface = event_interface;
|
m_event_interface = event_interface;
|
||||||
|
connect(m_event_interface, &DVEventInterface::finish, this, [=](){delete this->m_event_interface; this->m_event_interface = nullptr;}, Qt::QueuedConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1140,17 +1101,9 @@ QETDiagramEditor *DiagramView::diagramEditor() const {
|
|||||||
* @brief DiagramView::mouseDoubleClickEvent
|
* @brief DiagramView::mouseDoubleClickEvent
|
||||||
* @param e
|
* @param e
|
||||||
*/
|
*/
|
||||||
void DiagramView::mouseDoubleClickEvent(QMouseEvent *e) {
|
void DiagramView::mouseDoubleClickEvent(QMouseEvent *e)
|
||||||
|
{
|
||||||
if (m_event_interface) {
|
if (m_event_interface && m_event_interface -> mouseDoubleClickEvent(e)) return;
|
||||||
if (m_event_interface -> mouseDoubleClickEvent(e)) {
|
|
||||||
if (m_event_interface->isFinish()) {
|
|
||||||
emit (itemAdded());
|
|
||||||
delete m_event_interface; m_event_interface = nullptr;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
BorderTitleBlock &bi = scene -> border_and_titleblock;
|
BorderTitleBlock &bi = scene -> border_and_titleblock;
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,6 @@ class DiagramView : public QGraphicsView
|
|||||||
DVEventInterface *m_event_interface;
|
DVEventInterface *m_event_interface;
|
||||||
QMenu *context_menu;
|
QMenu *context_menu;
|
||||||
QAction *paste_here;
|
QAction *paste_here;
|
||||||
QAction *find_element_;
|
|
||||||
QPoint paste_here_pos;
|
QPoint paste_here_pos;
|
||||||
QPointF rubber_band_origin;
|
QPointF rubber_band_origin;
|
||||||
bool fresh_focus_in_; ///< Indicate the focus was freshly gained
|
bool fresh_focus_in_; ///< Indicate the focus was freshly gained
|
||||||
@@ -121,8 +120,6 @@ class DiagramView : public QGraphicsView
|
|||||||
void editElementRequired(const ElementsLocation &);
|
void editElementRequired(const ElementsLocation &);
|
||||||
/// Signal emitted when users want to edit and/or duplicate an existing title block template
|
/// Signal emitted when users want to edit and/or duplicate an existing title block template
|
||||||
void editTitleBlockTemplate(const QString &, bool);
|
void editTitleBlockTemplate(const QString &, bool);
|
||||||
/// Signal emitted after an item is added
|
|
||||||
void itemAdded();
|
|
||||||
/// Signal emmitted when diagram must be show
|
/// Signal emmitted when diagram must be show
|
||||||
void showDiagram (Diagram *);
|
void showDiagram (Diagram *);
|
||||||
|
|
||||||
|
|||||||
@@ -53,14 +53,17 @@ DVEventAddImage::~DVEventAddImage() {
|
|||||||
* @param event : event of mouse pressed
|
* @param event : event of mouse pressed
|
||||||
* @return : true if this event is managed, otherwise false
|
* @return : true if this event is managed, otherwise false
|
||||||
*/
|
*/
|
||||||
bool DVEventAddImage::mousePressEvent(QMouseEvent *event) {
|
bool DVEventAddImage::mousePressEvent(QMouseEvent *event)
|
||||||
if (m_image && event -> button() == Qt::LeftButton) {
|
{
|
||||||
|
if (m_image && event -> button() == Qt::LeftButton)
|
||||||
|
{
|
||||||
QPointF pos = m_dv -> mapToScene(event -> pos());
|
QPointF pos = m_dv -> mapToScene(event -> pos());
|
||||||
pos.rx() -= m_image->boundingRect().width()/2;
|
pos.rx() -= m_image->boundingRect().width()/2;
|
||||||
pos.ry() -= m_image->boundingRect().height()/2;
|
pos.ry() -= m_image->boundingRect().height()/2;
|
||||||
m_diagram -> undoStack().push (new AddItemCommand<DiagramImageItem *>(m_image, m_diagram, pos));
|
m_diagram -> undoStack().push (new AddItemCommand<DiagramImageItem *>(m_image, m_diagram, pos));
|
||||||
m_dv -> setContextMenuPolicy(Qt::DefaultContextMenu);
|
m_dv -> setContextMenuPolicy(Qt::DefaultContextMenu);
|
||||||
m_running = false;
|
m_running = false;
|
||||||
|
emit finish();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,8 @@ class DiagramImageItem;
|
|||||||
*/
|
*/
|
||||||
class DVEventAddImage : public DVEventInterface
|
class DVEventAddImage : public DVEventInterface
|
||||||
{
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DVEventAddImage(DiagramView *dv);
|
DVEventAddImage(DiagramView *dv);
|
||||||
virtual ~DVEventAddImage();
|
virtual ~DVEventAddImage();
|
||||||
|
|||||||
@@ -161,6 +161,7 @@ bool DVEventAddShape::mouseReleaseEvent(QMouseEvent *event)
|
|||||||
//Else (no shape), we set to false the running status
|
//Else (no shape), we set to false the running status
|
||||||
//for indicate to the owner of this event that everything is done
|
//for indicate to the owner of this event that everything is done
|
||||||
m_running = false;
|
m_running = false;
|
||||||
|
emit finish();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ class QMouseEvent;
|
|||||||
|
|
||||||
class DVEventAddShape : public DVEventInterface
|
class DVEventAddShape : public DVEventInterface
|
||||||
{
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DVEventAddShape(DiagramView *dv, QetShapeItem::ShapeType shape_type);
|
DVEventAddShape(DiagramView *dv, QetShapeItem::ShapeType shape_type);
|
||||||
virtual ~DVEventAddShape ();
|
virtual ~DVEventAddShape ();
|
||||||
|
|||||||
@@ -28,11 +28,15 @@ DVEventAddText::DVEventAddText(DiagramView *dv) :
|
|||||||
|
|
||||||
DVEventAddText::~DVEventAddText() {}
|
DVEventAddText::~DVEventAddText() {}
|
||||||
|
|
||||||
bool DVEventAddText::mousePressEvent(QMouseEvent *event) {
|
bool DVEventAddText::mousePressEvent(QMouseEvent *event)
|
||||||
if (event->button() == Qt::LeftButton) {
|
{
|
||||||
m_diagram -> undoStack().push(new AddItemCommand<IndependentTextItem *>(new IndependentTextItem("_"),
|
if (event->button() == Qt::LeftButton)
|
||||||
m_diagram,
|
{
|
||||||
m_dv -> mapToScene(event -> pos())));
|
IndependentTextItem *text = new IndependentTextItem();
|
||||||
|
m_diagram -> undoStack().push(new AddItemCommand<IndependentTextItem *>(text, m_diagram, m_dv -> mapToScene(event -> pos())));
|
||||||
|
text->setTextInteractionFlags(Qt::TextEditorInteraction);
|
||||||
|
text->setFocus(Qt::MouseFocusReason);
|
||||||
|
emit finish();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -22,6 +22,8 @@
|
|||||||
|
|
||||||
class DVEventAddText : public DVEventInterface
|
class DVEventAddText : public DVEventInterface
|
||||||
{
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DVEventAddText(DiagramView *dv);
|
DVEventAddText(DiagramView *dv);
|
||||||
virtual ~DVEventAddText ();
|
virtual ~DVEventAddText ();
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
|
|
||||||
DVEventInterface::DVEventInterface(DiagramView *dv) :
|
DVEventInterface::DVEventInterface(DiagramView *dv) :
|
||||||
|
QObject(dv),
|
||||||
m_dv(dv),
|
m_dv(dv),
|
||||||
m_diagram(dv->diagram()),
|
m_diagram(dv->diagram()),
|
||||||
m_running(false),
|
m_running(false),
|
||||||
@@ -57,14 +58,18 @@ bool DVEventInterface::wheelEvent(QWheelEvent *event) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief DVEventInterface::keyPressEvent
|
* @brief DVEventInterface::keyPressEvent
|
||||||
* By default, press escape key abort the curent action
|
* By default, press escape key abort the curent action.
|
||||||
|
* isFinish return true, and emit finish
|
||||||
* @param event
|
* @param event
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
bool DVEventInterface::keyPressEvent(QKeyEvent *event) {
|
bool DVEventInterface::keyPressEvent(QKeyEvent *event)
|
||||||
if (event->key() == Qt::Key_Escape) {
|
{
|
||||||
|
if (event->key() == Qt::Key_Escape)
|
||||||
|
{
|
||||||
m_running = false;
|
m_running = false;
|
||||||
m_abort = true;
|
m_abort = true;
|
||||||
|
emit finish();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -18,6 +18,8 @@
|
|||||||
#ifndef DVEVENTINTERFACE_H
|
#ifndef DVEVENTINTERFACE_H
|
||||||
#define DVEVENTINTERFACE_H
|
#define DVEVENTINTERFACE_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
|
||||||
class QMouseEvent;
|
class QMouseEvent;
|
||||||
class QWheelEvent;
|
class QWheelEvent;
|
||||||
class QKeyEvent;
|
class QKeyEvent;
|
||||||
@@ -33,8 +35,10 @@ class Diagram;
|
|||||||
* isRunning() return true if action is started but not finish. By default return false.
|
* isRunning() return true if action is started but not finish. By default return false.
|
||||||
* isFinish() return true when the action is finish, or not started. By default return true.
|
* isFinish() return true when the action is finish, or not started. By default return true.
|
||||||
*/
|
*/
|
||||||
class DVEventInterface
|
class DVEventInterface : public QObject
|
||||||
{
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DVEventInterface(DiagramView *dv);
|
DVEventInterface(DiagramView *dv);
|
||||||
virtual ~DVEventInterface () = 0;
|
virtual ~DVEventInterface () = 0;
|
||||||
@@ -48,6 +52,13 @@ class DVEventInterface
|
|||||||
virtual bool isRunning () const;
|
virtual bool isRunning () const;
|
||||||
virtual bool isFinish () const;
|
virtual bool isFinish () const;
|
||||||
|
|
||||||
|
signals:
|
||||||
|
/**
|
||||||
|
* @brief finish
|
||||||
|
* emited when the interface finish is work
|
||||||
|
*/
|
||||||
|
void finish();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
DiagramView *m_dv;
|
DiagramView *m_dv;
|
||||||
Diagram *m_diagram;
|
Diagram *m_diagram;
|
||||||
|
|||||||
@@ -192,14 +192,38 @@ void QETDiagramEditor::setUpActions()
|
|||||||
print = new QAction(QET::Icons::DocumentPrint, tr("Imprimer"), this);
|
print = new QAction(QET::Icons::DocumentPrint, tr("Imprimer"), this);
|
||||||
quit_editor = new QAction(QET::Icons::ApplicationExit, tr("&Quitter"), this);
|
quit_editor = new QAction(QET::Icons::ApplicationExit, tr("&Quitter"), this);
|
||||||
|
|
||||||
|
//Undo redo
|
||||||
undo = undo_group.createUndoAction(this, tr("Annuler"));
|
undo = undo_group.createUndoAction(this, tr("Annuler"));
|
||||||
undo -> setIcon(QET::Icons::EditUndo);
|
|
||||||
redo = undo_group.createRedoAction(this, tr("Refaire"));
|
redo = undo_group.createRedoAction(this, tr("Refaire"));
|
||||||
|
|
||||||
|
undo -> setIcon(QET::Icons::EditUndo);
|
||||||
redo -> setIcon(QET::Icons::EditRedo);
|
redo -> setIcon(QET::Icons::EditRedo);
|
||||||
cut = new QAction(QET::Icons::EditCut, tr("Co&uper"), this);
|
|
||||||
copy = new QAction(QET::Icons::EditCopy, tr("Cop&ier"), this);
|
undo -> setShortcut(QKeySequence::Undo);
|
||||||
paste = new QAction(QET::Icons::EditPaste, tr("C&oller"), this);
|
redo -> setShortcut(QKeySequence::Redo);
|
||||||
|
|
||||||
|
undo -> setStatusTip(tr("Annule l'action précédente", "status bar tip"));
|
||||||
|
redo -> setStatusTip(tr("Restaure l'action annulée", "status bar tip"));
|
||||||
|
|
||||||
|
//cut copy past action
|
||||||
|
cut = new QAction(QET::Icons::EditCut, tr("Co&uper"), this);
|
||||||
|
copy = new QAction(QET::Icons::EditCopy, tr("Cop&ier"), this);
|
||||||
|
paste = new QAction(QET::Icons::EditPaste, tr("C&oller"), this);
|
||||||
|
|
||||||
|
cut -> setShortcut(QKeySequence::Cut);
|
||||||
|
copy -> setShortcut(QKeySequence::Copy);
|
||||||
|
paste -> setShortcut(QKeySequence::Paste);
|
||||||
|
|
||||||
|
cut -> setStatusTip(tr("Transfère les éléments sélectionnés dans le presse-papier", "status bar tip"));
|
||||||
|
copy -> setStatusTip(tr("Copie les éléments sélectionnés dans le presse-papier", "status bar tip"));
|
||||||
|
paste -> setStatusTip(tr("Place les éléments du presse-papier sur le folio", "status bar tip"));
|
||||||
|
|
||||||
|
connect(cut, SIGNAL(triggered()), this, SLOT(slot_cut()));
|
||||||
|
connect(copy, SIGNAL(triggered()), this, SLOT(slot_copy()));
|
||||||
|
connect(paste, SIGNAL(triggered()), this, SLOT(slot_paste()));
|
||||||
|
|
||||||
conductor_reset = new QAction(QET::Icons::ConductorSettings, tr("Réinitialiser les conducteurs"), this);
|
conductor_reset = new QAction(QET::Icons::ConductorSettings, tr("Réinitialiser les conducteurs"), this);
|
||||||
|
conductor_reset -> setShortcut( QKeySequence( tr("Ctrl+K") ) );
|
||||||
|
|
||||||
m_auto_conductor = new QAction (QET::Icons::Autoconnect, tr("Création automatique de conducteur(s)","Tool tip of auto conductor"), this);
|
m_auto_conductor = new QAction (QET::Icons::Autoconnect, tr("Création automatique de conducteur(s)","Tool tip of auto conductor"), this);
|
||||||
m_auto_conductor -> setStatusTip (tr("Utiliser la création automatique de conducteur(s) quand cela est possible", "Status tip of auto conductor"));
|
m_auto_conductor -> setStatusTip (tr("Utiliser la création automatique de conducteur(s) quand cela est possible", "Status tip of auto conductor"));
|
||||||
@@ -216,6 +240,7 @@ void QETDiagramEditor::setUpActions()
|
|||||||
});
|
});
|
||||||
|
|
||||||
infos_diagram = new QAction(QET::Icons::DialogInformation, tr("Propriétés du folio"), this);
|
infos_diagram = new QAction(QET::Icons::DialogInformation, tr("Propriétés du folio"), this);
|
||||||
|
infos_diagram -> setShortcut( QKeySequence( tr("Ctrl+L") ) );
|
||||||
prj_edit_prop = new QAction(QET::Icons::DialogInformation, tr("Propriétés du projet"), this);
|
prj_edit_prop = new QAction(QET::Icons::DialogInformation, tr("Propriétés du projet"), this);
|
||||||
prj_add_diagram = new QAction(QET::Icons::DiagramAdd, tr("Ajouter un folio"), this);
|
prj_add_diagram = new QAction(QET::Icons::DiagramAdd, tr("Ajouter un folio"), this);
|
||||||
prj_del_diagram = new QAction(QET::Icons::DiagramDelete, tr("Supprimer le folio"), this);
|
prj_del_diagram = new QAction(QET::Icons::DiagramDelete, tr("Supprimer le folio"), this);
|
||||||
@@ -231,7 +256,7 @@ void QETDiagramEditor::setUpActions()
|
|||||||
next_window = new QAction( tr("Projet suivant"), this);
|
next_window = new QAction( tr("Projet suivant"), this);
|
||||||
prev_window = new QAction( tr("Projet précédent"), this);
|
prev_window = new QAction( tr("Projet précédent"), this);
|
||||||
|
|
||||||
///Files action///
|
//Files action
|
||||||
QAction *new_file = m_file_actions_group.addAction( QET::Icons::ProjectNew, tr("&Nouveau") );
|
QAction *new_file = m_file_actions_group.addAction( QET::Icons::ProjectNew, tr("&Nouveau") );
|
||||||
QAction *open_file = m_file_actions_group.addAction( QET::Icons::DocumentOpen, tr("&Ouvrir") );
|
QAction *open_file = m_file_actions_group.addAction( QET::Icons::DocumentOpen, tr("&Ouvrir") );
|
||||||
save_file = m_file_actions_group.addAction( QET::Icons::DocumentSave, tr("&Enregistrer") );
|
save_file = m_file_actions_group.addAction( QET::Icons::DocumentSave, tr("&Enregistrer") );
|
||||||
@@ -255,75 +280,74 @@ void QETDiagramEditor::setUpActions()
|
|||||||
connect(open_file, SIGNAL( triggered() ), this, SLOT( openProject() ) );
|
connect(open_file, SIGNAL( triggered() ), this, SLOT( openProject() ) );
|
||||||
connect(close_file, SIGNAL( triggered() ), this, SLOT( closeCurrentProject() ) );
|
connect(close_file, SIGNAL( triggered() ), this, SLOT( closeCurrentProject() ) );
|
||||||
|
|
||||||
///Row Column action///
|
//Row and Column actions
|
||||||
QAction *add_column = m_row_column_actions_group.addAction( QET::Icons::EditTableInsertColumnRight, tr("Ajouter une colonne") );
|
QAction *add_column = m_row_column_actions_group.addAction( QET::Icons::EditTableInsertColumnRight, tr("Ajouter une colonne") );
|
||||||
QAction *remove_column = m_row_column_actions_group.addAction( QET::Icons::EditTableDeleteColumn, tr("Enlever une colonne") );
|
QAction *remove_column = m_row_column_actions_group.addAction( QET::Icons::EditTableDeleteColumn, tr("Enlever une colonne") );
|
||||||
QAction *add_row = m_row_column_actions_group.addAction( QET::Icons::EditTableInsertRowUnder, tr("Ajouter une ligne") );
|
QAction *add_row = m_row_column_actions_group.addAction( QET::Icons::EditTableInsertRowUnder, tr("Ajouter une ligne") );
|
||||||
QAction *remove_row = m_row_column_actions_group.addAction( QET::Icons::EditTableDeleteRow, tr("Enlever une ligne") );
|
QAction *remove_row = m_row_column_actions_group.addAction( QET::Icons::EditTableDeleteRow, tr("Enlever une ligne") );
|
||||||
|
|
||||||
add_column -> setStatusTip( tr("Ajoute une colonne au folio", "status bar tip") );
|
add_column -> setStatusTip( tr("Ajoute une colonne au folio", "status bar tip"));
|
||||||
remove_column -> setStatusTip( tr("Enlève une colonne au folio", "status bar tip") );
|
remove_column -> setStatusTip( tr("Enlève une colonne au folio", "status bar tip"));
|
||||||
add_row -> setStatusTip( tr("Agrandit le folio en hauteur", "status bar tip") );
|
add_row -> setStatusTip( tr("Agrandit le folio en hauteur", "status bar tip"));
|
||||||
remove_row -> setStatusTip( tr("Rétrécit le folio en hauteur", "status bar tip") );
|
remove_row -> setStatusTip( tr("Rétrécit le folio en hauteur", "status bar tip"));
|
||||||
|
|
||||||
connect(add_column, SIGNAL( triggered() ), this, SLOT( slot_addColumn() ) );
|
add_column ->setData("add_column");
|
||||||
connect(remove_column, SIGNAL( triggered() ), this, SLOT( slot_removeColumn() ) );
|
remove_column->setData("remove_column");
|
||||||
connect(add_row, SIGNAL( triggered() ), this, SLOT( slot_addRow() ) );
|
add_row ->setData("add_row");
|
||||||
connect(remove_row, SIGNAL( triggered() ), this, SLOT( slot_removeRow() ) );
|
remove_row ->setData("remove_row");
|
||||||
|
|
||||||
///Selections Actions (related to a selected item)///
|
connect(&m_row_column_actions_group, &QActionGroup::triggered, this, &QETDiagramEditor::rowColumnGroupTriggered);
|
||||||
|
|
||||||
|
//Selections Actions (related to a selected item)
|
||||||
delete_selection = m_selection_actions_group.addAction( QET::Icons::EditDelete, tr("Supprimer") );
|
delete_selection = m_selection_actions_group.addAction( QET::Icons::EditDelete, tr("Supprimer") );
|
||||||
rotate_selection = m_selection_actions_group.addAction( QET::Icons::ObjectRotateRight, tr("Pivoter") );
|
rotate_selection = m_selection_actions_group.addAction( QET::Icons::ObjectRotateRight, tr("Pivoter") );
|
||||||
rotate_texts = m_selection_actions_group.addAction( QET::Icons::ObjectRotateRight, tr("Orienter les textes") );
|
rotate_texts = m_selection_actions_group.addAction( QET::Icons::ObjectRotateRight, tr("Orienter les textes") );
|
||||||
find_element = m_selection_actions_group.addAction( tr("Retrouver dans le panel") );
|
find_element = m_selection_actions_group.addAction( tr("Retrouver dans le panel") );
|
||||||
edit_selection = m_selection_actions_group.addAction( QET::Icons::ElementEdit, tr("Éditer l'item sélectionné") );
|
edit_selection = m_selection_actions_group.addAction( QET::Icons::ElementEdit, tr("Éditer l'item sélectionné") );
|
||||||
|
|
||||||
#ifndef Q_OS_MAC
|
delete_selection -> setShortcut( QKeySequence::Delete);
|
||||||
delete_selection -> setShortcut( QKeySequence( Qt::Key_Delete) );
|
|
||||||
#else
|
|
||||||
delete_selection -> setShortcut( QKeySequence( tr("Backspace") ) );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
rotate_selection -> setShortcut( QKeySequence( tr("Space") ) );
|
rotate_selection -> setShortcut( QKeySequence( tr("Space") ) );
|
||||||
rotate_texts -> setShortcut( QKeySequence( tr("Ctrl+Space") ) );
|
rotate_texts -> setShortcut( QKeySequence( tr("Ctrl+Space") ) );
|
||||||
conductor_reset -> setShortcut( QKeySequence( tr("Ctrl+K") ) );
|
|
||||||
infos_diagram -> setShortcut( QKeySequence( tr("Ctrl+L") ) );
|
|
||||||
edit_selection -> setShortcut( QKeySequence( tr("Ctrl+E") ) );
|
edit_selection -> setShortcut( QKeySequence( tr("Ctrl+E") ) );
|
||||||
|
|
||||||
delete_selection -> setStatusTip( tr("Enlève les éléments sélectionnés du folio", "status bar tip") );
|
delete_selection -> setStatusTip( tr("Enlève les éléments sélectionnés du folio", "status bar tip"));
|
||||||
rotate_selection -> setStatusTip( tr("Pivote les éléments et textes sélectionnés", "status bar tip") );
|
rotate_selection -> setStatusTip( tr("Pivote les éléments et textes sélectionnés", "status bar tip"));
|
||||||
rotate_texts -> setStatusTip( tr("Pivote les textes sélectionnés à un angle précis", "status bar tip") );
|
rotate_texts -> setStatusTip( tr("Pivote les textes sélectionnés à un angle précis", "status bar tip"));
|
||||||
find_element -> setStatusTip( tr("Retrouve l'élément sélectionné dans le panel", "status bar tip") );
|
find_element -> setStatusTip( tr("Retrouve l'élément sélectionné dans le panel", "status bar tip"));
|
||||||
|
|
||||||
connect(delete_selection, SIGNAL( triggered() ), this, SLOT( slot_delete() ) );
|
delete_selection ->setData("delete_selection");
|
||||||
connect(rotate_selection, SIGNAL( triggered() ), this, SLOT( slot_rotate() ) );
|
rotate_selection ->setData("rotate_selection");
|
||||||
connect(rotate_texts, SIGNAL( triggered() ), this, SLOT( slot_rotateTexts() ) );
|
rotate_texts ->setData("rotate_selected_text");
|
||||||
connect(find_element, SIGNAL( triggered() ), this, SLOT( findSelectedElementInPanel() ) );
|
find_element ->setData("find_selected_element");
|
||||||
connect(edit_selection, SIGNAL( triggered() ), this, SLOT( slot_editSelection() ) );
|
edit_selection ->setData("edit_selected_element");
|
||||||
|
|
||||||
///Select Action///
|
connect(&m_selection_actions_group, &QActionGroup::triggered, this, &QETDiagramEditor::selectionGroupTriggered);
|
||||||
|
|
||||||
|
//Select Action
|
||||||
QAction *select_all = m_select_actions_group.addAction( QET::Icons::EditSelectAll, tr("Tout sélectionner") );
|
QAction *select_all = m_select_actions_group.addAction( QET::Icons::EditSelectAll, tr("Tout sélectionner") );
|
||||||
QAction *select_nothing = m_select_actions_group.addAction( tr("Désélectionner tout") );
|
QAction *select_nothing = m_select_actions_group.addAction( tr("Désélectionner tout") );
|
||||||
QAction *select_invert = m_select_actions_group.addAction( tr("Inverser la sélection") );
|
QAction *select_invert = m_select_actions_group.addAction( tr("Inverser la sélection") );
|
||||||
|
|
||||||
select_all -> setShortcut( QKeySequence::SelectAll );
|
select_all -> setShortcut(QKeySequence::SelectAll);
|
||||||
select_nothing -> setShortcut( QKeySequence( tr("Ctrl+Shift+A") ) );
|
select_nothing -> setShortcut(QKeySequence::Deselect);
|
||||||
select_invert -> setShortcut( QKeySequence( tr("Ctrl+I") ) );
|
select_invert -> setShortcut(QKeySequence( tr("Ctrl+I")));
|
||||||
|
|
||||||
select_all -> setStatusTip( tr("Sélectionne tous les éléments du folio", "status bar tip") );
|
select_all -> setStatusTip( tr("Sélectionne tous les éléments du folio", "status bar tip") );
|
||||||
select_nothing -> setStatusTip( tr("Désélectionne tous les éléments du folio", "status bar tip") );
|
select_nothing -> setStatusTip( tr("Désélectionne tous les éléments du folio", "status bar tip") );
|
||||||
select_invert -> setStatusTip( tr("Désélectionne les éléments sélectionnés et sélectionne les éléments non sélectionnés", "status bar tip") );
|
select_invert -> setStatusTip( tr("Désélectionne les éléments sélectionnés et sélectionne les éléments non sélectionnés", "status bar tip") );
|
||||||
|
|
||||||
connect(select_all, SIGNAL( triggered() ), this, SLOT( slot_selectAll() ) );
|
select_all -> setData("select_all");
|
||||||
connect(select_nothing, SIGNAL( triggered() ), this, SLOT( slot_selectNothing() ) );
|
select_nothing -> setData("deselect");
|
||||||
connect(select_invert, SIGNAL( triggered() ), this, SLOT( slot_selectInvert() ) );
|
select_invert -> setData("invert_selection");
|
||||||
|
|
||||||
///Zoom actions///
|
connect(&m_select_actions_group, &QActionGroup::triggered, this, &QETDiagramEditor::selectGroupTriggered);
|
||||||
QAction *zoom_in = m_zoom_actions_group.addAction( QET::Icons::ZoomIn, tr("Zoom avant") );
|
|
||||||
QAction *zoom_out = m_zoom_actions_group.addAction( QET::Icons::ZoomOut, tr("Zoom arrière") );
|
//Zoom actions
|
||||||
QAction *zoom_content = m_zoom_actions_group.addAction( QET::Icons::ZoomDraw, tr("Zoom sur le contenu") );
|
QAction *zoom_in = m_zoom_actions_group.addAction( QET::Icons::ZoomIn, tr("Zoom avant"));
|
||||||
QAction *zoom_fit = m_zoom_actions_group.addAction( QET::Icons::ZoomFitBest, tr("Zoom adapté") );
|
QAction *zoom_out = m_zoom_actions_group.addAction( QET::Icons::ZoomOut, tr("Zoom arrière"));
|
||||||
QAction *zoom_reset = m_zoom_actions_group.addAction( QET::Icons::ZoomOriginal, tr("Pas de zoom") );
|
QAction *zoom_content = m_zoom_actions_group.addAction( QET::Icons::ZoomDraw, tr("Zoom sur le contenu"));
|
||||||
|
QAction *zoom_fit = m_zoom_actions_group.addAction( QET::Icons::ZoomFitBest, tr("Zoom adapté"));
|
||||||
|
QAction *zoom_reset = m_zoom_actions_group.addAction( QET::Icons::ZoomOriginal, tr("Pas de zoom"));
|
||||||
m_zoom_action_toolBar << zoom_content << zoom_fit << zoom_reset;
|
m_zoom_action_toolBar << zoom_content << zoom_fit << zoom_reset;
|
||||||
|
|
||||||
zoom_in -> setShortcut( QKeySequence::ZoomIn );
|
zoom_in -> setShortcut( QKeySequence::ZoomIn );
|
||||||
@@ -338,40 +362,37 @@ void QETDiagramEditor::setUpActions()
|
|||||||
zoom_fit -> setStatusTip(tr("Adapte le zoom exactement sur le cadre du folio", "status bar tip"));
|
zoom_fit -> setStatusTip(tr("Adapte le zoom exactement sur le cadre du folio", "status bar tip"));
|
||||||
zoom_reset -> setStatusTip(tr("Restaure le zoom par défaut", "status bar tip"));
|
zoom_reset -> setStatusTip(tr("Restaure le zoom par défaut", "status bar tip"));
|
||||||
|
|
||||||
connect( zoom_in, SIGNAL( triggered() ), this, SLOT( slot_zoomIn() ) );
|
zoom_in ->setData("zoom_in");
|
||||||
connect( zoom_out, SIGNAL( triggered() ), this, SLOT( slot_zoomOut() ) );
|
zoom_out ->setData("zoom_out");
|
||||||
connect( zoom_content, SIGNAL( triggered() ), this, SLOT( slot_zoomContent() ) );
|
zoom_content->setData("zoom_content");
|
||||||
connect( zoom_fit, SIGNAL( triggered() ), this, SLOT( slot_zoomFit() ) );
|
zoom_fit ->setData("zoom_fit");
|
||||||
connect( zoom_reset, SIGNAL( triggered() ), this, SLOT( slot_zoomReset() ) );
|
zoom_reset ->setData("zoom_reset");
|
||||||
|
|
||||||
///Adding action (add text, image, shape...)///
|
connect(&m_zoom_actions_group, &QActionGroup::triggered, this, &QETDiagramEditor::zoomGroupTriggered);
|
||||||
m_add_item_actions_group.setExclusive(true);
|
|
||||||
|
|
||||||
QAction *add_text = m_add_item_actions_group.addAction( QET::Icons::PartTextField, tr("Ajouter un champ de texte") );
|
//Adding action (add text, image, shape...)
|
||||||
QAction *add_image = m_add_item_actions_group.addAction( QET::Icons::adding_image, tr("Ajouter une image") );
|
QAction *add_text = m_add_item_actions_group.addAction(QET::Icons::PartTextField, tr("Ajouter un champ de texte"));
|
||||||
QAction *add_line = m_add_item_actions_group.addAction( QET::Icons::PartLine, tr("Ajouter une ligne droite") );
|
QAction *add_image = m_add_item_actions_group.addAction(QET::Icons::adding_image, tr("Ajouter une image"));
|
||||||
QAction *add_rectangle = m_add_item_actions_group.addAction( QET::Icons::PartRectangle, tr("Ajouter un rectangle") );
|
QAction *add_line = m_add_item_actions_group.addAction(QET::Icons::PartLine, tr("Ajouter une ligne"));
|
||||||
QAction *add_ellipse = m_add_item_actions_group.addAction( QET::Icons::PartEllipse, tr("Ajouter une ellipse") );
|
QAction *add_rectangle = m_add_item_actions_group.addAction(QET::Icons::PartRectangle, tr("Ajouter un rectangle"));
|
||||||
QAction *add_polyline = m_add_item_actions_group.addAction( QET::Icons::PartPolygon, tr("Ajouter une polyligne") );
|
QAction *add_ellipse = m_add_item_actions_group.addAction(QET::Icons::PartEllipse, tr("Ajouter une ellipse"));
|
||||||
|
QAction *add_polyline = m_add_item_actions_group.addAction(QET::Icons::PartPolygon, tr("Ajouter une polyligne"));
|
||||||
|
|
||||||
connect( add_text, SIGNAL( triggered() ), this, SLOT( slot_addText() ) );
|
add_text ->setData("text");
|
||||||
connect( add_image, SIGNAL( triggered() ), this, SLOT( slot_addImage() ) );
|
add_image ->setData("image");
|
||||||
connect( add_line, SIGNAL( triggered() ), this, SLOT( slot_addLine() ) );
|
add_line ->setData("line");
|
||||||
connect( add_rectangle, SIGNAL( triggered() ), this, SLOT( slot_addRectangle() ) );
|
add_rectangle->setData("rectangle");
|
||||||
connect( add_ellipse, SIGNAL( triggered() ), this, SLOT( slot_addEllipse() ) );
|
add_ellipse ->setData("ellipse");
|
||||||
connect( add_polyline, SIGNAL( triggered() ), this, SLOT( slot_addPolyline() ) );
|
add_polyline ->setData("polyline");
|
||||||
|
|
||||||
foreach(QAction *action, m_add_item_actions_group.actions()) action->setCheckable(true);
|
foreach (QAction *action, m_add_item_actions_group.actions()) action->setCheckable(true);
|
||||||
|
connect(&m_add_item_actions_group, &QActionGroup::triggered, this, &QETDiagramEditor::addItemGroupTriggered);
|
||||||
|
|
||||||
///Keyboard shortcut
|
//Keyboard shortcut
|
||||||
export_diagram -> setShortcut(QKeySequence(tr("Ctrl+Shift+X")));
|
export_diagram -> setShortcut(QKeySequence(tr("Ctrl+Shift+X")));
|
||||||
print -> setShortcut(QKeySequence(QKeySequence::Print));
|
print -> setShortcut(QKeySequence(QKeySequence::Print));
|
||||||
quit_editor -> setShortcut(QKeySequence(tr("Ctrl+Q")));
|
quit_editor -> setShortcut(QKeySequence(tr("Ctrl+Q")));
|
||||||
undo -> setShortcut(QKeySequence::Undo);
|
|
||||||
redo -> setShortcut(QKeySequence::Redo);
|
|
||||||
cut -> setShortcut(QKeySequence::Cut);
|
|
||||||
copy -> setShortcut(QKeySequence::Copy);
|
|
||||||
paste -> setShortcut(QKeySequence::Paste);
|
|
||||||
|
|
||||||
prj_add_diagram -> setShortcut(QKeySequence(tr("Ctrl+T")));
|
prj_add_diagram -> setShortcut(QKeySequence(tr("Ctrl+T")));
|
||||||
|
|
||||||
@@ -382,11 +403,6 @@ void QETDiagramEditor::setUpActions()
|
|||||||
export_diagram -> setStatusTip(tr("Exporte le folio courant dans un autre format", "status bar tip"));
|
export_diagram -> setStatusTip(tr("Exporte le folio courant dans un autre format", "status bar tip"));
|
||||||
print -> setStatusTip(tr("Imprime un ou plusieurs folios du projet courant", "status bar tip"));
|
print -> setStatusTip(tr("Imprime un ou plusieurs folios du projet courant", "status bar tip"));
|
||||||
quit_editor -> setStatusTip(tr("Ferme l'application QElectroTech", "status bar tip"));
|
quit_editor -> setStatusTip(tr("Ferme l'application QElectroTech", "status bar tip"));
|
||||||
undo -> setStatusTip(tr("Annule l'action précédente", "status bar tip"));
|
|
||||||
redo -> setStatusTip(tr("Restaure l'action annulée", "status bar tip"));
|
|
||||||
cut -> setStatusTip(tr("Transfère les éléments sélectionnés dans le presse-papier", "status bar tip"));
|
|
||||||
copy -> setStatusTip(tr("Copie les éléments sélectionnés dans le presse-papier", "status bar tip"));
|
|
||||||
paste -> setStatusTip(tr("Place les éléments du presse-papier sur le folio", "status bar tip"));
|
|
||||||
conductor_reset -> setStatusTip(tr("Recalcule les chemins des conducteurs sans tenir compte des modifications", "status bar tip"));
|
conductor_reset -> setStatusTip(tr("Recalcule les chemins des conducteurs sans tenir compte des modifications", "status bar tip"));
|
||||||
infos_diagram -> setStatusTip(tr("Édite les propriétés du folio (dimensions, informations du cartouche, propriétés des conducteurs...)", "status bar tip"));
|
infos_diagram -> setStatusTip(tr("Édite les propriétés du folio (dimensions, informations du cartouche, propriétés des conducteurs...)", "status bar tip"));
|
||||||
|
|
||||||
@@ -433,9 +449,6 @@ void QETDiagramEditor::setUpActions()
|
|||||||
connect(prj_nomenclature, SIGNAL(triggered()), this, SLOT(nomenclatureProject()) );
|
connect(prj_nomenclature, SIGNAL(triggered()), this, SLOT(nomenclatureProject()) );
|
||||||
connect(print, SIGNAL(triggered()), this, SLOT(printDialog()) );
|
connect(print, SIGNAL(triggered()), this, SLOT(printDialog()) );
|
||||||
connect(export_diagram, SIGNAL(triggered()), this, SLOT(exportDialog()) );
|
connect(export_diagram, SIGNAL(triggered()), this, SLOT(exportDialog()) );
|
||||||
connect(cut, SIGNAL(triggered()), this, SLOT(slot_cut()) );
|
|
||||||
connect(copy, SIGNAL(triggered()), this, SLOT(slot_copy()) );
|
|
||||||
connect(paste, SIGNAL(triggered()), this, SLOT(slot_paste()) );
|
|
||||||
connect(tile_window, SIGNAL(triggered()), &workspace, SLOT(tileSubWindows()) );
|
connect(tile_window, SIGNAL(triggered()), &workspace, SLOT(tileSubWindows()) );
|
||||||
connect(cascade_window, SIGNAL(triggered()), &workspace, SLOT(cascadeSubWindows()) );
|
connect(cascade_window, SIGNAL(triggered()), &workspace, SLOT(cascadeSubWindows()) );
|
||||||
connect(next_window, SIGNAL(triggered()), &workspace, SLOT(activateNextSubWindow()) );
|
connect(next_window, SIGNAL(triggered()), &workspace, SLOT(activateNextSubWindow()) );
|
||||||
@@ -1077,81 +1090,129 @@ void QETDiagramEditor::slot_paste() {
|
|||||||
if(currentDiagram()) currentDiagram() -> paste();
|
if(currentDiagram()) currentDiagram() -> paste();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
void QETDiagramEditor::zoomGroupTriggered(QAction *action)
|
||||||
Effectue l'action "zoom avant" sur le diagram en cours
|
{
|
||||||
*/
|
QString value = action->data().toString();
|
||||||
void QETDiagramEditor::slot_zoomIn() {
|
DiagramView *dv = currentDiagram();
|
||||||
if(currentDiagram()) currentDiagram() -> zoomIn();
|
|
||||||
|
if (!dv || value.isEmpty()) return;
|
||||||
|
|
||||||
|
if (value == "zoom_in")
|
||||||
|
dv->zoomIn();
|
||||||
|
else if (value == "zoom_out")
|
||||||
|
dv->zoomOut();
|
||||||
|
else if (value == "zoom_content")
|
||||||
|
dv->zoomContent();
|
||||||
|
else if (value == "zoom_fit")
|
||||||
|
dv->zoomFit();
|
||||||
|
else if (value == "zoom_reset")
|
||||||
|
dv->zoomReset();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Effectue l'action "zoom arriere" sur le schema en cours
|
* @brief QETDiagramEditor::selectGroupTriggered
|
||||||
*/
|
* This slot is called when selection need to change.
|
||||||
void QETDiagramEditor::slot_zoomOut() {
|
* @param action : Action that describes what to do.
|
||||||
if(currentDiagram()) currentDiagram() -> zoomOut();
|
*/
|
||||||
|
void QETDiagramEditor::selectGroupTriggered(QAction *action)
|
||||||
|
{
|
||||||
|
QString value = action->data().toString();
|
||||||
|
DiagramView *dv = currentDiagram();
|
||||||
|
|
||||||
|
if (!dv || value.isEmpty()) return;
|
||||||
|
|
||||||
|
if (value == "select_all")
|
||||||
|
dv->selectAll();
|
||||||
|
else if (value == "deselect")
|
||||||
|
dv->selectNothing();
|
||||||
|
else if (value == "invert_selection")
|
||||||
|
dv->selectInvert();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Effectue l'action "zoom arriere" sur le diagram en cours
|
* @brief QETDiagramEditor::addItemGroupTriggered
|
||||||
*/
|
* This slot is called when an item must be added to the curent diagram,
|
||||||
void QETDiagramEditor::slot_zoomFit() {
|
* this slot use the DVEventInterface to add item
|
||||||
if(currentDiagram()) currentDiagram() -> zoomFit();
|
* @param action : Action that describe the item to add.
|
||||||
|
*/
|
||||||
|
void QETDiagramEditor::addItemGroupTriggered(QAction *action)
|
||||||
|
{
|
||||||
|
QString value = action->data().toString();
|
||||||
|
DiagramView *dv = currentDiagram();
|
||||||
|
|
||||||
|
if (!dv || value.isEmpty()) return;
|
||||||
|
|
||||||
|
DVEventInterface *dvevent = nullptr;
|
||||||
|
|
||||||
|
if (value == "text")
|
||||||
|
dvevent = new DVEventAddText(dv);
|
||||||
|
else if (value == "image")
|
||||||
|
{
|
||||||
|
DVEventAddImage *event = new DVEventAddImage(dv);
|
||||||
|
if (event -> isNull())
|
||||||
|
{
|
||||||
|
delete event;
|
||||||
|
action->setChecked(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
dvevent = event;
|
||||||
|
}
|
||||||
|
else if (value == "line")
|
||||||
|
dvevent = new DVEventAddShape(dv, QetShapeItem::Line);
|
||||||
|
else if (value == "rectangle")
|
||||||
|
dvevent = new DVEventAddShape(dv, QetShapeItem::Rectangle);
|
||||||
|
else if (value == "ellipse")
|
||||||
|
dvevent = new DVEventAddShape(dv, QetShapeItem::Ellipse);
|
||||||
|
else if (value == "polyline")
|
||||||
|
dvevent = new DVEventAddShape(dv, QetShapeItem::Polygon);
|
||||||
|
|
||||||
|
if (dvevent)
|
||||||
|
{
|
||||||
|
dv->setEventInterface(dvevent);
|
||||||
|
connect(dvevent, &DVEventInterface::finish, [action](){action->setChecked(false);});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Call the "zoom content" action for the current diagram.
|
* @brief QETDiagramEditor::selectionGroupTriggered
|
||||||
*/
|
* This slot is called when an action should be made on the current selection
|
||||||
void QETDiagramEditor::slot_zoomContent() {
|
* @param action : Action that describe the action to do.
|
||||||
if(currentDiagram()) currentDiagram() -> zoomContent();
|
*/
|
||||||
|
void QETDiagramEditor::selectionGroupTriggered(QAction *action)
|
||||||
|
{
|
||||||
|
QString value = action->data().toString();
|
||||||
|
DiagramView *dv = currentDiagram();
|
||||||
|
|
||||||
|
if (!dv || value.isEmpty()) return;
|
||||||
|
|
||||||
|
if (value == "delete_selection")
|
||||||
|
dv->deleteSelection();
|
||||||
|
else if (value == "rotate_selection")
|
||||||
|
dv->rotateSelection();
|
||||||
|
else if (value == "rotate_selected_text")
|
||||||
|
dv->rotateTexts();
|
||||||
|
else if (value == "find_selected_element" && currentCustomElement())
|
||||||
|
findElementInPanel(currentCustomElement()->location());
|
||||||
|
else if (value == "edit_selected_element")
|
||||||
|
dv->editSelection();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
void QETDiagramEditor::rowColumnGroupTriggered(QAction *action)
|
||||||
Effectue l'action "zoom par defaut" sur le schema en cours
|
{
|
||||||
*/
|
QString value = action->data().toString();
|
||||||
void QETDiagramEditor::slot_zoomReset() {
|
DiagramView *dv = currentDiagram();
|
||||||
if(currentDiagram()) currentDiagram() -> zoomReset();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
if (!dv || value.isEmpty()) return;
|
||||||
Effectue l'action "selectionner tout" sur le schema en cours
|
|
||||||
*/
|
|
||||||
void QETDiagramEditor::slot_selectAll() {
|
|
||||||
if(currentDiagram()) currentDiagram() -> selectAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
if (value == "add_column")
|
||||||
Effectue l'action "deselectionenr tout" sur le schema en cours
|
dv->addColumn();
|
||||||
*/
|
else if (value == "remove_column")
|
||||||
void QETDiagramEditor::slot_selectNothing() {
|
dv->removeColumn();
|
||||||
if(currentDiagram()) currentDiagram() -> selectNothing();
|
else if (value == "add_row")
|
||||||
}
|
dv->addRow();
|
||||||
|
else if (value == "remove_row")
|
||||||
/**
|
dv->removeRow();
|
||||||
Effectue l'action "inverser la selection" sur le schema en cours
|
|
||||||
*/
|
|
||||||
void QETDiagramEditor::slot_selectInvert() {
|
|
||||||
if(currentDiagram()) currentDiagram() -> selectInvert();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Effectue l'action "supprimer" sur le schema en cours
|
|
||||||
*/
|
|
||||||
void QETDiagramEditor::slot_delete() {
|
|
||||||
if(currentDiagram()) currentDiagram() -> deleteSelection();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Effectue l'action "pivoter" sur le schema en cours
|
|
||||||
*/
|
|
||||||
void QETDiagramEditor::slot_rotate() {
|
|
||||||
if(currentDiagram()) currentDiagram() -> rotateSelection();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Effectue l'action "Orienter les textes selectionnes" sur le schema en cours
|
|
||||||
*/
|
|
||||||
void QETDiagramEditor::slot_rotateTexts() {
|
|
||||||
if (currentDiagram()) currentDiagram() -> rotateTexts();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1513,42 +1574,6 @@ void QETDiagramEditor::editDiagramProperties(Diagram *diagram) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
Ajoute une colonne au schema en cours
|
|
||||||
*/
|
|
||||||
void QETDiagramEditor::slot_addColumn() {
|
|
||||||
if (DiagramView *dv = currentDiagram()) {
|
|
||||||
dv -> addColumn();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Enleve une colonne au schema en cours
|
|
||||||
*/
|
|
||||||
void QETDiagramEditor::slot_removeColumn() {
|
|
||||||
if (DiagramView *dv = currentDiagram()) {
|
|
||||||
dv -> removeColumn();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Allonge le schema en cours en hauteur
|
|
||||||
*/
|
|
||||||
void QETDiagramEditor::slot_addRow() {
|
|
||||||
if (DiagramView *dv = currentDiagram()) {
|
|
||||||
dv -> addRow();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Retrecit le schema en cours en hauteur
|
|
||||||
*/
|
|
||||||
void QETDiagramEditor::slot_removeRow() {
|
|
||||||
if (DiagramView *dv = currentDiagram()) {
|
|
||||||
dv -> removeRow();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Edite les proprietes des objets selectionnes
|
Edite les proprietes des objets selectionnes
|
||||||
*/
|
*/
|
||||||
@@ -1578,76 +1603,6 @@ void QETDiagramEditor::slot_autoConductor(bool ac)
|
|||||||
pv -> project() -> setAutoConductor(ac);
|
pv -> project() -> setAutoConductor(ac);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief QETDiagramEditor::slot_addText
|
|
||||||
* add text to curent diagram
|
|
||||||
*/
|
|
||||||
void QETDiagramEditor::slot_addText() {
|
|
||||||
if (DiagramView *dv = currentDiagram())
|
|
||||||
dv -> setEventInterface(new DVEventAddText(dv));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief QETDiagramEditor::slot_addImage
|
|
||||||
* add image to curent diagram
|
|
||||||
*/
|
|
||||||
void QETDiagramEditor::slot_addImage() {
|
|
||||||
if (DiagramView *dv = currentDiagram()) {
|
|
||||||
DVEventAddImage *event = new DVEventAddImage(dv);
|
|
||||||
if (event -> isNull()) {
|
|
||||||
delete event;
|
|
||||||
m_add_item_actions_group.checkedAction()->setChecked(false);
|
|
||||||
} else {
|
|
||||||
dv -> setEventInterface(event);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief QETDiagramEditor::slot_addLine
|
|
||||||
* add line to curent diagram
|
|
||||||
*/
|
|
||||||
void QETDiagramEditor::slot_addLine() {
|
|
||||||
if (DiagramView *dv = currentDiagram())
|
|
||||||
dv -> setEventInterface(new DVEventAddShape(dv, QetShapeItem::Line));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief QETDiagramEditor::slot_addRectangle
|
|
||||||
* add rectangle to curent diagram
|
|
||||||
*/
|
|
||||||
void QETDiagramEditor::slot_addRectangle() {
|
|
||||||
if (DiagramView *dv = currentDiagram()) dv -> setEventInterface(new DVEventAddShape(dv, QetShapeItem::Rectangle));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief QETDiagramEditor::slot_addEllipse
|
|
||||||
* add ellipse to curent diagram
|
|
||||||
*/
|
|
||||||
void QETDiagramEditor::slot_addEllipse() {
|
|
||||||
if (DiagramView *dv = currentDiagram()) dv -> setEventInterface(new DVEventAddShape(dv, QetShapeItem::Ellipse));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief QETDiagramEditor::slot_addPolyline
|
|
||||||
* add polyline to current diagram
|
|
||||||
*/
|
|
||||||
void QETDiagramEditor::slot_addPolyline() {
|
|
||||||
if (DiagramView *dv = currentDiagram()) dv -> setEventInterface(new DVEventAddShape(dv, QetShapeItem::Polygon));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief QETDiagramEditor::slot_editSelection
|
|
||||||
* edit the selected item if he can be edited and if only one item is selected
|
|
||||||
*/
|
|
||||||
void QETDiagramEditor::slot_editSelection() {
|
|
||||||
if (DiagramView *dv = currentDiagram()) {
|
|
||||||
DiagramContent dc = dv -> diagram() -> selectedContent();
|
|
||||||
if (dc.count(DiagramContent::SelectedOnly | DiagramContent::All) != 1) return;
|
|
||||||
dv->editSelection();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Affiche les projets dans des fenetres.
|
Affiche les projets dans des fenetres.
|
||||||
*/
|
*/
|
||||||
@@ -1992,7 +1947,6 @@ void QETDiagramEditor::diagramWasAdded(DiagramView *dv)
|
|||||||
{
|
{
|
||||||
connect(dv, SIGNAL(selectionChanged()), this, SLOT(selectionChanged()));
|
connect(dv, SIGNAL(selectionChanged()), this, SLOT(selectionChanged()));
|
||||||
connect(dv, SIGNAL(modeChanged()), this, SLOT(slot_updateModeActions()));
|
connect(dv, SIGNAL(modeChanged()), this, SLOT(slot_updateModeActions()));
|
||||||
connect(dv, SIGNAL(itemAdded()), this, SLOT(addItemFinish()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -2035,16 +1989,6 @@ void QETDiagramEditor::findElementInPanel(const ElementsLocation &location) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
Search the panel for the definition for the selected element in the current
|
|
||||||
diagram view.
|
|
||||||
*/
|
|
||||||
void QETDiagramEditor::findSelectedElementInPanel() {
|
|
||||||
if (CustomElement *selected_element = currentCustomElement()) {
|
|
||||||
findElementInPanel(selected_element -> location());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Lance l'editeur d'element pour l'element filename
|
Lance l'editeur d'element pour l'element filename
|
||||||
@param location Emplacement de l'element a editer
|
@param location Emplacement de l'element a editer
|
||||||
@@ -2079,14 +2023,6 @@ void QETDiagramEditor::showError(const QString &error) {
|
|||||||
QET::QetMessageBox::critical(this, tr("Erreur", "message box title"), error);
|
QET::QetMessageBox::critical(this, tr("Erreur", "message box title"), error);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief QETDiagramEditor::addItemFinish
|
|
||||||
* Uncheck all action in m_add_item_actions_group
|
|
||||||
*/
|
|
||||||
void QETDiagramEditor::addItemFinish() {
|
|
||||||
m_add_item_actions_group.checkedAction()->setChecked(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief QETDiagramEditor::subWindowActivated
|
* @brief QETDiagramEditor::subWindowActivated
|
||||||
* Slot used to update menu and undo stack when subwindows of MDIarea was activated
|
* Slot used to update menu and undo stack when subwindows of MDIarea was activated
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ class QETDiagramEditor : public QETMainWindow {
|
|||||||
ProjectView *findProject(QETProject *) const;
|
ProjectView *findProject(QETProject *) const;
|
||||||
ProjectView *findProject(const QString &) const;
|
ProjectView *findProject(const QString &) const;
|
||||||
QMdiSubWindow *subWindowForWidget(QWidget *) const;
|
QMdiSubWindow *subWindowForWidget(QWidget *) const;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void printDialog();
|
void printDialog();
|
||||||
void exportDialog();
|
void exportDialog();
|
||||||
@@ -92,17 +92,11 @@ class QETDiagramEditor : public QETMainWindow {
|
|||||||
void slot_cut();
|
void slot_cut();
|
||||||
void slot_copy();
|
void slot_copy();
|
||||||
void slot_paste();
|
void slot_paste();
|
||||||
void slot_zoomIn();
|
void zoomGroupTriggered (QAction *action);
|
||||||
void slot_zoomOut();
|
void selectGroupTriggered (QAction *action);
|
||||||
void slot_zoomFit();
|
void addItemGroupTriggered (QAction *action);
|
||||||
void slot_zoomContent();
|
void selectionGroupTriggered (QAction *action);
|
||||||
void slot_zoomReset();
|
void rowColumnGroupTriggered (QAction *action);
|
||||||
void slot_selectAll();
|
|
||||||
void slot_selectNothing();
|
|
||||||
void slot_selectInvert();
|
|
||||||
void slot_delete();
|
|
||||||
void slot_rotate();
|
|
||||||
void slot_rotateTexts();
|
|
||||||
void slot_setSelectionMode();
|
void slot_setSelectionMode();
|
||||||
void slot_setVisualisationMode();
|
void slot_setVisualisationMode();
|
||||||
void slot_updateActions();
|
void slot_updateActions();
|
||||||
@@ -111,20 +105,9 @@ class QETDiagramEditor : public QETMainWindow {
|
|||||||
void slot_updateComplexActions();
|
void slot_updateComplexActions();
|
||||||
void slot_updatePasteAction();
|
void slot_updatePasteAction();
|
||||||
void slot_updateWindowsMenu();
|
void slot_updateWindowsMenu();
|
||||||
void slot_addColumn();
|
|
||||||
void slot_removeColumn();
|
|
||||||
void slot_addRow();
|
|
||||||
void slot_removeRow();
|
|
||||||
void editSelectionProperties();
|
void editSelectionProperties();
|
||||||
void slot_resetConductors();
|
void slot_resetConductors();
|
||||||
void slot_autoConductor(bool ac);
|
void slot_autoConductor(bool ac);
|
||||||
void slot_addText();
|
|
||||||
void slot_addImage();
|
|
||||||
void slot_addLine();
|
|
||||||
void slot_addRectangle();
|
|
||||||
void slot_addEllipse();
|
|
||||||
void slot_addPolyline();
|
|
||||||
void slot_editSelection();
|
|
||||||
void setWindowedMode();
|
void setWindowedMode();
|
||||||
void setTabbedMode();
|
void setTabbedMode();
|
||||||
void readSettings();
|
void readSettings();
|
||||||
@@ -154,12 +137,10 @@ class QETDiagramEditor : public QETMainWindow {
|
|||||||
void nomenclatureProject();
|
void nomenclatureProject();
|
||||||
void diagramWasAdded(DiagramView *);
|
void diagramWasAdded(DiagramView *);
|
||||||
void findElementInPanel(const ElementsLocation &);
|
void findElementInPanel(const ElementsLocation &);
|
||||||
void findSelectedElementInPanel();
|
|
||||||
void editElementInEditor(const ElementsLocation &);
|
void editElementInEditor(const ElementsLocation &);
|
||||||
void editSelectedElementInEditor();
|
void editSelectedElementInEditor();
|
||||||
void showError(const QETResult &);
|
void showError(const QETResult &);
|
||||||
void showError(const QString &);
|
void showError(const QString &);
|
||||||
void addItemFinish();
|
|
||||||
void subWindowActivated(QMdiSubWindow *subWindows);
|
void subWindowActivated(QMdiSubWindow *subWindows);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|||||||
Reference in New Issue
Block a user