diff --git a/diagramtextitem.cpp b/diagramtextitem.cpp index 5b2b80203..aaa89237b 100644 --- a/diagramtextitem.cpp +++ b/diagramtextitem.cpp @@ -47,3 +47,12 @@ void DiagramTextItem::focusOutEvent(QFocusEvent *e) { } } } + +void DiagramTextItem::keyReleaseEvent(QKeyEvent *e) { + if (e -> key() == Qt::Key_Delete) { + QTextCursor text_cursor = textCursor(); + text_cursor.deleteChar(); + setTextCursor(text_cursor); + } + QGraphicsTextItem::keyReleaseEvent(e); +} diff --git a/diagramtextitem.h b/diagramtextitem.h index 60e0388cd..83599af12 100644 --- a/diagramtextitem.h +++ b/diagramtextitem.h @@ -21,5 +21,6 @@ class DiagramTextItem : public QGraphicsTextItem { protected: virtual void focusOutEvent(QFocusEvent *); + virtual void keyReleaseEvent(QKeyEvent *); }; #endif diff --git a/diagramview.cpp b/diagramview.cpp index 968865f15..e7806f5ff 100644 --- a/diagramview.cpp +++ b/diagramview.cpp @@ -70,6 +70,10 @@ void DiagramView::selectInvert() { Supprime les composants selectionnes */ void DiagramView::deleteSelection() { + // si un item a le focus et que ce slot est appele, c'est sans doute parce + // que la touche suppr a ete enfoncee pour effacer une lettre et non la + // selection + if (scene -> focusItem()) return; QSet garbage_elmt; QSet garbage_conductors; @@ -448,7 +452,9 @@ void DiagramView::dialogPrint() { if (qpd.exec() == QDialog::Accepted) { QPainter qp(&qprin); scene -> setDisplayGrid(false); + scene -> setDrawTerminals(false); scene -> render(&qp); + scene -> setDrawTerminals(true); scene -> setDisplayGrid(true); } } diff --git a/editor/elementscene.cpp b/editor/elementscene.cpp index 6e9558a26..50d7d51d9 100644 --- a/editor/elementscene.cpp +++ b/editor/elementscene.cpp @@ -413,6 +413,11 @@ void ElementScene::slot_invertSelection() { } void ElementScene::slot_delete() { + // si un item a le focus et que ce slot est appele, c'est sans doute parce + // que la touche suppr a ete enfoncee pour effacer une lettre et non la + // selection + if (focusItem()) return; + // verifie qu'il y a qqc de selectionne QList selected_items = selectedItems(); if (selected_items.isEmpty()) return; diff --git a/editor/parttext.cpp b/editor/parttext.cpp index 94306a123..efef4b238 100644 --- a/editor/parttext.cpp +++ b/editor/parttext.cpp @@ -133,3 +133,12 @@ QRectF PartText::boundingRect() const { r.adjust(0.0, -2.0, 0.0, 0.0); return(r); } + +void PartText::keyReleaseEvent(QKeyEvent *e) { + if (e -> key() == Qt::Key_Delete) { + QTextCursor text_cursor = textCursor(); + text_cursor.deleteChar(); + setTextCursor(text_cursor); + } + QGraphicsTextItem::keyReleaseEvent(e); +} diff --git a/editor/parttext.h b/editor/parttext.h index 7cd74c252..fae588032 100644 --- a/editor/parttext.h +++ b/editor/parttext.h @@ -29,6 +29,7 @@ class PartText : public QGraphicsTextItem, public CustomElementPart { protected: virtual void focusOutEvent(QFocusEvent *); virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *); + virtual void keyReleaseEvent(QKeyEvent *); virtual QVariant itemChange(GraphicsItemChange, const QVariant &); QRectF boundingRect() const; diff --git a/editor/parttextfield.cpp b/editor/parttextfield.cpp index 842746325..90b02e585 100644 --- a/editor/parttextfield.cpp +++ b/editor/parttextfield.cpp @@ -150,3 +150,12 @@ QRectF PartTextField::boundingRect() const { r.adjust(0.0, -2.0, 0.0, 0.0); return(r); } + +void PartTextField::keyReleaseEvent(QKeyEvent *e) { + if (e -> key() == Qt::Key_Delete) { + QTextCursor text_cursor = textCursor(); + text_cursor.deleteChar(); + setTextCursor(text_cursor); + } + QGraphicsTextItem::keyReleaseEvent(e); +} diff --git a/editor/parttextfield.h b/editor/parttextfield.h index 793b15d10..33331339e 100644 --- a/editor/parttextfield.h +++ b/editor/parttextfield.h @@ -33,6 +33,7 @@ class PartTextField : public QGraphicsTextItem, public CustomElementPart { protected: virtual void focusOutEvent(QFocusEvent *); virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *); + virtual void keyReleaseEvent(QKeyEvent *); virtual QVariant itemChange(GraphicsItemChange, const QVariant &); QRectF boundingRect() const; diff --git a/editor/qetelementeditor.cpp b/editor/qetelementeditor.cpp index 5429ed5f2..a215bb028 100644 --- a/editor/qetelementeditor.cpp +++ b/editor/qetelementeditor.cpp @@ -60,7 +60,10 @@ void QETElementEditor::setupActions() { selectall -> setShortcut(QKeySequence::SelectAll); deselectall -> setShortcut(QKeySequence(tr("Ctrl+Shift+A"))); inv_select -> setShortcut(QKeySequence(tr("Ctrl+I"))); - edit_delete -> setShortcut(QKeySequence(tr("Ctrl+Suppr"))); + edit_delete -> setShortcut(QKeySequence(tr("Suppr"))); + edit_names -> setShortcut(QKeySequence(tr("Ctrl+E"))); + edit_size_hs -> setShortcut(QKeySequence(tr("Ctrl+R"))); + edit_ori -> setShortcut(QKeySequence(tr("Ctrl+T"))); connect(new_element, SIGNAL(triggered()), this, SLOT(slot_new())); connect(open, SIGNAL(triggered()), this, SLOT(slot_open())); diff --git a/elements/del.elmt b/elements/del.elmt index ce5e1ecbe..6f528f50e 100644 --- a/elements/del.elmt +++ b/elements/del.elmt @@ -1,8 +1,8 @@ - DEL - LED + Voyant + Indicator diff --git a/qetdiagrameditor.cpp b/qetdiagrameditor.cpp index 3a8bdcd07..20b1b8f0e 100644 --- a/qetdiagrameditor.cpp +++ b/qetdiagrameditor.cpp @@ -207,7 +207,7 @@ void QETDiagramEditor::actions() { select_all -> setShortcut(QKeySequence::SelectAll); select_nothing -> setShortcut(QKeySequence(tr("Ctrl+Shift+A"))); select_invert -> setShortcut(QKeySequence(tr("Ctrl+I"))); - delete_selection -> setShortcut(QKeySequence(tr("Ctrl+Suppr"))); + delete_selection -> setShortcut(QKeySequence(tr("Suppr"))); rotate_selection -> setShortcut(QKeySequence(tr("Ctrl+R"))); zoom_in -> setShortcut(QKeySequence::ZoomIn);