Commit 1494faac authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Make it compile against qt5.15 without deprecated method

parent 46810aac
...@@ -134,11 +134,11 @@ void KanjiBrowser::loadKanji() ...@@ -134,11 +134,11 @@ void KanjiBrowser::loadKanji()
} }
// This conversion from QList to QSet to QList, is to remove duplicated items. // This conversion from QList to QSet to QList, is to remove duplicated items.
gradeList = gradeList.toSet().values();
strokeList = strokeList.toSet().values();
// Sort them.
std::sort(gradeList.begin(), gradeList.end()); std::sort(gradeList.begin(), gradeList.end());
gradeList.erase(std::unique(gradeList.begin(), gradeList.end()), gradeList.end());
std::sort(strokeList.begin(), strokeList.end()); std::sort(strokeList.begin(), strokeList.end());
strokeList.erase(std::unique(strokeList.begin(), strokeList.end()), strokeList.end());
qDebug() << "Max. grade:" << gradeList.last(); qDebug() << "Max. grade:" << gradeList.last();
qDebug() << "Max. stroke count:" << strokeList.last(); qDebug() << "Max. stroke count:" << strokeList.last();
......
...@@ -93,11 +93,16 @@ bool RadicalFile::loadRadicalFile( QString &radkfile ) ...@@ -93,11 +93,16 @@ bool RadicalFile::loadRadicalFile( QString &radkfile )
{ {
// List of m_kanji, potentially // List of m_kanji, potentially
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) #if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
QList<QString> m_kanjiList = line.trimmed().split( QLatin1String(""), QString::SkipEmptyParts ); const QList<QString> m_kanjiList = line.trimmed().split( QLatin1String(""), QString::SkipEmptyParts );
#else #else
QList<QString> m_kanjiList = line.trimmed().split( QLatin1String(""), Qt::SkipEmptyParts ); const QList<QString> m_kanjiList = line.trimmed().split( QLatin1String(""), Qt::SkipEmptyParts );
#endif #endif
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
newestRadical->addKanji( m_kanjiList.toSet() ); newestRadical->addKanji( m_kanjiList.toSet() );
#else
const QSet<QString> kanjiSet = QSet<QString>(m_kanjiList.begin(), m_kanjiList.end());
#endif
newestRadical->addKanji( kanjiSet );
foreach( const QString &kanji, m_kanjiList ) foreach( const QString &kanji, m_kanjiList )
{ {
krad[ kanji ] += *newestRadical; krad[ kanji ] += *newestRadical;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment