aboutsummaryrefslogtreecommitdiffhomepage
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
parent0eb472cabe01f68cab7e7a07a004f45dc8c53780 (diff)
downloadscintilla-mirror-ca6456fe971e9a6270c01c22bcbc39a91e583aa8.tar.gz
Backport: Bug [#1548]. Implement calltips on Qt.
Backport of changeset 7237:a82b87a88556 and 7238:ba336ac439f0.
-rw-r--r--doc/ScintillaDoc.html2
-rw-r--r--doc/ScintillaHistory.html5
-rw-r--r--qt/ScintillaEditBase/ScintillaQt.cpp29
3 files changed, 33 insertions, 3 deletions
diff --git a/doc/ScintillaDoc.html b/doc/ScintillaDoc.html
index fdf1e36c0..e897060ae 100644
--- a/doc/ScintillaDoc.html
+++ b/doc/ScintillaDoc.html
@@ -4975,8 +4975,6 @@ struct Sci_TextToFind {
There is some interaction between call tips and autocompletion lists in that showing a
call tip cancels any active autocompletion list, and vice versa.</p>
- <p>Call tips are not implemented on Qt.</p>
-
<p>Call tips can highlight part of the text within them. You could use this to highlight the
current argument to a function by counting the number of commas (or whatever separator your
language uses). See <code>SciTEBase::CharAdded()</code> in <code>SciTEBase.cxx</code> for an
diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html
index bf31ff711..7ede2b761 100644
--- a/doc/ScintillaHistory.html
+++ b/doc/ScintillaHistory.html
@@ -530,6 +530,7 @@
<td>Gokul Krishnan</td>
</tr><tr>
<td>Jad Altahan</td>
+ <td>Andrea Ricchi</td>
</tr>
</table>
<p>
@@ -548,6 +549,10 @@
<li>
Released 10 January 2019.
</li>
+ <li>
+ Calltips implemented on Qt.
+ <a href="https://sourceforge.net/p/scintilla/bugs/1548/">Bug #1548</a>.
+ </li>
<li>
The C++ lexer, with styling.within.preprocessor on, now interprets "(" in preprocessor "#if("
as an operator instead of part of the directive. This improves folding as well which could become
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());