Logo Search packages:      
Sourcecode: qstardict version File versions  Download package

QStringList QStarDict::DictCore::findSimilarWords ( const QString &  word  ) 

Returns a list of similar words contained in dictionaries.

Definition at line 82 of file dictcore.cpp.

References QStarDict::DictPlugin::features(), QStarDict::DictPlugin::findSimilarWords(), plugin(), and QStarDict::DictPlugin::SearchSimilar.

{
    QString simplifiedWord = word.simplified();
    QStringList result;
    for (QList<Dictionary>::const_iterator i = m_loadedDicts.begin(); i != m_loadedDicts.end(); ++i)
    {
        if (! m_plugins.contains(i->plugin()))
            continue;
        DictPlugin *plugin = qobject_cast<DictPlugin*>(m_plugins[i->plugin()]->instance());
        if (! plugin->features().testFlag(DictPlugin::SearchSimilar))
            continue;
        QStringList similar = plugin->findSimilarWords(i->name(), simplifiedWord);
        for (QStringList::const_iterator j = similar.begin(); j != similar.end(); ++j)
            if (! result.contains(*j, Qt::CaseSensitive))
                result << *j;
    }
    result.sort();
    return result;
}


Generated by  Doxygen 1.6.0   Back to index