Commit 02ffbb49 authored by Andreas Cord-Landwehr's avatar Andreas Cord-Landwehr
Browse files

Fix several trivial clazy warnings

parent cd96c580
......@@ -29,7 +29,8 @@ void VocabularyMimeData::setTranslations(const QList<KEduVocTranslation *> &tran
// copy word types
// this sucks but there is not really a better was. copying pointers is not a good idea because copy and paste can be done between different documents.
for (int i : expression->translationIndices()) {
const QList<int> translationIndices = expression->translationIndices();
for (int i : translationIndices) {
// generate text string representation
m_text.append(expression->translation(i)->text());
m_text.append(" - ");
......
......@@ -53,8 +53,7 @@ ConjugationWidget::ConjugationWidget(QWidget *parent)
void ConjugationWidget::textChanged(const QString &text)
{
int valueIndex = m_conjugationLineEdits.values().indexOf(qobject_cast<QLineEdit *>(sender()));
int key = m_conjugationLineEdits.keys().value(valueIndex);
int key = m_conjugationLineEdits.key(qobject_cast<QLineEdit *>(sender()));
KEduVocTranslation *translation = m_entry->translation(m_identifier);
KEduVocConjugation conjugation = translation->getConjugation(tenseComboBox->currentText());
conjugation.setConjugation(text, (KEduVocWordFlag::Flags)key);
......
......@@ -40,8 +40,7 @@ DeclensionWidget::DeclensionWidget(QWidget *parent)
void DeclensionWidget::textChanged(const QString &text)
{
int valueIndex = m_DeclensionLineEdits.values().indexOf(qobject_cast<QLineEdit *>(sender()));
int key = m_DeclensionLineEdits.keys().value(valueIndex) | currentAdditionalWordFlag();
int key = m_DeclensionLineEdits.key(qobject_cast<QLineEdit *>(sender())) | currentAdditionalWordFlag();
m_entry->translation(m_identifier)->declension()->setDeclension(text, (KEduVocWordFlag::Flags)key);
emit sigModified();
}
......
......@@ -317,7 +317,7 @@ void VocabularyView::slotEditPaste()
qDebug() << "Clipboard contains text data.";
// split at newline
QStringList lines = clipboard->text().split('\n');
for (QString line : qAsConst(lines)) {
for (const QString &line : qAsConst(lines)) {
// split at tabs or semicolon:
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
m_model->appendEntry(new KEduVocExpression(line.split(QRegExp(QStringLiteral("[\t;]")), QString::KeepEmptyParts)));
......
......@@ -84,7 +84,7 @@ public Q_SLOTS:
virtual void showSynonym() = 0;
/** switch between different modes such as written, flash card, etc */
virtual void setMode(Mode mode) = 0;
virtual void setMode(Practise::AbstractFrontend::Mode mode) = 0;
virtual void setBoxes(grade_t currentBox, grade_t newBoxIfCorrect, grade_t newBoxIfWrong) = 0;
Q_SIGNALS:
......
......@@ -344,10 +344,10 @@ void LanguagePropertiesPage::slotNewTense()
{
bool ok;
QString getTense = QInputDialog::getText(this, i18n("Tense Name"), i18n("Enter name of tense:"), QLineEdit::Normal, QString(), &ok);
if (!ok)
if (!ok) {
return;
}
QString str;
int i = tenseList->count() + 1;
tenseList->addItem(QStringLiteral("%1").arg(i, 2).append(TENSE_TAG).append(getTense.simplified()));
tenseIndex.append(-(i - 1));
......@@ -390,7 +390,7 @@ void LanguagePropertiesPage::slotDeleteTense()
if (tenseList->count() > 0 && (int)tenseList->count() > act) {
QString t = tenseList->item(act)->text();
QList<KEduVocExpression *> entries = m_doc->lesson()->entries(KEduVocLesson::Recursive);
const QList<KEduVocExpression *> entries = m_doc->lesson()->entries(KEduVocLesson::Recursive);
for (KEduVocExpression *exp : entries) {
for (int lang = 0; lang < m_doc->identifierCount(); lang++) {
if (exp->translation(lang)->conjugationTenses().contains(t)) {
......
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