- fix: hide function tip when scroll

- fix: short cut for goto definition/declaration doesn't work
This commit is contained in:
Roy Qu 2022-03-18 23:13:43 +08:00
parent d840622b58
commit ab4ca36fa4
6 changed files with 37 additions and 8 deletions

View File

@ -1,5 +1,7 @@
Red Panda C++ Version 1.0.1
- fix: only convert project icon file when it's filename doesn't end with ".ico"
- fix: hide function tip when scroll
- fix: short cut for goto definition/declaration doesn't work
Red Panda C++ Version 1.0.0
- fix: calculation for code snippets's tab stop positions is not correct

View File

@ -44,6 +44,7 @@
#include <QPrintDialog>
#include <QTextDocument>
#include <QTextCodec>
#include <QScrollBar>
#include "iconsmanager.h"
#include "debugger.h"
#include "editorlist.h"
@ -177,6 +178,11 @@ Editor::Editor(QWidget *parent, const QString& filename,
}
connect(&mFunctionTipTimer, &QTimer::timeout,
this, &Editor::onFunctionTipsTimer);
connect(horizontalScrollBar(), &QScrollBar::valueChanged,
this, &Editor::onScrollBarValueChanged);
connect(verticalScrollBar(), &QScrollBar::valueChanged,
this, &Editor::onScrollBarValueChanged);
}
Editor::~Editor() {
@ -3723,6 +3729,11 @@ void Editor::onExportedFormatToken(PSynHighlighter syntaxHighlighter, int Line,
}
}
void Editor::onScrollBarValueChanged()
{
pMainWindow->functionTip()->hide();
}
bool Editor::canAutoSave() const
{
return mCanAutoSave;
@ -3787,11 +3798,14 @@ void Editor::setInProject(bool newInProject)
void Editor::gotoDeclaration(const BufferCoord &pos)
{
qDebug()<<"???";
if (!parser())
return;
// Exit early, don't bother creating a stream (which is slow)
QStringList expression = getExpressionAtPosition(pos);
qDebug()<<expression;
// Find it's definition
PStatement statement = parser()->findStatementOf(
filename(),

View File

@ -283,6 +283,7 @@ private:
void popUserCodeInTabStops();
void onExportedFormatToken(PSynHighlighter syntaxHighlighter, int Line, int column, const QString& token,
PSynHighlighterAttribute &attr);
void onScrollBarValueChanged();
private:
QByteArray mEncodingOption; // the encoding type set by the user
QByteArray mFileEncoding; // the real encoding of the file (auto detected)

View File

@ -5266,19 +5266,16 @@ void MainWindow::on_actionBreakpoint_property_triggered()
void MainWindow::on_actionGoto_Declaration_triggered()
{
Editor * editor = mEditorList->getEditor();
BufferCoord pos;
if (editor && editor->pointToCharLine(mEditorContextMenuPos,pos)) {
editor->gotoDeclaration(pos);
if (editor) {
editor->gotoDeclaration(editor->caretXY());
}
}
void MainWindow::on_actionGoto_Definition_triggered()
{
Editor * editor = mEditorList->getEditor();
BufferCoord pos;
if (editor && editor->pointToCharLine(mEditorContextMenuPos,pos)) {
editor->gotoDefinition(pos);
if (editor) {
editor->gotoDefinition(editor->caretXY());
}
}

View File

@ -5795,6 +5795,19 @@ void SynEdit::updateMouseCursor(){
}
}
bool SynEdit::isCaretVisible()
{
if (mCaretY < mTopLine)
return false;
if (mCaretY >= mTopLine + mLinesInWindow )
return false;
if (mCaretX < mLeftChar)
return false;
if (mCaretX >= mLeftChar + mCharsInWindow)
return false;
return true;
}
void SynEdit::paintEvent(QPaintEvent *event)
{
if (mPainterLock>0)

View File

@ -300,6 +300,8 @@ public:
void updateMouseCursor();
bool isCaretVisible();
// setter && getters
int topLine() const;
void setTopLine(int value);