mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-09-13 20:23:04 +02:00
L'edition directe d'un texte ou d'un champ de texte genere desormais un objet d'annulation
La liste des parties se rafraichit desormais lors d'un annuler/refaire git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@296 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
parent
b42bc62e9e
commit
c44a8cb51a
@ -17,6 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
#include "parttext.h"
|
#include "parttext.h"
|
||||||
#include "texteditor.h"
|
#include "texteditor.h"
|
||||||
|
#include "editorcommands.h"
|
||||||
#include "elementscene.h"
|
#include "elementscene.h"
|
||||||
#include "qetapp.h"
|
#include "qetapp.h"
|
||||||
|
|
||||||
@ -126,6 +127,18 @@ QPointF PartText::margin() const {
|
|||||||
*/
|
*/
|
||||||
void PartText::focusOutEvent(QFocusEvent *e) {
|
void PartText::focusOutEvent(QFocusEvent *e) {
|
||||||
QGraphicsTextItem::focusOutEvent(e);
|
QGraphicsTextItem::focusOutEvent(e);
|
||||||
|
if (previous_text != toPlainText()) {
|
||||||
|
undoStack().push(
|
||||||
|
new ChangePartCommand(
|
||||||
|
TextEditor::tr("texte") + " " + name(),
|
||||||
|
this,
|
||||||
|
"text",
|
||||||
|
previous_text,
|
||||||
|
toPlainText()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
previous_text = toPlainText();
|
||||||
|
}
|
||||||
setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
|
setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -136,6 +149,7 @@ void PartText::focusOutEvent(QFocusEvent *e) {
|
|||||||
void PartText::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *e) {
|
void PartText::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *e) {
|
||||||
setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable | QGraphicsItem::ItemIsFocusable);
|
setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable | QGraphicsItem::ItemIsFocusable);
|
||||||
setTextInteractionFlags(Qt::TextEditorInteraction);
|
setTextInteractionFlags(Qt::TextEditorInteraction);
|
||||||
|
previous_text = toPlainText();
|
||||||
QGraphicsTextItem::mouseDoubleClickEvent(e);
|
QGraphicsTextItem::mouseDoubleClickEvent(e);
|
||||||
setFocus(Qt::MouseFocusReason);
|
setFocus(Qt::MouseFocusReason);
|
||||||
}
|
}
|
||||||
|
@ -63,5 +63,6 @@ class PartText : public QGraphicsTextItem, public CustomElementPart {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
QPointF margin() const;
|
QPointF margin() const;
|
||||||
|
QString previous_text;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
#include "parttextfield.h"
|
#include "parttextfield.h"
|
||||||
#include "textfieldeditor.h"
|
#include "textfieldeditor.h"
|
||||||
|
#include "editorcommands.h"
|
||||||
#include "qetapp.h"
|
#include "qetapp.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -144,6 +145,18 @@ QPointF PartTextField::margin() const {
|
|||||||
*/
|
*/
|
||||||
void PartTextField::focusOutEvent(QFocusEvent *e) {
|
void PartTextField::focusOutEvent(QFocusEvent *e) {
|
||||||
QGraphicsTextItem::focusOutEvent(e);
|
QGraphicsTextItem::focusOutEvent(e);
|
||||||
|
if (previous_text != toPlainText()) {
|
||||||
|
undoStack().push(
|
||||||
|
new ChangePartCommand(
|
||||||
|
TextFieldEditor::tr("texte") + " " + name(),
|
||||||
|
this,
|
||||||
|
"text",
|
||||||
|
previous_text,
|
||||||
|
toPlainText()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
previous_text = toPlainText();
|
||||||
|
}
|
||||||
setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
|
setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -154,6 +167,7 @@ void PartTextField::focusOutEvent(QFocusEvent *e) {
|
|||||||
void PartTextField::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *e) {
|
void PartTextField::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *e) {
|
||||||
setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable | QGraphicsItem::ItemIsFocusable);
|
setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable | QGraphicsItem::ItemIsFocusable);
|
||||||
setTextInteractionFlags(Qt::TextEditorInteraction);
|
setTextInteractionFlags(Qt::TextEditorInteraction);
|
||||||
|
previous_text = toPlainText();
|
||||||
QGraphicsTextItem::mouseDoubleClickEvent(e);
|
QGraphicsTextItem::mouseDoubleClickEvent(e);
|
||||||
setFocus(Qt::MouseFocusReason);
|
setFocus(Qt::MouseFocusReason);
|
||||||
}
|
}
|
||||||
|
@ -69,5 +69,6 @@ class PartTextField : public QGraphicsTextItem, public CustomElementPart {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
QPointF margin() const;
|
QPointF margin() const;
|
||||||
|
QString previous_text;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
@ -239,6 +239,7 @@ void QETElementEditor::setupActions() {
|
|||||||
connect(ce_scene, SIGNAL(selectionChanged()), this, SLOT(slot_updateMenus()));
|
connect(ce_scene, SIGNAL(selectionChanged()), this, SLOT(slot_updateMenus()));
|
||||||
connect(&(ce_scene -> undoStack()), SIGNAL(cleanChanged(bool)), this, SLOT(slot_updateMenus()));
|
connect(&(ce_scene -> undoStack()), SIGNAL(cleanChanged(bool)), this, SLOT(slot_updateMenus()));
|
||||||
connect(&(ce_scene -> undoStack()), SIGNAL(cleanChanged(bool)), this, SLOT(slot_updateTitle()));
|
connect(&(ce_scene -> undoStack()), SIGNAL(cleanChanged(bool)), this, SLOT(slot_updateTitle()));
|
||||||
|
connect(&(ce_scene -> undoStack()), SIGNAL(indexChanged(int)), this, SLOT(slot_updatePartsList()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user