mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-19 14:50:53 +01:00
Correction : a partir de Qt 4.6, certains evenements ne sont plus signales
dans la methode QGraphicsItem::itemChange, a commencer par les changements de position, sauf si l'on positionne explicitement un flag. Ce comportement avait un impact important sur le repositionnement des champs de texte. git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/branches/0.3@843 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -31,6 +31,9 @@ PartArc::PartArc(QETElementEditor *editor, QGraphicsItem *parent, QGraphicsScene
|
|||||||
start_angle(0)
|
start_angle(0)
|
||||||
{
|
{
|
||||||
setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
|
setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
|
||||||
|
#if QT_VERSION >= 0x040600
|
||||||
|
setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
|
||||||
|
#endif
|
||||||
setAcceptedMouseButtons(Qt::LeftButton);
|
setAcceptedMouseButtons(Qt::LeftButton);
|
||||||
informations = new ArcEditor(elementEditor(), this);
|
informations = new ArcEditor(elementEditor(), this);
|
||||||
informations -> setElementTypeName(name());
|
informations -> setElementTypeName(name());
|
||||||
|
|||||||
@@ -26,6 +26,9 @@
|
|||||||
*/
|
*/
|
||||||
PartCircle::PartCircle(QETElementEditor *editor, QGraphicsItem *parent, QGraphicsScene *scene) : QGraphicsEllipseItem(parent, scene), CustomElementGraphicPart(editor) {
|
PartCircle::PartCircle(QETElementEditor *editor, QGraphicsItem *parent, QGraphicsScene *scene) : QGraphicsEllipseItem(parent, scene), CustomElementGraphicPart(editor) {
|
||||||
setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
|
setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
|
||||||
|
#if QT_VERSION >= 0x040600
|
||||||
|
setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
|
||||||
|
#endif
|
||||||
setAcceptedMouseButtons(Qt::LeftButton);
|
setAcceptedMouseButtons(Qt::LeftButton);
|
||||||
informations = new CircleEditor(elementEditor(), this);
|
informations = new CircleEditor(elementEditor(), this);
|
||||||
informations -> setElementTypeName(name());
|
informations -> setElementTypeName(name());
|
||||||
|
|||||||
@@ -26,6 +26,9 @@
|
|||||||
*/
|
*/
|
||||||
PartEllipse::PartEllipse(QETElementEditor *editor, QGraphicsItem *parent, QGraphicsScene *scene) : QGraphicsEllipseItem(parent, scene), CustomElementGraphicPart(editor) {
|
PartEllipse::PartEllipse(QETElementEditor *editor, QGraphicsItem *parent, QGraphicsScene *scene) : QGraphicsEllipseItem(parent, scene), CustomElementGraphicPart(editor) {
|
||||||
setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
|
setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
|
||||||
|
#if QT_VERSION >= 0x040600
|
||||||
|
setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
|
||||||
|
#endif
|
||||||
setAcceptedMouseButtons(Qt::LeftButton);
|
setAcceptedMouseButtons(Qt::LeftButton);
|
||||||
informations = new EllipseEditor(elementEditor(), this);
|
informations = new EllipseEditor(elementEditor(), this);
|
||||||
informations -> setElementTypeName(name());
|
informations -> setElementTypeName(name());
|
||||||
|
|||||||
@@ -34,6 +34,9 @@ PartLine::PartLine(QETElementEditor *editor, QGraphicsItem *parent, QGraphicsSce
|
|||||||
second_length(1.5)
|
second_length(1.5)
|
||||||
{
|
{
|
||||||
setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
|
setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
|
||||||
|
#if QT_VERSION >= 0x040600
|
||||||
|
setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
|
||||||
|
#endif
|
||||||
setAcceptedMouseButtons(Qt::LeftButton);
|
setAcceptedMouseButtons(Qt::LeftButton);
|
||||||
informations = new LineEditor(elementEditor(), this);
|
informations = new LineEditor(elementEditor(), this);
|
||||||
informations -> setElementTypeName(name());
|
informations -> setElementTypeName(name());
|
||||||
|
|||||||
@@ -31,6 +31,9 @@ PartPolygon::PartPolygon(QETElementEditor *editor, QGraphicsItem *parent, QGraph
|
|||||||
closed(false)
|
closed(false)
|
||||||
{
|
{
|
||||||
setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
|
setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
|
||||||
|
#if QT_VERSION >= 0x040600
|
||||||
|
setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
|
||||||
|
#endif
|
||||||
setAcceptedMouseButtons(Qt::LeftButton);
|
setAcceptedMouseButtons(Qt::LeftButton);
|
||||||
informations = new PolygonEditor(elementEditor(), this);
|
informations = new PolygonEditor(elementEditor(), this);
|
||||||
informations -> setElementTypeName(name());
|
informations -> setElementTypeName(name());
|
||||||
|
|||||||
@@ -26,6 +26,9 @@
|
|||||||
*/
|
*/
|
||||||
PartRectangle::PartRectangle(QETElementEditor *editor, QGraphicsItem *parent, QGraphicsScene *scene) : QGraphicsRectItem(parent, scene), CustomElementGraphicPart(editor) {
|
PartRectangle::PartRectangle(QETElementEditor *editor, QGraphicsItem *parent, QGraphicsScene *scene) : QGraphicsRectItem(parent, scene), CustomElementGraphicPart(editor) {
|
||||||
setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
|
setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
|
||||||
|
#if QT_VERSION >= 0x040600
|
||||||
|
setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
|
||||||
|
#endif
|
||||||
setAcceptedMouseButtons(Qt::LeftButton);
|
setAcceptedMouseButtons(Qt::LeftButton);
|
||||||
informations = new RectangleEditor(elementEditor(), this);
|
informations = new RectangleEditor(elementEditor(), this);
|
||||||
informations -> setElementTypeName(name());
|
informations -> setElementTypeName(name());
|
||||||
|
|||||||
@@ -34,6 +34,9 @@ PartTerminal::PartTerminal(QETElementEditor *editor, QGraphicsItem *parent, QGra
|
|||||||
informations -> setElementTypeName(name());
|
informations -> setElementTypeName(name());
|
||||||
updateSecondPoint();
|
updateSecondPoint();
|
||||||
setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
|
setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
|
||||||
|
#if QT_VERSION >= 0x040600
|
||||||
|
setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
|
||||||
|
#endif
|
||||||
setZValue(100000);
|
setZValue(100000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,6 +37,9 @@ PartText::PartText(QETElementEditor *editor, QGraphicsItem *parent, ElementScene
|
|||||||
setDefaultTextColor(Qt::black);
|
setDefaultTextColor(Qt::black);
|
||||||
setFont(QETApp::diagramTextsFont());
|
setFont(QETApp::diagramTextsFont());
|
||||||
setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
|
setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
|
||||||
|
#if QT_VERSION >= 0x040600
|
||||||
|
setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
|
||||||
|
#endif
|
||||||
setPlainText(QObject::tr("T", "default text when adding a text in the element editor"));
|
setPlainText(QObject::tr("T", "default text when adding a text in the element editor"));
|
||||||
infos = new TextEditor(elementEditor(), this);
|
infos = new TextEditor(elementEditor(), this);
|
||||||
infos -> setElementTypeName(name());
|
infos -> setElementTypeName(name());
|
||||||
@@ -162,7 +165,7 @@ void PartText::focusOutEvent(QFocusEvent *e) {
|
|||||||
setTextCursor(qtc);
|
setTextCursor(qtc);
|
||||||
|
|
||||||
setTextInteractionFlags(Qt::NoTextInteraction);
|
setTextInteractionFlags(Qt::NoTextInteraction);
|
||||||
setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
|
setFlag(QGraphicsItem::ItemIsFocusable, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -170,7 +173,7 @@ void PartText::focusOutEvent(QFocusEvent *e) {
|
|||||||
@param e Le QGraphicsSceneMouseEvent qui decrit le double-clic
|
@param e Le QGraphicsSceneMouseEvent qui decrit le double-clic
|
||||||
*/
|
*/
|
||||||
void PartText::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *e) {
|
void PartText::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *e) {
|
||||||
setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable | QGraphicsItem::ItemIsFocusable);
|
setFlag(QGraphicsItem::ItemIsFocusable, true);
|
||||||
setTextInteractionFlags(Qt::TextEditorInteraction);
|
setTextInteractionFlags(Qt::TextEditorInteraction);
|
||||||
previous_text = toPlainText();
|
previous_text = toPlainText();
|
||||||
QGraphicsTextItem::mouseDoubleClickEvent(e);
|
QGraphicsTextItem::mouseDoubleClickEvent(e);
|
||||||
|
|||||||
@@ -35,6 +35,9 @@ PartTextField::PartTextField(QETElementEditor *editor, QGraphicsItem *parent, QG
|
|||||||
setDefaultTextColor(Qt::black);
|
setDefaultTextColor(Qt::black);
|
||||||
setFont(QETApp::diagramTextsFont());
|
setFont(QETApp::diagramTextsFont());
|
||||||
setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
|
setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
|
||||||
|
#if QT_VERSION >= 0x040600
|
||||||
|
setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
|
||||||
|
#endif
|
||||||
setPlainText(QObject::tr("_", "default text when adding a textfield in the element editor"));
|
setPlainText(QObject::tr("_", "default text when adding a textfield in the element editor"));
|
||||||
infos = new TextFieldEditor(elementEditor(), this);
|
infos = new TextFieldEditor(elementEditor(), this);
|
||||||
infos -> setElementTypeName(name());
|
infos -> setElementTypeName(name());
|
||||||
@@ -207,7 +210,7 @@ void PartTextField::focusOutEvent(QFocusEvent *e) {
|
|||||||
setTextCursor(qtc);
|
setTextCursor(qtc);
|
||||||
|
|
||||||
setTextInteractionFlags(Qt::NoTextInteraction);
|
setTextInteractionFlags(Qt::NoTextInteraction);
|
||||||
setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
|
setFlag(QGraphicsItem::ItemIsFocusable, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -215,7 +218,7 @@ void PartTextField::focusOutEvent(QFocusEvent *e) {
|
|||||||
@param e Le QGraphicsSceneMouseEvent qui decrit le double-clic
|
@param e Le QGraphicsSceneMouseEvent qui decrit le double-clic
|
||||||
*/
|
*/
|
||||||
void PartTextField::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *e) {
|
void PartTextField::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *e) {
|
||||||
setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable | QGraphicsItem::ItemIsFocusable);
|
setFlag(QGraphicsItem::ItemIsFocusable, true);
|
||||||
setTextInteractionFlags(Qt::TextEditorInteraction);
|
setTextInteractionFlags(Qt::TextEditorInteraction);
|
||||||
previous_text = toPlainText();
|
previous_text = toPlainText();
|
||||||
QGraphicsTextItem::mouseDoubleClickEvent(e);
|
QGraphicsTextItem::mouseDoubleClickEvent(e);
|
||||||
|
|||||||
Reference in New Issue
Block a user