[qet] [2544] element editor: improve context menu and fix the end of polygon |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/qet Archives
]
Revision: 2544
Author: blacksun
Date: 2013-09-17 22:14:30 +0200 (Tue, 17 Sep 2013)
Log Message:
-----------
element editor: improve context menu and fix the end of polygon
diagram: fix memory leak
Modified Paths:
--------------
trunk/sources/diagram.cpp
trunk/sources/editor/elementscene.cpp
trunk/sources/editor/elementscene.h
trunk/sources/editor/elementview.cpp
trunk/sources/editor/elementview.h
trunk/sources/editor/qetelementeditor.cpp
trunk/sources/editor/qetelementeditor.h
Modified: trunk/sources/diagram.cpp
===================================================================
--- trunk/sources/diagram.cpp 2013-09-16 10:48:07 UTC (rev 2543)
+++ trunk/sources/diagram.cpp 2013-09-17 20:14:30 UTC (rev 2544)
@@ -84,6 +84,8 @@
delete undo_stack_;
// suppression du QGIManager - tous les elements qu'il connait sont supprimes
delete qgi_manager_;
+ // remove of conductor setter
+ delete conductor_setter_;
// suppression des objets gerant les deplacements
delete elements_mover_;
Modified: trunk/sources/editor/elementscene.cpp
===================================================================
--- trunk/sources/editor/elementscene.cpp 2013-09-16 10:48:07 UTC (rev 2543)
+++ trunk/sources/editor/elementscene.cpp 2013-09-17 20:14:30 UTC (rev 2544)
@@ -598,6 +598,11 @@
}
+void ElementScene::contextMenu(QContextMenuEvent *event) {
+ if (behavior == ElementScene::Normal)
+ element_editor -> contextMenu(event);
+}
+
/**
Selectionne une liste de parties
@param content liste des parties a selectionner
Modified: trunk/sources/editor/elementscene.h
===================================================================
--- trunk/sources/editor/elementscene.h 2013-09-16 10:48:07 UTC (rev 2543)
+++ trunk/sources/editor/elementscene.h 2013-09-17 20:14:30 UTC (rev 2544)
@@ -138,6 +138,7 @@
void cut();
void copy();
void paste();
+ void contextMenu (QContextMenuEvent *event);
protected:
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *);
Modified: trunk/sources/editor/elementview.cpp
===================================================================
--- trunk/sources/editor/elementview.cpp 2013-09-16 10:48:07 UTC (rev 2543)
+++ trunk/sources/editor/elementview.cpp 2013-09-17 20:14:30 UTC (rev 2544)
@@ -65,6 +65,10 @@
return(QRectF(scene_left_top, scene_right_bottom));
}
+void ElementView::contextMenuEvent(QContextMenuEvent *event) {
+ scene_ -> contextMenu(event);
+}
+
/**
Definit l'ElementScene visualisee par cette ElementView
@param s l'ElementScene visualisee par cette ElementView
Modified: trunk/sources/editor/elementview.h
===================================================================
--- trunk/sources/editor/elementview.h 2013-09-16 10:48:07 UTC (rev 2543)
+++ trunk/sources/editor/elementview.h 2013-09-17 20:14:30 UTC (rev 2544)
@@ -40,6 +40,7 @@
ElementScene *scene() const;
void setScene(ElementScene *);
QRectF viewedSceneRect() const;
+ void contextMenuEvent(QContextMenuEvent *event);
protected:
void mousePressEvent(QMouseEvent *);
Modified: trunk/sources/editor/qetelementeditor.cpp
===================================================================
--- trunk/sources/editor/qetelementeditor.cpp 2013-09-16 10:48:07 UTC (rev 2543)
+++ trunk/sources/editor/qetelementeditor.cpp 2013-09-17 20:14:30 UTC (rev 2544)
@@ -415,28 +415,27 @@
* @brief QETElementEditor::contextMenuEvent
* @param event
*/
-void QETElementEditor::contextMenuEvent(QContextMenuEvent *event)
- {
- QMenu menu(this);
- menu.addAction(undo);
- menu.addAction(redo);
- menu.addAction(selectall);
- menu.addAction(deselectall);
- menu.addAction(inv_select);
- menu.addSeparator();
- menu.addAction(edit_delete);
- menu.addAction(cut);
- menu.addAction(copy);
- menu.addSeparator();
- menu.addAction(paste);
- menu.addAction(paste_in_area);
- menu.addMenu(paste_from_menu);
- menu.addSeparator();
- menu.addAction(edit_forward);
- menu.addAction(edit_raise);
- menu.addAction(edit_lower);
- menu.addAction(edit_backward);
- menu.exec(event->globalPos());
+void QETElementEditor::contextMenu(QContextMenuEvent *event) {
+ QMenu menu(this);
+ menu.addAction(undo);
+ menu.addAction(redo);
+ menu.addAction(selectall);
+ menu.addAction(deselectall);
+ menu.addAction(inv_select);
+ menu.addSeparator();
+ menu.addAction(edit_delete);
+ menu.addAction(cut);
+ menu.addAction(copy);
+ menu.addSeparator();
+ menu.addAction(paste);
+ menu.addAction(paste_in_area);
+ menu.addMenu(paste_from_menu);
+ menu.addSeparator();
+ menu.addAction(edit_forward);
+ menu.addAction(edit_raise);
+ menu.addAction(edit_lower);
+ menu.addAction(edit_backward);
+ menu.exec(event -> globalPos());
}
Modified: trunk/sources/editor/qetelementeditor.h
===================================================================
--- trunk/sources/editor/qetelementeditor.h 2013-09-16 10:48:07 UTC (rev 2543)
+++ trunk/sources/editor/qetelementeditor.h 2013-09-17 20:14:30 UTC (rev 2544)
@@ -113,11 +113,11 @@
static QPointF pasteOffset();
static QET::OrientedMovement pasteMovement();
static QString getOpenElementFileName(QWidget * = 0, const QString & = QString());
-
+ void contextMenu(QContextMenuEvent *event);
+
protected:
void closeEvent(QCloseEvent *);
virtual void firstActivation(QEvent *);
- void contextMenuEvent(QContextMenuEvent *event);
private:
void setupActions();