mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-19 23:20:52 +01:00
Correction d'un conflit sur le schema lors de l'edition d'un champ de texte : les fleches de directions ne deplacent plus l'element parent du champ de texte
Nettoyage de la correction du conflit sur la touche Suppr (cf commit 154) git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@171 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -93,7 +93,7 @@ void Diagram::keyPressEvent(QKeyEvent *e) {
|
|||||||
case Qt::Key_Up: movement = QPointF(0.0, -yGrid); break;
|
case Qt::Key_Up: movement = QPointF(0.0, -yGrid); break;
|
||||||
case Qt::Key_Down: movement = QPointF(0.0, +yGrid); break;
|
case Qt::Key_Down: movement = QPointF(0.0, +yGrid); break;
|
||||||
}
|
}
|
||||||
if (!movement.isNull()) {
|
if (!movement.isNull() && !focusItem()) {
|
||||||
QSet<Element *> moved_elements = elementsToMove();
|
QSet<Element *> moved_elements = elementsToMove();
|
||||||
if (!moved_elements.isEmpty()) {
|
if (!moved_elements.isEmpty()) {
|
||||||
Element *first_elmt = NULL;
|
Element *first_elmt = NULL;
|
||||||
|
|||||||
@@ -47,16 +47,3 @@ void DiagramTextItem::focusOutEvent(QFocusEvent *e) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
Gere le relachement des touches du clavier.
|
|
||||||
Cette methode a ete reimplementee pour gerer la touche Suppr/Del
|
|
||||||
*/
|
|
||||||
void DiagramTextItem::keyReleaseEvent(QKeyEvent *e) {
|
|
||||||
if (e -> key() == Qt::Key_Delete) {
|
|
||||||
QTextCursor text_cursor = textCursor();
|
|
||||||
text_cursor.deleteChar();
|
|
||||||
setTextCursor(text_cursor);
|
|
||||||
}
|
|
||||||
QGraphicsTextItem::keyReleaseEvent(e);
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -24,6 +24,5 @@ class DiagramTextItem : public QGraphicsTextItem {
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void focusOutEvent(QFocusEvent *);
|
virtual void focusOutEvent(QFocusEvent *);
|
||||||
virtual void keyReleaseEvent(QKeyEvent *);
|
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -702,3 +702,17 @@ void DiagramView::resetConductors() {
|
|||||||
if (conductors_and_profiles.isEmpty()) return;
|
if (conductors_and_profiles.isEmpty()) return;
|
||||||
scene -> undoStack().push(new ResetConductorCommand(conductors_and_profiles));
|
scene -> undoStack().push(new ResetConductorCommand(conductors_and_profiles));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gere les evenements de la DiagramView
|
||||||
|
@param e Evenement
|
||||||
|
*/
|
||||||
|
bool DiagramView::event(QEvent *e) {
|
||||||
|
// fait en sorte que les raccourcis clavier arrivent prioritairement sur la
|
||||||
|
// vue plutot que de remonter vers les QMenu / QAction
|
||||||
|
if (e -> type() == QEvent::ShortcutOverride && scene -> focusItem()) {
|
||||||
|
e -> accept();
|
||||||
|
return(true);
|
||||||
|
}
|
||||||
|
return(QGraphicsView::event(e));
|
||||||
|
}
|
||||||
@@ -41,6 +41,7 @@ class DiagramView : public QGraphicsView {
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void wheelEvent(QWheelEvent *);
|
virtual void wheelEvent(QWheelEvent *);
|
||||||
|
virtual bool event(QEvent *);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool saveDiagramToFile(QString &);
|
bool saveDiagramToFile(QString &);
|
||||||
|
|||||||
@@ -418,11 +418,6 @@ void ElementScene::slot_invertSelection() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ElementScene::slot_delete() {
|
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
|
// verifie qu'il y a qqc de selectionne
|
||||||
QList<QGraphicsItem *> selected_items = selectedItems();
|
QList<QGraphicsItem *> selected_items = selectedItems();
|
||||||
if (selected_items.isEmpty()) return;
|
if (selected_items.isEmpty()) return;
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
*/
|
*/
|
||||||
ElementView::ElementView(ElementScene *scene, QWidget *parent) :
|
ElementView::ElementView(ElementScene *scene, QWidget *parent) :
|
||||||
QGraphicsView(scene, parent),
|
QGraphicsView(scene, parent),
|
||||||
_scene(scene)
|
scene_(scene)
|
||||||
{
|
{
|
||||||
setInteractive(true);
|
setInteractive(true);
|
||||||
setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||||
@@ -22,7 +22,7 @@ ElementView::~ElementView() {
|
|||||||
|
|
||||||
/// @return l'ElementScene visualisee par cette ElementView
|
/// @return l'ElementScene visualisee par cette ElementView
|
||||||
ElementScene *ElementView::scene() const {
|
ElementScene *ElementView::scene() const {
|
||||||
return(_scene);
|
return(scene_);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -31,5 +31,13 @@ ElementScene *ElementView::scene() const {
|
|||||||
*/
|
*/
|
||||||
void ElementView::setScene(ElementScene *s) {
|
void ElementView::setScene(ElementScene *s) {
|
||||||
QGraphicsView::setScene(s);
|
QGraphicsView::setScene(s);
|
||||||
_scene = s;
|
scene_ = s;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ElementView::event(QEvent *e) {
|
||||||
|
if (e -> type() == QEvent::ShortcutOverride && scene_ -> focusItem()) {
|
||||||
|
e -> accept();
|
||||||
|
return(true);
|
||||||
|
}
|
||||||
|
return(QGraphicsView::event(e));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,9 +16,11 @@ class ElementView : public QGraphicsView {
|
|||||||
public:
|
public:
|
||||||
ElementScene *scene() const;
|
ElementScene *scene() const;
|
||||||
void setScene(ElementScene *);
|
void setScene(ElementScene *);
|
||||||
|
protected:
|
||||||
|
bool event(QEvent *);
|
||||||
|
|
||||||
//attributs
|
//attributs
|
||||||
private:
|
private:
|
||||||
ElementScene *_scene;
|
ElementScene *scene_;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -133,12 +133,3 @@ QRectF PartText::boundingRect() const {
|
|||||||
r.adjust(0.0, -2.0, 0.0, 0.0);
|
r.adjust(0.0, -2.0, 0.0, 0.0);
|
||||||
return(r);
|
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);
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ class PartText : public QGraphicsTextItem, public CustomElementPart {
|
|||||||
protected:
|
protected:
|
||||||
virtual void focusOutEvent(QFocusEvent *);
|
virtual void focusOutEvent(QFocusEvent *);
|
||||||
virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *);
|
virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *);
|
||||||
virtual void keyReleaseEvent(QKeyEvent *);
|
|
||||||
virtual QVariant itemChange(GraphicsItemChange, const QVariant &);
|
virtual QVariant itemChange(GraphicsItemChange, const QVariant &);
|
||||||
QRectF boundingRect() const;
|
QRectF boundingRect() const;
|
||||||
|
|
||||||
|
|||||||
@@ -150,12 +150,3 @@ QRectF PartTextField::boundingRect() const {
|
|||||||
r.adjust(0.0, -2.0, 0.0, 0.0);
|
r.adjust(0.0, -2.0, 0.0, 0.0);
|
||||||
return(r);
|
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);
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ class PartTextField : public QGraphicsTextItem, public CustomElementPart {
|
|||||||
protected:
|
protected:
|
||||||
virtual void focusOutEvent(QFocusEvent *);
|
virtual void focusOutEvent(QFocusEvent *);
|
||||||
virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *);
|
virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *);
|
||||||
virtual void keyReleaseEvent(QKeyEvent *);
|
|
||||||
virtual QVariant itemChange(GraphicsItemChange, const QVariant &);
|
virtual QVariant itemChange(GraphicsItemChange, const QVariant &);
|
||||||
QRectF boundingRect() const;
|
QRectF boundingRect() const;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user