mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-24 00:14:06 +00:00
fix : code smell
This commit is contained in:
parent
72fca59a92
commit
21bab62263
|
@ -2,7 +2,7 @@
|
|||
#include "wstring_qt.hh"
|
||||
|
||||
HeadwordListModel::HeadwordListModel( QObject * parent ) :
|
||||
QAbstractListModel( parent ), filtering( false ), totalSize(0), index( 0 ),ptr( 0 )
|
||||
QAbstractListModel( parent ), filtering( false ), totalSize(0), index( 0 ),ptr( nullptr )
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ void HeadwordListModel::setFilter( QRegularExpression reg )
|
|||
void HeadwordListModel::addMatches( QStringList matches)
|
||||
{
|
||||
QStringList filtered;
|
||||
for ( auto & w : matches ) {
|
||||
for ( auto const & w : matches ) {
|
||||
if ( !words.contains( w ) ) {
|
||||
filtered << w;
|
||||
}
|
||||
|
|
|
@ -201,7 +201,7 @@ void DictHeadwords::filterChangedInternal()
|
|||
QTimer::singleShot( 100, this, &DictHeadwords::filterChanged );
|
||||
}
|
||||
|
||||
QRegularExpression DictHeadwords::getFilterRegex( )
|
||||
QRegularExpression DictHeadwords::getFilterRegex( ) const
|
||||
{
|
||||
const QRegExp::PatternSyntax syntax =
|
||||
static_cast< QRegExp::PatternSyntax >(ui.searchModeCombo->itemData(
|
||||
|
@ -368,8 +368,7 @@ void DictHeadwords::saveHeadersToFile()
|
|||
|
||||
QStringList filtered;
|
||||
|
||||
const QRegularExpression regExp = getFilterRegex();
|
||||
if(regExp.isValid() && !regExp.pattern().isEmpty()){
|
||||
if ( const QRegularExpression regExp = getFilterRegex(); regExp.isValid() && !regExp.pattern().isEmpty() ) {
|
||||
filtered = sortedWords.filter( regExp );
|
||||
}
|
||||
else{
|
||||
|
|
|
@ -48,7 +48,7 @@ private:
|
|||
private slots:
|
||||
void savePos();
|
||||
void filterChangedInternal();
|
||||
QRegularExpression getFilterRegex();
|
||||
QRegularExpression getFilterRegex() const;
|
||||
void filterChanged();
|
||||
void exportButtonClicked();
|
||||
void okButtonClicked();
|
||||
|
|
Loading…
Reference in a new issue