>> 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
>>> +   return input.remove('&').contains(search, Qt::CaseInsensitive);
>>> +}
> 
> QString & QString::remove ( QChar ch, Qt::CaseSensitivity cs = 
> Qt::CaseSensitive
> ) <-- Not const method. Actually removes the char from the string.


This means that when you call matches, you are actually
changing the input string. This is not what is expected
and as long as you don't want to explicitly change the
input argument it should be const by default.

You should do then:

bool matches (QString const & input, QString const & search)
{
        QString copy = input;
        return copy.remove('&').contains(search, Qt::CaseInsensitive);
}


> 
> Index: src/frontends/qt4/PanelStack.cpp
> ===================================================================
> --- src/frontends/qt4/PanelStack.cpp  (revisione 38474)
> +++ src/frontends/qt4/PanelStack.cpp  (copia locale)
> @@ -15,12 +15,23 @@
>  #include "qt_helpers.h"
>  
>  #include "support/debug.h"
> +#include "support/foreach.h"
>  
> +#include <QApplication>
> +#include <QAbstractButton>
> +#include <QColorGroup>


Last nitpick: QAbstractButton comes before QApplication ;).


Vincent

Reply via email to