Vincent van Ravesteijn | 1 May 16:26 2011

Re: Too much options in LyX

On 29-4-2011 15:03, venom00 wrote:
>> Style and form comments are always welcome but please give a 
>> little attention to the content too:
>> - Alternative ideas to highlight matching widgets? Currently 
>> they become red.
>> - Ideas on how to make the research faster? In the next patch 
>> I'll try to add a little delay.
> 
> Here's the new patch. I've added a 300 ms delay, now it should be more
> responsive as the search it's not done for each charatecter in input.
> 
> venom00
> 
> Index: src/frontends/qt4/GuiDocument.h
> ===================================================================
> --- src/frontends/qt4/GuiDocument.h	(revisione 38474)
> +++ src/frontends/qt4/GuiDocument.h	(copia locale)
>  <at>  <at>  -77,6 +77,7  <at>  <at> 
>  	void updateDefaultFormat();
>  	void updatePagestyle(std::string const &, std::string const &);
>  	bool isChildIncluded(std::string const &);
> +	void hideView();
>  
>  	///
>  	BufferParams const & params() const { return bp_; }
> Index: src/frontends/qt4/GuiDocument.cpp
> ===================================================================
> --- src/frontends/qt4/GuiDocument.cpp	(revisione 38474)
> +++ src/frontends/qt4/GuiDocument.cpp	(copia locale)
>  <at>  <at>  -2139,6 +2139,12  <at>  <at> 
(Continue reading)

venom00 | 1 May 22:37 2011

RE: Too much options in LyX

> hideView() doesn't work as this is only called when the Ok or Close
> button are pressed. Not when the dialog is canceled by Escape.
> 
> Maybe you should put the resetSearch function in a showEvent function
> which is called when the dialog is shown.

OK, that's a good idea, this makes the patch more self-contained, but I'll use
hideEvent. showEvent is called after the widget is shown, that's not what we
want.

> However, you should then set the text in the textfield and then
> manually reset all widgets to enabled. This means you have to either
> block the signals, but better .. listen to textEdited instead of
> textChanged.
> > +
> > +	connect(search_, SIGNAL(textChanged(QString)), this,
> > SLOT(filterChanged(QString)));
> 
> 
> textChanged -> textEdited so that this will not react to
> programmatically changing the text in the search box as a
> consequence of resetSearch() for instance.

Why we don't want that? It's correct: "search_->setText(QString())" re-enables
all the widgets automatically. See below.

> > +bool matches(QString & input, QString const & search)
> 
> QString const & input ... ?
> > +{
(Continue reading)

Vincent van Ravesteijn | 1 May 22:56 2011

Re: Too much options in LyX

>> However, you should then set the text in the textfield and then
>> manually reset all widgets to enabled. This means you have to either
>> block the signals, but better .. listen to textEdited instead of
>> textChanged.
>>> +
>>> +	connect(search_, SIGNAL(textChanged(QString)), this,
>>> SLOT(filterChanged(QString)));
>>
>>
>> textChanged -> textEdited so that this will not react to
>> programmatically changing the text in the search box as a
>> consequence of resetSearch() for instance.
> 
> Why we don't want that? It's correct: "search_->setText(QString())" re-enables
> all the widgets automatically. See below.

The problem is that when you rely on the signal you also wait
for 300 ms, which is not what you want if you programmaticaly
change the text.

I guess this is no issue when you use hideEvent instead of
showEvent, though I like to avoid this delay if it is not
necessary.

>  
>>> +bool matches(QString & input, QString const & search)
>>
>> QString const & input ... ?
>>> +{
>>> +	// Check if the input contains the search string
(Continue reading)


Gmane