mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 19:24:08 +00:00
fix: code smell
This commit is contained in:
parent
11ea4bc799
commit
084175f56f
|
@ -124,16 +124,16 @@ int HeadwordListModel::wordCount() const
|
||||||
QVariant HeadwordListModel::data( const QModelIndex & index, int role ) const
|
QVariant HeadwordListModel::data( const QModelIndex & index, int role ) const
|
||||||
{
|
{
|
||||||
if( !index.isValid() )
|
if( !index.isValid() )
|
||||||
return QVariant();
|
return {};
|
||||||
|
|
||||||
if( index.row() >= totalSize || index.row() < 0 || index.row() >= words.size() )
|
if( index.row() >= totalSize || index.row() < 0 || index.row() >= words.size() )
|
||||||
return QVariant();
|
return {};
|
||||||
|
|
||||||
if( role == Qt::DisplayRole )
|
if( role == Qt::DisplayRole )
|
||||||
{
|
{
|
||||||
return words.at( index.row() );
|
return words.at( index.row() );
|
||||||
}
|
}
|
||||||
return QVariant();
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
bool HeadwordListModel::canFetchMore( const QModelIndex & parent ) const
|
bool HeadwordListModel::canFetchMore( const QModelIndex & parent ) const
|
||||||
|
@ -174,7 +174,7 @@ void HeadwordListModel::fetchMore( const QModelIndex & parent )
|
||||||
emit numberPopulated( words.size() );
|
emit numberPopulated( words.size() );
|
||||||
}
|
}
|
||||||
|
|
||||||
int HeadwordListModel::getCurrentIndex()
|
int HeadwordListModel::getCurrentIndex() const
|
||||||
{
|
{
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ public:
|
||||||
void setFilter( QRegularExpression );
|
void setFilter( QRegularExpression );
|
||||||
void appendWord( const QString & word );
|
void appendWord( const QString & word );
|
||||||
void addMatches( QStringList matches );
|
void addMatches( QStringList matches );
|
||||||
int getCurrentIndex();
|
int getCurrentIndex() const;
|
||||||
bool containWord( const QString & word );
|
bool containWord( const QString & word );
|
||||||
QSet< QString > getRemainRows( int & nodeIndex );
|
QSet< QString > getRemainRows( int & nodeIndex );
|
||||||
signals:
|
signals:
|
||||||
|
|
Loading…
Reference in a new issue