diff options
| -rw-r--r-- | doc/ScintillaDoc.html | 2 | ||||
| -rw-r--r-- | doc/ScintillaHistory.html | 5 | ||||
| -rw-r--r-- | qt/ScintillaEditBase/ScintillaQt.cpp | 27 | 
3 files changed, 31 insertions, 3 deletions
| diff --git a/doc/ScintillaDoc.html b/doc/ScintillaDoc.html index 891b4ce7d..d1ce91a31 100644 --- a/doc/ScintillaDoc.html +++ b/doc/ScintillaDoc.html @@ -5002,8 +5002,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 6a90f17e0..ec2e9d874 100644 --- a/doc/ScintillaHistory.html +++ b/doc/ScintillaHistory.html @@ -540,6 +540,7 @@  	<td>jj5</td>        </tr><tr>  	<td>Jad Altahan</td> +	<td>Andrea Ricchi</td>      </tr>      </table>      <p> @@ -558,6 +559,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..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()); | 
