- fix: While Control is pressed, can't start Drag&Drop by mouse.

This commit is contained in:
Roy Qu 2024-09-12 22:13:41 +08:00
parent 4016c96c96
commit 6d3597db29
4 changed files with 26 additions and 54 deletions

View File

@ -1,12 +1,13 @@
Red Panda C++ Version 3.2 Red Panda C++ Version 3.2
- Change: The way to calcuate astyle path. - change: The way to calcuate astyle path.
- fix: Scroll bar arrow size not correct in the dark themes. - fix: Scroll bar arrow size not correct in the dark themes.
- fix: Don't auto scroll to the caret after undo/redo. - fix: Don't auto scroll to the caret after undo/redo.
- fix: "bits/stdc++" is not openned in readonly mode. - fix: "bits/stdc++" is not openned in readonly mode.
- fix: astyle path error when reformat. - fix: astyle path error when reformat.
- fix: Slow when paste/replace bulk contents. - fix: Slow when paste/replace bulk contents.
- fix: Crash in windows 7. - fix: Crash in windows 7.
- fix: While Control is pressed, can't start Drag&Drop by mouse.
Red Panda C++ Version 3.1 Red Panda C++ Version 3.1

View File

@ -1169,7 +1169,7 @@ void Editor::keyReleaseEvent(QKeyEvent *event)
void Editor::mouseMoveEvent(QMouseEvent *event) void Editor::mouseMoveEvent(QMouseEvent *event)
{ {
if(event->modifiers() == Qt::ControlModifier) { if(event->modifiers() == Qt::ControlModifier && !selAvail()) {
cancelHint(); cancelHint();
QSynedit::BufferCoord p; QSynedit::BufferCoord p;
@ -1185,7 +1185,6 @@ void Editor::mouseMoveEvent(QMouseEvent *event)
} }
return; return;
} }
QSynedit::QSynEdit::mouseMoveEvent(event); QSynedit::QSynEdit::mouseMoveEvent(event);
} }
@ -1486,8 +1485,7 @@ void Editor::mouseReleaseEvent(QMouseEvent *event)
{ {
// if ctrl+clicked // if ctrl+clicked
if ((event->modifiers() == Qt::ControlModifier) if ((event->modifiers() == Qt::ControlModifier)
&& (event->button() == Qt::LeftButton)) { && (event->button() == Qt::LeftButton) && !selAvail()) {
if (!selAvail() ) {
QSynedit::BufferCoord p; QSynedit::BufferCoord p;
if (mParser && pointToCharLine(event->pos(),p)) { if (mParser && pointToCharLine(event->pos(),p)) {
cancelHoverLink(); cancelHoverLink();
@ -1506,7 +1504,6 @@ void Editor::mouseReleaseEvent(QMouseEvent *event)
} }
} }
} }
}
QSynedit::QSynEdit::mouseReleaseEvent(event); QSynedit::QSynEdit::mouseReleaseEvent(event);
} }
@ -4618,16 +4615,6 @@ 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

@ -387,26 +387,11 @@ private:
static QHash<ParserLanguage,std::weak_ptr<CppParser>> mSharedParsers; static QHash<ParserLanguage,std::weak_ptr<CppParser>> mSharedParsers;
// QWidget interface
protected:
void wheelEvent(QWheelEvent *event) override;
void focusInEvent(QFocusEvent *event) override;
void focusOutEvent(QFocusEvent *event) override;
void keyPressEvent(QKeyEvent *event) override;
void keyReleaseEvent(QKeyEvent *event) override;
void mouseMoveEvent(QMouseEvent *event) override;
// SynEdit interface // SynEdit interface
protected: protected:
void onGutterPaint(QPainter &painter, int aLine, int X, int Y) override; void onGutterPaint(QPainter &painter, int aLine, int X, int Y) override;
void onGetEditingAreas(int Line, QSynedit::EditingAreaList &areaList) override; void onGetEditingAreas(int Line, QSynedit::EditingAreaList &areaList) override;
// SynEdit interface
protected:
bool onGetSpecialLineColors(int Line, QColor &foreground, QColor &backgroundColor) override; bool onGetSpecialLineColors(int Line, QColor &foreground, QColor &backgroundColor) override;
// SynEdit interface
protected:
void onPreparePaintHighlightToken(int line, int aChar, const QString &token, QSynedit::PTokenAttribute attr, QSynedit::FontStyles &style, QColor &foreground, QColor &background) override; void onPreparePaintHighlightToken(int line, int aChar, const QString &token, QSynedit::PTokenAttribute attr, QSynedit::FontStyles &style, QColor &foreground, QColor &background) override;
// QObject interface // QObject interface
@ -431,18 +416,18 @@ public:
quint64 lastFocusOutTime() const; quint64 lastFocusOutTime() const;
protected: protected:
void mousePressEvent(QMouseEvent *event) override; // QWidget interface
void wheelEvent(QWheelEvent *event) override;
void focusInEvent(QFocusEvent *event) override;
void focusOutEvent(QFocusEvent *event) override;
void keyPressEvent(QKeyEvent *event) override;
void keyReleaseEvent(QKeyEvent *event) override;
void mouseMoveEvent(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;
// QWidget interface
protected:
void showEvent(QShowEvent *event) override; void showEvent(QShowEvent *event) override;
void hideEvent(QHideEvent *event) override; void hideEvent(QHideEvent *event) override;
// QWidget interface
protected:
void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE; void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
}; };

View File

@ -6051,7 +6051,6 @@ void QSynEdit::mousePressEvent(QMouseEvent *event)
QAbstractScrollArea::mousePressEvent(event); QAbstractScrollArea::mousePressEvent(event);
BufferCoord oldCaret=caretXY(); BufferCoord oldCaret=caretXY();
if (button == Qt::RightButton) { if (button == Qt::RightButton) {
if (mOptions.testFlag(EditorOption::RightMouseMovesCursor) && if (mOptions.testFlag(EditorOption::RightMouseMovesCursor) &&