Summary: | Hooks for getting the text under the mouse cursor | ||
---|---|---|---|
Product: | [Applications] kate | Reporter: | Jon Smirl <jonsmirl> |
Component: | kwrite | Assignee: | KWrite Developers <kwrite-bugs-null> |
Status: | RESOLVED FIXED | ||
Severity: | wishlist | CC: | trapni |
Priority: | NOR | ||
Version: | SVN | ||
Target Milestone: | --- | ||
Platform: | Compiled Sources | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
Jon Smirl
2003-11-24 20:52:41 UTC
I'm certainly interested in this and it is pretty easy to do. It will require a new extension because of the way the KTextEditor interfaces are designed, and as this counts as a new feature it will have to wait for 3.3/4.0 (unless you can convince the feature freeze police). How would you like this interface to look? A function to retrieve the text cursor position corresponding to the mouse position at the time the function is called is an obvious choice. We could also have a request / signal model, where you ask for events every x ms of idle mouse time, if that's easier. Anyway, for now, if you were really keen (and don't mind an ugly hack) you could, after a set amount of idle time, save the current cursor position and selection boundaries, generate a mouse click, grab the cursor position, and set it all back again. But it would be an ugly hack as things go. I'm also happy to branch ktexteditor for now if you're eager to try this out asap. Cheers, Hamish. Actually, it would seem to me that this is possible using KTextEditor::TextHintInterface, or am I mistaken? I'm happy to help / answer any questions about it / fix bugs etc. I added you offer to the kdevelop bug http://bugs.kde.org/show_bug.cgi?id=60168 You might want to add yourself to the cc list on that one and make the kdevelop bug depend on this one. Subject: Re: Hooks for getting the text under the mouse cursor
> Actually, it would seem to me that this is possible using
> KTextEditor::TextHintInterface, or am I mistaken? I'm happy to help /
> answer any questions about it / fix bugs etc.
yes, it is texthintinterface, atm, the implementation in kate part does not
show the needed popup, only does some debug output. For right implementation,
we should look at qeditor in kdevelop (they have implemented it there and I
hope they have it working and not just for fun). Not much is missing, but as
I have no time to fix it & play with kdevelop and test it before 3.2, I guess
if you want it working somebody else must play a bit with it, should not be
much work and no bigger changes.
cu
Christoph
actually, we've even KDE 3.5 already out there, and it's even 2 years since this bug has been opened and assigned and yet, nothing happened on the coder front. What's up? I'd certainly want this feature for good as well :-) Although, I'd like to point here to my thread I started in the kdevelop-devel mailing list with subject "improving debugging experience ;)" where I was talking exactly about such a behavior (just with a little more improvement over a simple tooltip). Comments? err, fool me. my comments do just implicitely belong to this bug, I was refering to #60168. sorry for causing inconveniences ;) To all people responsible on katepart: Does anybody know, why implementor of TextHintInterface should implement timeout setting ability in enableTextHints? This timeout makes implementation of TextHintInterface much more difficult, because we can't use standart QTooltip with its MaybeTip function overloading! TextHintInterface: virtual void enableTextHints (int timeout)=0; I think, we should use standart QT's tooltip timeout in that interface, or we should ignore timeout argument. I've realized tooltips in my katepart using QTooltip::MaybeTip, it works well with my test project. See http://computing.ee.ethz.ch/sepp/qt-3.1.1-mo/qtooltip.html#maybeTip, and example (dynamic tooltips): http://computing.ee.ethz.ch/sepp/qt-3.1.1-mo/tooltip-example.html#x449. Please, say me, what do you think on such implementation? It's quite simple, and works good... I can post my kateviewinternal.cpp/h here... Is this still an issue? We have an interface now that provides access to text cursor through mouse/pixel coordinates: class KTEXTEDITOR_EXPORT CoordinatesToCursorInterface { public: /** * Get the text-cursor in the document from the screen coordinates, * relative to the view widget. * * To map a cursor to pixel coordinates (the reverse transformation) * use KTextEditor::View::cursorToCoordinate(). * * \param coord coordinates relative to the view widget * \return cursor in the View, that points onto the character under * the given coordinate. May be KTextEditor::Cursor::invalid(). */ virtual KTextEditor::Cursor coordinatesToCursor(const QPoint& coord) const = 0; } fixed through the interface function: KTextEditor::Cursor CoordinatesToCursorInterface::coordinatesToCursor(const QPoint& coord) const Close, as we got no feedback anymore. |