proposal for extension of KTextEditor interface

Joseph Wenninger jowenn at kde.org
Sun Jan 12 00:24:03 UTC 2003


Hi

Am Son, 2003-01-12 um 00.03 schrieb F at lk Brettschneider:
> >signals:
> >	void needTextHint(int line, int col, QString &text);
> >		/*should only be emitted if line and col really changed (not inner
> >cell moves) when a timeout has happened.
> >
> Sound good.
> 
> >The slot
> >
> Which slot? Do we miss a 4th interface method? How can we set the text 
> for the tooltip?

eg:

kdevelop_something::xyz()
{
...
	connect(view,SIGNAL(needTextHint(int,int,
QString&),SLOT(this,slotTextHint(int,int,QString&))); // the connnection
should be 1:1 not 1:n
...
}

void kdevelop_somthing::slotTextHint(int,int,QString& text) {
...
	if(compute_something) text="something" else text=QString();
...
}



> 
> > sets the text property and if it is not an emtpy string the
> >text editor displays it next/above/below the textcell.
> >
> What is with Roberto's 5th interface method:  (void setWordValidator( 
> const QValidator* wordValidator ))? To reduce the number of emitted 
> signals out of the texteditor. If the validator is something like:
> 
> class CppExpressionsValidator: public QValidator{
> ...
>     virtual State validate ( QString & input, int & pos ) const {
>          Context* ctx = computeContextFromCursorPosition( cursorPosition );
>          if( ctx->containsVariable( input ) ) 
>             return Acceptable;
>          ....
>     }
> }
> 
> signals for tooltips in .cpp files were just emitted for things that make sense.
> 

I don't think  that this really saves time or CPU. I hope you keep in
mind, that this validator MUST use ktexteditor interface methods ONLY
anyways, to be usable with any ktexteditor.


> 
> After reviewing the Microsoft Visual C++ debugger I saw that normal text tooltips show the variable values, but addionally, tooltips on selected text are able to show the value of the selected expression! 
> Please, can you consider tooltips for selected text in the KTextEditor-Interface too!?!?
> The editor just must check if the mouse is over selected or unselected text. In case of unselected text it must use the validator suggested by Roberto (see above), in case of selected text it must emit a signal with the selected text that KDevelop tries to resolve as an expression (e.g. '(d->x * d->y) / 45' ) and send the resolved result as tooltip for the editor.
> 

why not check in the above slotTextHint, if there is a selection ? I
don't see the need of an additional signal

Kind regards
Joseph Wenninger





More information about the KDevelop-devel mailing list