- change: Don't change caret position when ctrl+click.

This commit is contained in:
Roy Qu 2023-10-23 10:13:46 +08:00
parent e0b9bfb4c8
commit cdb0197aea
3 changed files with 13 additions and 1 deletions

View File

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

View File

@ -1363,6 +1363,7 @@ void Editor::mouseReleaseEvent(QMouseEvent *event)
if (!selAvail() && mHoverModifiedLine != -1) { if (!selAvail() && mHoverModifiedLine != -1) {
QSynedit::BufferCoord p; QSynedit::BufferCoord p;
if (mParser && pointToCharLine(event->pos(),p)) { if (mParser && pointToCharLine(event->pos(),p)) {
cancelHoverLink();
QString s = document()->getLine(p.line - 1); QString s = document()->getLine(p.line - 1);
if (mParser->isIncludeNextLine(s)) { if (mParser->isIncludeNextLine(s)) {
QString filename = mParser->getHeaderFileName(mFilename,s, true); QString filename = mParser->getHeaderFileName(mFilename,s, true);
@ -4536,6 +4537,16 @@ void Editor::setCanAutoSave(bool newCanAutoSave)
mCanAutoSave = newCanAutoSave; mCanAutoSave = newCanAutoSave;
} }
void Editor::mousePressEvent(QMouseEvent *event)
{
if ((event->modifiers() == Qt::ControlModifier)
&& (event->button() == Qt::LeftButton)) {
event->accept();
return;
}
QSynedit::QSynEdit::mousePressEvent(event);
}
const QDateTime &Editor::hideTime() const const QDateTime &Editor::hideTime() const
{ {
return mHideTime; return mHideTime;

View File

@ -401,6 +401,7 @@ public:
void setCanAutoSave(bool newCanAutoSave); void setCanAutoSave(bool newCanAutoSave);
protected: protected:
void mousePressEvent(QMouseEvent *event) override;
void mouseReleaseEvent(QMouseEvent *event) override; void mouseReleaseEvent(QMouseEvent *event) override;
void inputMethodEvent(QInputMethodEvent *) override; void inputMethodEvent(QInputMethodEvent *) override;
void closeEvent(QCloseEvent *event) override; void closeEvent(QCloseEvent *event) override;