Commit f6b3e27f authored by Vincent Pinon's avatar Vincent Pinon
Browse files

Apply !180 fixing #165

parents ebb65fc9 0b5046ff
Pipeline #51268 passed with stage
in 10 minutes and 24 seconds
......@@ -67,7 +67,8 @@ MyTextItem::MyTextItem(const QString &txt, QGraphicsItem *parent)
: QGraphicsTextItem(txt, parent)
, m_alignment(qApp->isLeftToRight() ? Qt::AlignRight : Qt::AlignLeft)
{
setCacheMode(QGraphicsItem::ItemCoordinateCache);
//Disabled because cache makes text cursor invisible and borders ugly
//setCacheMode(QGraphicsItem::ItemCoordinateCache);
setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
document()->setDocumentMargin(0);
m_shadowEffect = new MyQGraphicsEffect(this);
......@@ -409,6 +410,7 @@ void MyTextItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *evt)
// SetTextInteraction(true);
setTextInteractionFlags(Qt::TextEditorInteraction);
setFocus(Qt::MouseFocusReason);
setCursor(QCursor(Qt::IBeamCursor));
// 2. send a single click to this QGraphicsTextItem (this will set the cursor to the mouse position):
// create a new mouse event with the same parameters as evt
auto *click = new QGraphicsSceneMouseEvent(QEvent::GraphicsSceneMousePress);
......@@ -421,7 +423,8 @@ void MyTextItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *evt)
MyRectItem::MyRectItem(QGraphicsItem *parent)
: QGraphicsRectItem(parent)
{
setCacheMode(QGraphicsItem::ItemCoordinateCache);
//Disabled because cache makes text cursor invisible and borders ugly
//setCacheMode(QGraphicsItem::ItemCoordinateCache);
setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
}
......@@ -454,7 +457,8 @@ QVariant MyRectItem::itemChange(GraphicsItemChange change, const QVariant &value
MyPixmapItem::MyPixmapItem(const QPixmap &pixmap, QGraphicsItem *parent)
: QGraphicsPixmapItem(pixmap, parent)
{
setCacheMode(QGraphicsItem::ItemCoordinateCache);
//Disabled because cache makes text cursor invisible and borders ugly
//setCacheMode(QGraphicsItem::ItemCoordinateCache);
setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
}
......@@ -477,7 +481,8 @@ QVariant MyPixmapItem::itemChange(GraphicsItemChange change, const QVariant &val
MySvgItem::MySvgItem(const QString &fileName, QGraphicsItem *parent)
: QGraphicsSvgItem(fileName, parent)
{
setCacheMode(QGraphicsItem::ItemCoordinateCache);
//Disabled because cache makes text cursor invisible and borders ugly
//setCacheMode(QGraphicsItem::ItemCoordinateCache);
setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
}
......@@ -792,6 +797,7 @@ void GraphicsSceneRectMove::clearTextSelection(bool reset)
QTextBlock cur = t->textCursor().block();
t->setTextCursor(QTextCursor(cur));
t->setTextInteractionFlags(Qt::NoTextInteraction);
t->unsetCursor();
}
if (reset) {
m_selectedItem = nullptr;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment