That's exactly what I wound up doing... But its clearly not a code less 
solution :(

-----Original Message-----
From: Joshua Grauman [mailto:[email protected]] 
Sent: Thursday, March 14, 2013 10:30 PM
To: Scott Aron Bloom
Cc: qt-interest ([email protected])
Subject: Re: [Interest] QTBUG-150... Change word separators for QTextCursor 
(QPlainTextEditor)

Scott,

I'm not certain that all these functions exist in QPlainTextEdit, but I'll tell 
you how I did it in QTextEdit by subclassing QTextEdit and reimplementing 
QTextEdit::mouseDoubleClickEvent(QMouseEvent *e). I get the position of the 
mouse click via e->pos(), and then get a QTextCursor using 
QTextEdit::cursorForPosition(const QPoint &). At that point you just need to 
walk backward and forward as far as you want and until you hit whatever word 
separator you want, and then set the text cursor, or (in my case), use 
setExtraSelections() to do more complex selections... Hope that helps.

Josh


> So I have a direct need for the QTBUG-150
>
> https://bugreports.qt-project.org/browse/QTBUG-150?page=com.atlassian.
> jira.plugin.system.issuetabpanels:all-tabpanel
>
> Which basically was as request to allow for a developer defined "word" 
> separator in QPlainTextEdit...
>
> While the original bug filer, and myself have 100% different needs (they 
> wanted to be able to select portions of a regular expression, mine is for a 
> file name) the need is still there...
>
> However, Gunner Sletta, comment "This is easily done by users implementing 
> their own selection based on their own criteria" flippant response is 1) 
> wrong.. If it was so easy, we would figure it out.. 2) violates the code less 
> develop more philosophy..
>
> My question, how do I follow Gunner's suggestion... I need to customize the 
> "double click" functionality, ie, change the word boundaries...
>
>
> Scott
>
_______________________________________________
Interest mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to