aboutsummaryrefslogtreecommitdiffhomepage
path: root/qt
diff options
context:
space:
mode:
authormitchell <unknown>2019-02-17 17:45:23 -0500
committermitchell <unknown>2019-02-17 17:45:23 -0500
commitca6456fe971e9a6270c01c22bcbc39a91e583aa8 (patch)
tree45e33f09380261e02a0a9311ccb7f6305f83957b /qt
parent0eb472cabe01f68cab7e7a07a004f45dc8c53780 (diff)
downloadscintilla-mirror-ca6456fe971e9a6270c01c22bcbc39a91e583aa8.tar.gz
Backport: Bug [#1548]. Implement calltips on Qt.
Backport of changeset 7237:a82b87a88556 and 7238:ba336ac439f0.
Diffstat (limited to 'qt')
-rw-r--r--qt/ScintillaEditBase/ScintillaQt.cpp29
1 files changed, 28 insertions, 1 deletions
diff --git a/qt/ScintillaEditBase/ScintillaQt.cpp b/qt/ScintillaEditBase/ScintillaQt.cpp
index 804cd2dc0..98a8000fa 100644
--- a/qt/ScintillaEditBase/ScintillaQt.cpp
+++ b/qt/ScintillaEditBase/ScintillaQt.cpp
@@ -613,11 +613,38 @@ void ScintillaQt::StartDrag()
SetDragPosition(SelectionPosition(Sci::invalidPosition));
}
+class CallTipImpl : public QWidget {
+public:
+ CallTipImpl(CallTip *pct_)
+ : QWidget(nullptr, Qt::ToolTip),
+ pct(pct_)
+ {
+#if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)
+ setWindowFlag(Qt::WindowTransparentForInput);
+#endif
+ }
+
+ 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());