- change: Set mouse cursor to hand pointing when it's on gutter.

- fix: mouse cursor doesn't change when move back to editor.
This commit is contained in:
Roy Qu 2023-10-23 21:46:13 +08:00
parent 4b6fcd2e90
commit 1c23010408
4 changed files with 8 additions and 6 deletions

View File

@ -13,6 +13,7 @@ Red Panda C++ Version 2.26
- change: Don't change caret position when ctrl+click. - change: Don't change caret position when ctrl+click.
- fix: Should cd to working directory when debugging. - fix: Should cd to working directory when debugging.
- change: Ensure the line just below caret is visible while moving caret. - change: Ensure the line just below caret is visible while moving caret.
- change: Set mouse cursor to hand pointing when it's on gutter.
Red Panda C++ Version 2.25 Red Panda C++ Version 2.25

View File

@ -15,7 +15,7 @@ APP_NAME = RedPandaCPP
APP_VERSION = 2.26 APP_VERSION = 2.26
TEST_VERSION = alpha3 TEST_VERSION = alpha4
contains(QMAKE_HOST.arch, x86_64):{ contains(QMAKE_HOST.arch, x86_64):{
DEFINES += ARCH_X86_64=1 DEFINES += ARCH_X86_64=1

View File

@ -712,7 +712,7 @@ void Editor::keyPressEvent(QKeyEvent *event)
&& !mCompletionPopup->isVisible() && !mCompletionPopup->isVisible()
&& !mHeaderCompletionPopup->isVisible() && !mHeaderCompletionPopup->isVisible()
) { ) {
setMouseTracking(true); //setMouseTracking(true);
handled=true; handled=true;
QMouseEvent mouseEvent{ QMouseEvent mouseEvent{
QEvent::MouseMove, QEvent::MouseMove,
@ -1067,7 +1067,7 @@ void Editor::keyReleaseEvent(QKeyEvent *event)
{ {
if (event->modifiers() == Qt::NoModifier if (event->modifiers() == Qt::NoModifier
&& event->key() == Qt::Key_Control) { && event->key() == Qt::Key_Control) {
setMouseTracking(false); //setMouseTracking(false);
cancelHoverLink(); cancelHoverLink();
updateMouseCursor(); updateMouseCursor();
return; return;
@ -1943,7 +1943,7 @@ void Editor::onAutoBackupTimer()
void Editor::onTooltipTimer() void Editor::onTooltipTimer()
{ {
if (cursor() == Qt::PointingHandCursor) if (mHoverModifiedLine != -1)
return; return;
QSynedit::BufferCoord p; QSynedit::BufferCoord p;

View File

@ -156,7 +156,7 @@ QSynEdit::QSynEdit(QWidget *parent) : QAbstractScrollArea(parent),
//enable input method //enable input method
setAttribute(Qt::WA_InputMethodEnabled); setAttribute(Qt::WA_InputMethodEnabled);
//setMouseTracking(true); setMouseTracking(true);
setAcceptDrops(true); setAcceptDrops(true);
setFont(mFontDummy); setFont(mFontDummy);
@ -5989,7 +5989,7 @@ void QSynEdit::updateMouseCursor(){
} else if (p.x() > mGutterWidth) { } else if (p.x() > mGutterWidth) {
setCursor(Qt::IBeamCursor); setCursor(Qt::IBeamCursor);
} else { } else {
setCursor(Qt::ArrowCursor); setCursor(Qt::PointingHandCursor);
} }
} }
@ -6139,6 +6139,7 @@ bool QSynEdit::event(QEvent *event)
void QSynEdit::focusInEvent(QFocusEvent *) void QSynEdit::focusInEvent(QFocusEvent *)
{ {
showCaret(); showCaret();
updateMouseCursor();
} }
void QSynEdit::focusOutEvent(QFocusEvent *) void QSynEdit::focusOutEvent(QFocusEvent *)