mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-05 22:09:52 +08:00
VTextEdit: force to update() to show cursor while dragging text
This is a work-around.
This commit is contained in:
parent
42fbdace55
commit
21e5aac024
@ -793,16 +793,6 @@ void VTextDocumentLayout::updateDocumentSize()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void VTextDocumentLayout::setCursorWidth(int p_width)
|
|
||||||
{
|
|
||||||
m_cursorWidth = p_width;
|
|
||||||
}
|
|
||||||
|
|
||||||
int VTextDocumentLayout::cursorWidth() const
|
|
||||||
{
|
|
||||||
return m_cursorWidth;
|
|
||||||
}
|
|
||||||
|
|
||||||
QRectF VTextDocumentLayout::blockRectFromTextLayout(const QTextBlock &p_block,
|
QRectF VTextDocumentLayout::blockRectFromTextLayout(const QTextBlock &p_block,
|
||||||
ImagePaintInfo *p_image)
|
ImagePaintInfo *p_image)
|
||||||
{
|
{
|
||||||
|
@ -385,4 +385,14 @@ inline void VTextDocumentLayout::setCursorLineBlockNumber(int p_blockNumber)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline void VTextDocumentLayout::setCursorWidth(int p_width)
|
||||||
|
{
|
||||||
|
m_cursorWidth = p_width;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline int VTextDocumentLayout::cursorWidth() const
|
||||||
|
{
|
||||||
|
return m_cursorWidth;
|
||||||
|
}
|
||||||
#endif // VTEXTDOCUMENTLAYOUT_H
|
#endif // VTEXTDOCUMENTLAYOUT_H
|
||||||
|
@ -447,3 +447,14 @@ void VTextEdit::updateLineNumberAreaWidth(const QFontMetrics &p_metrics)
|
|||||||
{
|
{
|
||||||
m_lineNumberArea->setDigitWidth(p_metrics.width(QLatin1Char('8')));
|
m_lineNumberArea->setDigitWidth(p_metrics.width(QLatin1Char('8')));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void VTextEdit::dragMoveEvent(QDragMoveEvent *p_event)
|
||||||
|
{
|
||||||
|
QTextEdit::dragMoveEvent(p_event);
|
||||||
|
|
||||||
|
// We need to update the cursor rect to show the cursor while dragging text.
|
||||||
|
// This is a work-around. We do not know why VTextEdit won't update the cursor
|
||||||
|
// rect to show the cursor.
|
||||||
|
// TODO: find out the rect of current cursor to update that rect only.
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
@ -83,6 +83,8 @@ protected:
|
|||||||
|
|
||||||
void updateLineNumberAreaWidth(const QFontMetrics &p_metrics);
|
void updateLineNumberAreaWidth(const QFontMetrics &p_metrics);
|
||||||
|
|
||||||
|
void dragMoveEvent(QDragMoveEvent *p_event) Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
// Update viewport margin to hold the line number area.
|
// Update viewport margin to hold the line number area.
|
||||||
void updateLineNumberAreaMargin();
|
void updateLineNumberAreaMargin();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user