aboutsummaryrefslogtreecommitdiffhomepage
path: root/qt/ScintillaEditBase/ScintillaQt.cpp
diff options
context:
space:
mode:
authorAndrea Ricchi <unknown>2019-01-24 10:41:41 +1100
committerAndrea Ricchi <unknown>2019-01-24 10:41:41 +1100
commit1d136228bb4394f8dba6ab9139217d4d64078159 (patch)
treecaaa2e5ae65ce77b9e660f3fed74c58c73d68c82 /qt/ScintillaEditBase/ScintillaQt.cpp
parentab2105ce4a7838df7d4d45410fd8aa46973893dc (diff)
downloadscintilla-mirror-1d136228bb4394f8dba6ab9139217d4d64078159.tar.gz
Bug [#1548]. Implement calltips on Qt.
Diffstat (limited to 'qt/ScintillaEditBase/ScintillaQt.cpp')
-rw-r--r--qt/ScintillaEditBase/ScintillaQt.cpp27
1 files changed, 26 insertions, 1 deletions
diff --git a/qt/ScintillaEditBase/ScintillaQt.cpp b/qt/ScintillaEditBase/ScintillaQt.cpp
index 804cd2dc0..dcdd7e314 100644
--- a/qt/ScintillaEditBase/ScintillaQt.cpp
+++ b/qt/ScintillaEditBase/ScintillaQt.cpp
@@ -613,11 +613,36 @@ void ScintillaQt::StartDrag()
SetDragPosition(SelectionPosition(Sci::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());