[QScintilla] Discovery the correct TextCursor QRect / Coordinate

Phil Thompson phil at riverbankcomputing.com
Tue Aug 7 17:28:35 BST 2007


On Tuesday 07 August 2007 10:43 am, PPK-Webprogramm wrote:
> Hi all on list,
>
> i have implement on QsciScintilla  the QT4 QCompleter [
> http://doc.trolltech.com/4.2/qcompleter.html ] combobox and its run
> Super.. i grab data from a sqlite3 database file ...  + user words.
>
> I can grab and save word on
> http://www.qt-apps.org/content/show.php/QKeyWord+grep+Robot+-+Word-Complete
>r?content=59422
>
> Now my problem i can not find the correct QRect from TextCursor,  how i
> find it?
>
> to start or not the QCompleter i use :
>
> class QSCINTILLA_EXPORT QsciScintilla : public QsciScintillaBase
> {
>     Q_OBJECT
>
> public:
> .......
> inline QString TextUnderCursor() {
>     return getWord(SendScintilla(SCI_GETCURRENTPOS));
>     }
> ........
>
> How to make the same to have it QRect
> http://doc.trolltech.com/4.3/qrect.html  ?
>
> http://www.qtcentre.org/forum/f-qt-programming-2/t-move-qcompleter-on-qrect
>-xy-8421.html screenshoot:
> http://www.qtcentre.org/forum/attachment.php?attachmentid=1456&d=1186397139

Are the SCI_POINTXFROMPOSITION and SCI_POINYFROMPOSITION messages what you 
want? See...

http://scintilla.sourceforge.net/ScintillaDoc.html#SCI_POINTXFROMPOSITION

If so I don't mind adding a convenience method that returns a QPoint for the 
current cursor position - or whatever you need.

Phil


More information about the QScintilla mailing list