- enhancement: Adjust function tip pos to prevent it from run outside the right window edge.

This commit is contained in:
Roy Qu 2024-03-27 11:32:56 +08:00
parent 2b9ece18ad
commit f88898ae1e
3 changed files with 10 additions and 8 deletions

View File

@ -95,6 +95,7 @@ Red Panda C++ Version 2.27
- fix: Remove duplicated macro defines make it's lost in the parse result. - fix: Remove duplicated macro defines make it's lost in the parse result.
- fix: An undefined macro is still missing the the parse result after #undef is removed. - fix: An undefined macro is still missing the the parse result after #undef is removed.
- fix: If a class method is overloaded, only one of them is inherited by it's children. - fix: If a class method is overloaded, only one of them is inherited by it's children.
- enhancement: Adjust function tip pos to prevent it from run outside the right window edge.
Red Panda C++ Version 2.26 Red Panda C++ Version 2.26
- enhancement: Code suggestion for embedded std::vectors. - enhancement: Code suggestion for embedded std::vectors.

View File

@ -4400,13 +4400,16 @@ void Editor::updateFunctionTip(bool showTip)
// Position it at the top of the next line // Position it at the top of the next line
QPoint p = displayCoordToPixels(displayXY()); QPoint p = displayCoordToPixels(displayXY());
p+=QPoint(0,textHeight()+2); p+=QPoint(0,textHeight()+2);
pMainWindow->functionTip()->move(mapToGlobal(p));
pMainWindow->functionTip()->setFunctioFullName(s); pMainWindow->functionTip()->setFunctioFullName(s);
pMainWindow->functionTip()->guessFunction(paramsCount-1); pMainWindow->functionTip()->guessFunction(paramsCount-1);
pMainWindow->functionTip()->setParamIndex( pMainWindow->functionTip()->setParamIndex(
currentParamPos currentParamPos
); );
int w = pMainWindow->functionTip()->width();
if (w+p.x() > clientWidth())
p.setX(clientWidth()-w-2);
pMainWindow->functionTip()->move(mapToGlobal(p));
cancelHint(); cancelHint();
if (showTip) if (showTip)
pMainWindow->functionTip()->show(); pMainWindow->functionTip()->show();

View File

@ -494,8 +494,12 @@ protected:
virtual void onProcessCommand(EditCommand command, QChar car, void * pData); virtual void onProcessCommand(EditCommand command, QChar car, void * pData);
virtual void onCommandProcessed(EditCommand command, QChar car, void * pData); virtual void onCommandProcessed(EditCommand command, QChar car, void * pData);
virtual void executeCommand(EditCommand command, QChar ch, void * pData); virtual void executeCommand(EditCommand command, QChar ch, void * pData);
protected: protected:
int clientWidth() const;
int clientHeight() const;
int clientTop() const;
int clientLeft() const;
QRect clientRect() const;
void doSelectLine(); void doSelectLine();
void incPaintLock(); void incPaintLock();
void decPaintLock(); void decPaintLock();
@ -510,12 +514,6 @@ private:
void computeCaret(); void computeCaret();
void computeScroll(bool isDragging); void computeScroll(bool isDragging);
int clientWidth() const;
int clientHeight() const;
int clientTop() const;
int clientLeft() const;
QRect clientRect() const;
void synFontChanged(); void synFontChanged();
void doSetSelText(const QString& value); void doSetSelText(const QString& value);