Backport Qt implementation of calltips in Scintilla

* Taken from https://sourceforge.net/p/scintilla/code/ci/a82b87a88556f0bc23b7ff6
  f4bdfd5241ef44a62/ upstream
This commit is contained in:
baldurk
2026-08-13 17:46:42 +01:00
parent 09c036bd36
commit ed52bc55df
@@ -616,11 +616,36 @@ void ScintillaQt::StartDrag()
SetDragPosition(SelectionPosition(invalidPosition));
}
class CallTipImpl : public QWidget {
public:
CallTipImpl(CallTip *pct_)
: QWidget(nullptr, Qt::ToolTip),
pct(pct_)
{
setWindowFlag(Qt::WindowTransparentForInput);
}
void paintEvent(QPaintEvent *) override
{
if (pct->inCallTipMode) {
Surface *surfaceWindow = Surface::Allocate(0);
surfaceWindow->Init(this);
surfaceWindow->SetUnicodeMode(SC_CP_UTF8 == pct->codePage);
surfaceWindow->SetDBCSMode(pct->codePage);
pct->PaintCT(surfaceWindow);
delete surfaceWindow;
}
}
private:
CallTip *pct;
};
void ScintillaQt::CreateCallTipWindow(PRectangle rc)
{
if (!ct.wCallTip.Created()) {
QWidget *pCallTip = new QWidget(0, Qt::ToolTip);
QWidget *pCallTip = new CallTipImpl(&ct);
ct.wCallTip = pCallTip;
pCallTip->move(rc.left, rc.top);
pCallTip->resize(rc.Width(), rc.Height());