Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Multimedia
Kdenlive
Commits
0b5046ff
Commit
0b5046ff
authored
Feb 16, 2021
by
Julius Künzel
Browse files
Fix invisible text cursor in title editor
#165
and other minor tweaks
BUG: 403941
BUG: 407497
parent
923175f9
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/titler/graphicsscenerectmove.cpp
View file @
0b5046ff
...
...
@@ -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
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment