KDE

NAVIGATION
CATEGORIES
REFERRENCE
LINKS
  • Kate::View::word(int , int )

    10 answers - 459 bytes - related search similar search Add To My Delicious Add To My Stumble Upon Add To My Google Mark Add To My Facebook Add To My Digg Add To My Reddit

    Hi,
    I want to be able to use the Kate::View::word(int, int ) function, but it
    always returns an empty string. Further, as the default implementation in the
    Kate::View interface just returns an empty string, and there don't seem to be
    any reimplementations of the function - is the function actually implemented
    somewhere?
    Thanks,
    David Saxton
    KWrite-Devel mailing list
    KWrite-Devel (AT) kde (DOT) org
  • No.1 | | 524 bytes | |

    Monday 19 December 2005 21:54, David Saxton wrote:
    Hi,

    I want to be able to use the Kate::View::word(int, int ) function, but it
    always returns an empty string. Further, as the default implementation in
    the Kate::View interface just returns an empty string, and there don't seem
    to be any reimplementations of the function - is the function actually
    implemented somewhere?
    Not really, the Kate::View interfaces are removed for KDE 4, I won't try to
    rely on them.

    cu
    Christoph
  • No.2 | | 797 bytes | |

    Monday 19 December 2005 21:18, Christoph Cullmann wrote:
    Monday 19 December 2005 21:54, David Saxton wrote:
    Hi,

    I want to be able to use the Kate::View::word(int, int ) function, but it
    always returns an empty string. Further, as the default implementation in
    the Kate::View interface just returns an empty string, and there don't
    seem to be any reimplementations of the function - is the function
    actually implemented somewhere?

    Not really, the Kate::View interfaces are removed for KDE 4, I won't try to
    rely on them.

    KDE 4 isn't out for a few years thoughIs it possible at all to find
    out the word under the mouse cursor, even in a really hacky way?

    KWrite-Devel mailing list
    KWrite-Devel (AT) kde (DOT) org
  • No.3 | | 911 bytes | |

    Monday 19 December 2005 22:33, David Saxton wrote:
    Monday 19 December 2005 21:18, Christoph Cullmann wrote:
    Monday 19 December 2005 21:54, David Saxton wrote:
    Hi,

    I want to be able to use the Kate::View::word(int, int ) function, but
    it always returns an empty string. Further, as the default
    implementation in the Kate::View interface just returns an empty
    string, and there don't seem to be any reimplementations of the
    function - is the function actually implemented somewhere?

    Not really, the Kate::View interfaces are removed for KDE 4, I won't try
    to rely on them.

    KDE 4 isn't out for a few years thoughIs it possible at all to find
    out the word under the mouse cursor, even in a really hacky way?
    Not sure if it's possible for "outsiders" using the public API, the texthint
    interface was aimed for this, is it working in KDE 3.5?
  • No.4 | | 1967 bytes | |

    Monday 19 December 2005 21:53, Christoph Cullmann wrote:
    Monday 19 December 2005 22:33, David Saxton wrote:
    Monday 19 December 2005 21:18, Christoph Cullmann wrote:
    Monday 19 December 2005 21:54, David Saxton wrote:
    Hi,

    I want to be able to use the Kate::View::word(int, int ) function,
    but it always returns an empty string. Further, as the default
    implementation in the Kate::View interface just returns an empty
    string, and there don't seem to be any reimplementations of the
    function - is the function actually implemented somewhere?

    Not really, the Kate::View interfaces are removed for KDE 4, I won't
    try to rely on them.

    KDE 4 isn't out for a few years thoughIs it possible at all to
    find out the word under the mouse cursor, even in a really hacky way?

    Not sure if it's possible for "outsiders" using the public API, the
    texthint interface was aimed for this, is it working in KDE 3.5?

    I can't get it to work.

    I sent an email to this mailing list asking about the texthint interface a
    week ago, but I didn't receive any reply:

    Forwarded Message

    Subject: Want to get word under mouse on mouse move
    Date: Monday 12 December 2005 17:30
    From: David Saxton <david (AT) bluehaze (DOT) org>
    To: kwrite-devel (AT) kde (DOT) org

    I am using the kate part. I want to be able to find out when the user moves
    the mouse over a text area (and the word under the mouse).

    First I tried installing an event filter in Kate::View. But that didn't work
    as KateViewInternal is gobbling up mouse move events. Then I noticed a
    KateView::enableTextHints, which looks like what I am looking for. But the
    KateView class interface is not public, so I cannot access it.

    So now I am stuck. Any suggestions? :)

    David Saxton

    KWrite-Devel mailing list
    KWrite-Devel (AT) kde (DOT) org
  • No.5 | | 452 bytes | |

    Monday 19 December 2005 22:57, David Saxton wrote:

    I can't get it to work.

    I sent an email to this mailing list asking about the texthint interface a
    week ago, but I didn't receive any reply:
    I guess I should know if it work, but I fail to memorize ;)
    rodda (AT) kde (DOT) org should know more, as he implemented it.
    Sorry to be not that helpful, but have atm a real lack of sparetime due to my
    diploma thesis :/
  • No.6 | | 873 bytes | |

    Monday 19 December 2005 21:59, Christoph Cullmann wrote:
    Monday 19 December 2005 22:57, David Saxton wrote:
    I can't get it to work.

    I sent an email to this mailing list asking about the texthint
    interface a week ago, but I didn't receive any reply:

    I guess I should know if it work, but I fail to memorize ;)
    rodda (AT) kde (DOT) org should know more, as he implemented it.
    Sorry to be not that helpful, but have atm a real lack of sparetime due to
    my diploma thesis :/

    It looks like the text hint interface has been all nicely coded, etc, but
    someone forgot to expose the "enableTextHints" function to the public API
    (instead, it's just in the private KateView class). at least I can't find
    out how to enable text hints.

    KWrite-Devel mailing list
    KWrite-Devel (AT) kde (DOT) org
  • No.7 | | 1354 bytes | |

    Monday 19 December 2005 23:11, David Saxton wrote:
    Monday 19 December 2005 21:59, Christoph Cullmann wrote:
    Monday 19 December 2005 22:57, David Saxton wrote:
    I can't get it to work.

    I sent an email to this mailing list asking about the texthint
    interface a week ago, but I didn't receive any reply:

    I guess I should know if it work, but I fail to memorize ;)
    rodda (AT) kde (DOT) org should know more, as he implemented it.
    Sorry to be not that helpful, but have atm a real lack of sparetime due
    to my diploma thesis :/

    It looks like the text hint interface has been all nicely coded, etc, but
    someone forgot to expose the "enableTextHints" function to the public API
    (instead, it's just in the private KateView class). at least I can't
    find out how to enable text hints.

    The Kate Part implements *
    There is also a texthintinterface: texthintinterface.h in which you can find
    something like enableTextHints.

    The KateView class in kdelibs/kate/part/kateview.h class is derived from the
    TextHintInterface.
    So you can cast a Kate::View into a KTextEditor::TextHintInterface and call
    whatever is defined in this interface file.

    Hope this helps, greetings,
    Dominik

    KWrite-Devel mailing list
    KWrite-Devel (AT) kde (DOT) org
  • No.8 | | 1320 bytes | |

    Tuesday 20 December 2005 10:11, Dominik Haumann wrote:
    The Kate Part implements *
    There is also a texthintinterface: texthintinterface.h in which you can
    find something like enableTextHints.

    The KateView class in kdelibs/kate/part/kateview.h class is derived from
    the TextHintInterface.
    So you can cast a Kate::View into a KTextEditor::TextHintInterface and call
    whatever is defined in this interface file.

    Hope this helps, greetings,
    Dominik

    Yup, seems to be working :) - not too sure how I missed the TextHintInterface
    interface.

    Still though, it won't actually display any tool tips - despite what the
    function description claims (unless I'm missing something again). Instead,
    all it does is prints debug info:

    emit m_view->needTextHint(c.line(), c.col(), tmp);
    if (!tmp.isEmpty()) kdDebug(13030)<<"Hint text: "<<tmp<<endl;
    }

    Which means that I have to implement the tooltip myself. This is ok (I can at
    least intercept events to hide the tooltip, etc) but I don't have access to
    useful internal data such as the line positions (so that the tooltip can be
    displayed just below the current line), for example.

    KWrite-Devel mailing list
    KWrite-Devel (AT) kde (DOT) org
  • No.9 | | 2393 bytes | |

    Tuesday 20 December 2005 23:32, David Saxton wrote:
    Tuesday 20 December 2005 10:11, Dominik Haumann wrote:
    The Kate Part implements *
    There is also a texthintinterface: texthintinterface.h in which you can
    find something like enableTextHints.

    The KateView class in kdelibs/kate/part/kateview.h class is derived
    from the TextHintInterface.
    So you can cast a Kate::View into a KTextEditor::TextHintInterface and
    call whatever is defined in this interface file.

    Hope this helps, greetings,
    Dominik

    Yup, seems to be working :) - not too sure how I missed the
    TextHintInterface interface.

    Still though, it won't actually display any tool tips - despite what the
    function description claims (unless I'm missing something again).
    Instead, all it does is prints debug info:

    emit m_view->needTextHint(c.line(), c.col(), tmp);
    if (!tmp.isEmpty()) kdDebug(13030)<<"Hint text: "<<tmp<<endl;
    }

    Which means that I have to implement the tooltip myself. This is ok (I
    can at least intercept events to hide the tooltip, etc) but I don't have
    access to useful internal data such as the line positions (so that the
    tooltip can be displayed just below the current line), for example.

    The TextHintInterface works like this iirc:
    1. You enable the hints with enableTextHints, you have done this already I
    guess.

    2. You connect the signal needTextHint to a slot, example:
    connect( (KTextEditor::TextHintInterface*) my_view, // better: dynamic_cast
    SIGNAL( needTextHint(int, int, QString&),
    this, SLT( passTextHint(int, int, QString&) );
    Note: You actually *never* call the signal yourself.

    3. You implement passTextHint(int l, int c, QString& fill_me).
    This slot is called whenever the mouse position hovers over a certain text
    position without moving. The Kate Part registers this and then asks for a
    string *from you* (by emitting the signal needTextHint!). You have the line
    and column, so get the word at the position, do some stuff and pass the
    return value back by using the reference fill_me.

    I should add that I didn't test this, but I can't think of another ways how
    it is supposed to work.

    Greetings :)
    Dominik

    KWrite-Devel mailing list
    KWrite-Devel (AT) kde (DOT) org
  • No.10 | | 2184 bytes | |

    Tuesday 20 December 2005 08:59, Christoph Cullmann wrote:
    Monday 19 December 2005 22:57, David Saxton wrote:
    I can't get it to work.

    I sent an email to this mailing list asking about the texthint
    interface a week ago, but I didn't receive any reply:

    I guess I should know if it work, but I fail to memorize ;)
    rodda (AT) kde (DOT) org should know more, as he implemented it.

    No, I only tried to implement the internals. I didn't design the interface (I
    think jowenn did) - it has some flaws as previously discussed on this list.

    As far as I know the texthint interface is not enabled in katepart currently.
    For 4.x I expect this to change (with an improved interface) but for 3.x I
    can't see it getting done (I prefer use what time I have to focus on 4,
    perhaps the person who designed it can have a go) sorry.

    >I am using the kate part. I want to be able to find out when the user moves
    >the mouse over a text area (and the word under the mouse).
    >
    >First I tried installing an event filter in Kate::View. But that didn't work
    >as KateViewInternal is gobbling up mouse move events. Then I noticed a
    >KateView::enableTextHints, which looks like what I am looking for. But the
    >KateView class interface is not public, so I cannot access it.


    You can get KateViewInternal by iterating children of KTextEditor::View and
    checking the classname. However it is quite a bit more difficult (read:
    impossible to do properly using public api) to get the corresponding line,col
    pair.

    >So now I am stuck. Any suggestions? :)


    1) you could have a go at implementing the texthint interface in katepart if
    that's what you need
    2) you could wait for kde 4 (i know, long way away, can't be helped)
    3) you could design a new interface and implement that

    Cheers,
    Hamish.

    KWrite-Devel mailing list
    KWrite-Devel (AT) kde (DOT) org

    PGP SIGNATURE
    Version: GnuPG v1.4.2 (GNU/Linux)

    PssExar6+oHRJ761JaR4SJk=
    =m6Kv
    PGP SIGNATURE

Re: Kate::View::word(int , int )


max 4000 letters.
Your nickname that display:
In order to stop the spam: 1 + 0 =
QUESTION ON "KDE"

EMSDN.COM