[qet] [843] Correction : a partir de Qt 4.6, certains evenements ne sont plus signales |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/qet Archives
]
Revision: 843
Author: xavier
Date: 2010-01-20 01:16:55 +0100 (Wed, 20 Jan 2010)
Log Message:
-----------
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.
Modified Paths:
--------------
branches/0.3/sources/editor/partarc.cpp
branches/0.3/sources/editor/partcircle.cpp
branches/0.3/sources/editor/partellipse.cpp
branches/0.3/sources/editor/partline.cpp
branches/0.3/sources/editor/partpolygon.cpp
branches/0.3/sources/editor/partrectangle.cpp
branches/0.3/sources/editor/partterminal.cpp
branches/0.3/sources/editor/parttext.cpp
branches/0.3/sources/editor/parttextfield.cpp
Modified: branches/0.3/sources/editor/partarc.cpp
===================================================================
--- branches/0.3/sources/editor/partarc.cpp 2010-01-20 00:05:32 UTC (rev 842)
+++ branches/0.3/sources/editor/partarc.cpp 2010-01-20 00:16:55 UTC (rev 843)
@@ -31,6 +31,9 @@
start_angle(0)
{
setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
+#if QT_VERSION >= 0x040600
+ setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
+#endif
setAcceptedMouseButtons(Qt::LeftButton);
informations = new ArcEditor(elementEditor(), this);
informations -> setElementTypeName(name());
Modified: branches/0.3/sources/editor/partcircle.cpp
===================================================================
--- branches/0.3/sources/editor/partcircle.cpp 2010-01-20 00:05:32 UTC (rev 842)
+++ branches/0.3/sources/editor/partcircle.cpp 2010-01-20 00:16:55 UTC (rev 843)
@@ -26,6 +26,9 @@
*/
PartCircle::PartCircle(QETElementEditor *editor, QGraphicsItem *parent, QGraphicsScene *scene) : QGraphicsEllipseItem(parent, scene), CustomElementGraphicPart(editor) {
setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
+#if QT_VERSION >= 0x040600
+ setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
+#endif
setAcceptedMouseButtons(Qt::LeftButton);
informations = new CircleEditor(elementEditor(), this);
informations -> setElementTypeName(name());
Modified: branches/0.3/sources/editor/partellipse.cpp
===================================================================
--- branches/0.3/sources/editor/partellipse.cpp 2010-01-20 00:05:32 UTC (rev 842)
+++ branches/0.3/sources/editor/partellipse.cpp 2010-01-20 00:16:55 UTC (rev 843)
@@ -26,6 +26,9 @@
*/
PartEllipse::PartEllipse(QETElementEditor *editor, QGraphicsItem *parent, QGraphicsScene *scene) : QGraphicsEllipseItem(parent, scene), CustomElementGraphicPart(editor) {
setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
+#if QT_VERSION >= 0x040600
+ setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
+#endif
setAcceptedMouseButtons(Qt::LeftButton);
informations = new EllipseEditor(elementEditor(), this);
informations -> setElementTypeName(name());
Modified: branches/0.3/sources/editor/partline.cpp
===================================================================
--- branches/0.3/sources/editor/partline.cpp 2010-01-20 00:05:32 UTC (rev 842)
+++ branches/0.3/sources/editor/partline.cpp 2010-01-20 00:16:55 UTC (rev 843)
@@ -34,6 +34,9 @@
second_length(1.5)
{
setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
+#if QT_VERSION >= 0x040600
+ setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
+#endif
setAcceptedMouseButtons(Qt::LeftButton);
informations = new LineEditor(elementEditor(), this);
informations -> setElementTypeName(name());
Modified: branches/0.3/sources/editor/partpolygon.cpp
===================================================================
--- branches/0.3/sources/editor/partpolygon.cpp 2010-01-20 00:05:32 UTC (rev 842)
+++ branches/0.3/sources/editor/partpolygon.cpp 2010-01-20 00:16:55 UTC (rev 843)
@@ -31,6 +31,9 @@
closed(false)
{
setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
+#if QT_VERSION >= 0x040600
+ setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
+#endif
setAcceptedMouseButtons(Qt::LeftButton);
informations = new PolygonEditor(elementEditor(), this);
informations -> setElementTypeName(name());
Modified: branches/0.3/sources/editor/partrectangle.cpp
===================================================================
--- branches/0.3/sources/editor/partrectangle.cpp 2010-01-20 00:05:32 UTC (rev 842)
+++ branches/0.3/sources/editor/partrectangle.cpp 2010-01-20 00:16:55 UTC (rev 843)
@@ -26,6 +26,9 @@
*/
PartRectangle::PartRectangle(QETElementEditor *editor, QGraphicsItem *parent, QGraphicsScene *scene) : QGraphicsRectItem(parent, scene), CustomElementGraphicPart(editor) {
setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
+#if QT_VERSION >= 0x040600
+ setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
+#endif
setAcceptedMouseButtons(Qt::LeftButton);
informations = new RectangleEditor(elementEditor(), this);
informations -> setElementTypeName(name());
Modified: branches/0.3/sources/editor/partterminal.cpp
===================================================================
--- branches/0.3/sources/editor/partterminal.cpp 2010-01-20 00:05:32 UTC (rev 842)
+++ branches/0.3/sources/editor/partterminal.cpp 2010-01-20 00:16:55 UTC (rev 843)
@@ -34,6 +34,9 @@
informations -> setElementTypeName(name());
updateSecondPoint();
setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
+#if QT_VERSION >= 0x040600
+ setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
+#endif
setZValue(100000);
}
Modified: branches/0.3/sources/editor/parttext.cpp
===================================================================
--- branches/0.3/sources/editor/parttext.cpp 2010-01-20 00:05:32 UTC (rev 842)
+++ branches/0.3/sources/editor/parttext.cpp 2010-01-20 00:16:55 UTC (rev 843)
@@ -37,6 +37,9 @@
setDefaultTextColor(Qt::black);
setFont(QETApp::diagramTextsFont());
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"));
infos = new TextEditor(elementEditor(), this);
infos -> setElementTypeName(name());
@@ -162,7 +165,7 @@
setTextCursor(qtc);
setTextInteractionFlags(Qt::NoTextInteraction);
- setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
+ setFlag(QGraphicsItem::ItemIsFocusable, false);
}
/**
@@ -170,7 +173,7 @@
@param e Le QGraphicsSceneMouseEvent qui decrit le double-clic
*/
void PartText::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *e) {
- setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable | QGraphicsItem::ItemIsFocusable);
+ setFlag(QGraphicsItem::ItemIsFocusable, true);
setTextInteractionFlags(Qt::TextEditorInteraction);
previous_text = toPlainText();
QGraphicsTextItem::mouseDoubleClickEvent(e);
Modified: branches/0.3/sources/editor/parttextfield.cpp
===================================================================
--- branches/0.3/sources/editor/parttextfield.cpp 2010-01-20 00:05:32 UTC (rev 842)
+++ branches/0.3/sources/editor/parttextfield.cpp 2010-01-20 00:16:55 UTC (rev 843)
@@ -35,6 +35,9 @@
setDefaultTextColor(Qt::black);
setFont(QETApp::diagramTextsFont());
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"));
infos = new TextFieldEditor(elementEditor(), this);
infos -> setElementTypeName(name());
@@ -207,7 +210,7 @@
setTextCursor(qtc);
setTextInteractionFlags(Qt::NoTextInteraction);
- setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
+ setFlag(QGraphicsItem::ItemIsFocusable, false);
}
/**
@@ -215,7 +218,7 @@
@param e Le QGraphicsSceneMouseEvent qui decrit le double-clic
*/
void PartTextField::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *e) {
- setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable | QGraphicsItem::ItemIsFocusable);
+ setFlag(QGraphicsItem::ItemIsFocusable, true);
setTextInteractionFlags(Qt::TextEditorInteraction);
previous_text = toPlainText();
QGraphicsTextItem::mouseDoubleClickEvent(e);