- 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,24 +1485,22 @@ 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(); QString sLine = lineText(p.line);
QString sLine = lineText(p.line); if (mParser->isIncludeNextLine(sLine)) {
if (mParser->isIncludeNextLine(sLine)) { QString filename = mParser->getHeaderFileName(mFilename,sLine, true);
QString filename = mParser->getHeaderFileName(mFilename,sLine, true); pMainWindow->openFile(filename);
pMainWindow->openFile(filename); return;
return; } if (mParser->isIncludeLine(sLine)) {
} if (mParser->isIncludeLine(sLine)) { QString filename = mParser->getHeaderFileName(mFilename,sLine);
QString filename = mParser->getHeaderFileName(mFilename,sLine); pMainWindow->openFile(filename);
pMainWindow->openFile(filename); return;
return; } else if (mParser->enabled()) {
} else if (mParser->enabled()) { gotoDefinition(p);
gotoDefinition(p); return;
return;
}
} }
} }
} }
@ -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) &&