- 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
- 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: Don't auto scroll to the caret after undo/redo.
- fix: "bits/stdc++" is not openned in readonly mode.
- fix: astyle path error when reformat.
- fix: Slow when paste/replace bulk contents.
- fix: Crash in windows 7.
- fix: While Control is pressed, can't start Drag&Drop by mouse.
Red Panda C++ Version 3.1

View File

@ -1169,7 +1169,7 @@ void Editor::keyReleaseEvent(QKeyEvent *event)
void Editor::mouseMoveEvent(QMouseEvent *event)
{
if(event->modifiers() == Qt::ControlModifier) {
if(event->modifiers() == Qt::ControlModifier && !selAvail()) {
cancelHint();
QSynedit::BufferCoord p;
@ -1185,7 +1185,6 @@ void Editor::mouseMoveEvent(QMouseEvent *event)
}
return;
}
QSynedit::QSynEdit::mouseMoveEvent(event);
}
@ -1486,24 +1485,22 @@ void Editor::mouseReleaseEvent(QMouseEvent *event)
{
// if ctrl+clicked
if ((event->modifiers() == Qt::ControlModifier)
&& (event->button() == Qt::LeftButton)) {
if (!selAvail() ) {
QSynedit::BufferCoord p;
if (mParser && pointToCharLine(event->pos(),p)) {
cancelHoverLink();
QString sLine = lineText(p.line);
if (mParser->isIncludeNextLine(sLine)) {
QString filename = mParser->getHeaderFileName(mFilename,sLine, true);
pMainWindow->openFile(filename);
return;
} if (mParser->isIncludeLine(sLine)) {
QString filename = mParser->getHeaderFileName(mFilename,sLine);
pMainWindow->openFile(filename);
return;
} else if (mParser->enabled()) {
gotoDefinition(p);
return;
}
&& (event->button() == Qt::LeftButton) && !selAvail()) {
QSynedit::BufferCoord p;
if (mParser && pointToCharLine(event->pos(),p)) {
cancelHoverLink();
QString sLine = lineText(p.line);
if (mParser->isIncludeNextLine(sLine)) {
QString filename = mParser->getHeaderFileName(mFilename,sLine, true);
pMainWindow->openFile(filename);
return;
} if (mParser->isIncludeLine(sLine)) {
QString filename = mParser->getHeaderFileName(mFilename,sLine);
pMainWindow->openFile(filename);
return;
} else if (mParser->enabled()) {
gotoDefinition(p);
return;
}
}
}
@ -4618,16 +4615,6 @@ void Editor::setCanAutoSave(bool 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
{
return mHideTime;

View File

@ -387,26 +387,11 @@ private:
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
protected:
void onGutterPaint(QPainter &painter, int aLine, int X, int Y) override;
void onGetEditingAreas(int Line, QSynedit::EditingAreaList &areaList) override;
// SynEdit interface
protected:
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;
// QObject interface
@ -431,18 +416,18 @@ public:
quint64 lastFocusOutTime() const;
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 inputMethodEvent(QInputMethodEvent *) override;
void closeEvent(QCloseEvent *event) override;
// QWidget interface
protected:
void showEvent(QShowEvent *event) override;
void hideEvent(QHideEvent *event) override;
// QWidget interface
protected:
void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
};

View File

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