Commit 33e711e0 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Fix clazy warning

parent b0fd3d81
......@@ -40,6 +40,7 @@ class QAction;
**/
class AppMenuWidget : public KXmlGuiWindow
{
Q_OBJECT
public:
/** constructor */
AppMenuWidget();
......@@ -60,10 +61,6 @@ private:
QLabel * labelLearning;
QLabel * labelInfo;
QAction * m_NewTaskAction;
QAction * m_BackAction;
QAction * m_HintAction;
MainQtWidget * kbruchApp;
FractionRingWidget * fractionRing;
......
......@@ -31,6 +31,7 @@
* */
class ExerciseBase : public QWidget
{
Q_OBJECT
public:
/** constructor */
explicit ExerciseBase(QWidget * parent = nullptr);
......
......@@ -173,7 +173,7 @@ void ExerciseCompare::forceNewTask()
if (m_currentState == _CHECK_TASK) {
// emit the signal for skipped
signalExerciseSkipped();
Q_EMIT signalExerciseSkipped();
}
m_currentState = _CHECK_TASK;
......@@ -220,7 +220,6 @@ void ExerciseCompare::createTask()
- emits signals if task was solved correctly or wrong */
void ExerciseCompare::showResult()
{
QPalette pal;
SignButtonState result;
if (m_firstRatio < m_secondRatio)
......@@ -238,13 +237,13 @@ void ExerciseCompare::showResult()
if (m_signButtonState == result) {
// emit the signal for correct
signalExerciseSolvedCorrect();
Q_EMIT signalExerciseSolvedCorrect();
/* yes, the user entered the correct result */
m_resultWidget->setResult(1);
} else {
// emit the signal for wrong
signalExerciseSolvedWrong();
Q_EMIT signalExerciseSolvedWrong();
/* no, the user entered the wrong result */
......
......@@ -181,7 +181,7 @@ void ExerciseConvert::forceNewTask()
if (m_currentState == _CHECK_TASK) {
// emit the signal for skipped
signalExerciseSkipped();
Q_EMIT signalExerciseSkipped();
}
m_currentState = _CHECK_TASK;
m_checkButton->setText(i18n("&Check"));
......@@ -316,8 +316,6 @@ void ExerciseConvert::createTask()
- emits signals if task was solved correctly or wrong */
void ExerciseConvert::showResult()
{
QString tmp_str; /* to build a string for a label */
QPalette pal;
Ratio entered_result;
// change the tooltip of the check button
......@@ -349,13 +347,13 @@ void ExerciseConvert::showResult()
if ((deno_edit->text().toInt() != 0) && ((entered_result == m_result) ||
(m_result.numerator() == 0 && entered_result.numerator() == 0))) {
// emit the signal for correct
signalExerciseSolvedCorrect();
Q_EMIT signalExerciseSolvedCorrect();
/* yes, the user entered the correct result */
m_resultWidget->setResult(m_result, 1);
} else {
// emit the signal for wrong
signalExerciseSolvedWrong();
Q_EMIT signalExerciseSolvedWrong();
/* no, the user entered the wrong result */
m_resultWidget->setResult(m_result, 0);
......@@ -392,8 +390,8 @@ void ExerciseConvert::nextTask()
m_resultWidget->setResult(m_result, -1);
/* clear user input */
deno_edit->setText(QStringLiteral(""));
numer_edit->setText(QStringLiteral(""));
deno_edit->clear();
numer_edit->clear();
numer_edit->setFocus();
/* create a new task */
......
......@@ -286,7 +286,7 @@ void ExerciseFactorize::forceNewTask()
if (m_currentState == _CHECK_TASK) {
// emit the signal for skipped
signalExerciseSkipped();
Q_EMIT signalExerciseSkipped();
}
m_currentState = _CHECK_TASK;
m_checkButton->setText(i18n("&Check"));
......@@ -360,8 +360,6 @@ void ExerciseFactorize::createTask()
- emits signals if task was solved correctly or wrong */
void ExerciseFactorize::showResult()
{
QString tmp_str, tmp_str2; /* to build a string for a label */
QPalette pal;
uint uint_result = 0;
// change the tooltip of the check button
......@@ -395,13 +393,13 @@ void ExerciseFactorize::showResult()
if (uint_result == m_taskNumber) {
// emit the signal for correct
signalExerciseSolvedCorrect();
Q_EMIT signalExerciseSolvedCorrect();
/* yes, the user entered the correct result */
m_resultWidget->setResult(Ratio(), 1);
} else {
// emit the signal for wrong
signalExerciseSolvedWrong();
Q_EMIT signalExerciseSolvedWrong();
/* no, the user entered the wrong result */
m_resultWidget->setResult(Ratio(), 0);
......@@ -437,7 +435,7 @@ void ExerciseFactorize::nextTask()
/* clear user input */
m_factorsEntered.clear();
m_factorsResult.clear();
m_factorsEnteredEdit->setText(QStringLiteral(""));
m_factorsEnteredEdit->clear();
m_factorsEnteredEdit->setFocus();
......@@ -473,7 +471,7 @@ void ExerciseFactorize::addFactor(uint factor)
void ExerciseFactorize::updateEnteredEdit()
{
// the string to be shown in the entered edit
QString str_output = QStringLiteral("");
QString str_output;
QString str_tmp;
// find the end of the list
......
......@@ -195,7 +195,7 @@ void ExerciseMixedNumbers::forceNewTask()
if (m_currentState == _CHECK_TASK) {
// emit the signal for skipped
signalExerciseSkipped();
Q_EMIT signalExerciseSkipped();
}
m_currentState = _CHECK_TASK;
m_checkButton->setText(i18n("&Check"));
......@@ -258,9 +258,9 @@ void ExerciseMixedNumbers::nextTask()
m_checkButton->setText(i18n("&Check"));
// clear user input and restore input fields
m_denoEdit->setText(QStringLiteral(""));
m_numerEdit->setText(QStringLiteral(""));
m_integerEdit->setText(QStringLiteral(""));
m_denoEdit->clear();
m_numerEdit->clear();
m_integerEdit->clear();
m_numerEdit->setEnabled(true);
m_denoEdit->setEnabled(true);
m_skipButton->setEnabled(true);
......@@ -343,7 +343,7 @@ void ExerciseMixedNumbers::showResult()
// wrong solution, try to give some hints what might be wrong
if (wrong) {
// emit the signal for wrong
signalExerciseSolvedWrong();
Q_EMIT signalExerciseSolvedWrong();
m_resultWidget->setAnswerMixed(! m_isMixedTask);
m_resultWidget->setResult(solutionRatio, 0);
......@@ -364,7 +364,7 @@ void ExerciseMixedNumbers::showResult()
}
} else {
// emit the signal for correct
signalExerciseSolvedCorrect();
Q_EMIT signalExerciseSolvedCorrect();
m_resultWidget->setResult(solutionRatio, 1);
}
......
......@@ -168,7 +168,7 @@ void ExercisePercentage::forceNewTask()
if (m_currentState == _CHECK_TASK) {
// emit the signal for skipped
signalExerciseSkipped();
Q_EMIT signalExerciseSkipped();
}
m_currentState = _CHECK_TASK;
m_checkButton->setText(i18n("&Check"));
......@@ -322,8 +322,6 @@ void ExercisePercentage::createTask()
- emits signals if task was solved correctly or wrong */
void ExercisePercentage::showResult()
{
QString tmp_str; /* to build a string for a label */
QPalette pal;
int tmp_result;
Ratio entered_result;
Ratio correct_result;
......@@ -346,12 +344,12 @@ void ExercisePercentage::showResult()
correct_result.setDenominator(1, false);
if (tmp_result == m_resultPercentage.toInt()) {
// emit the signal for correct
signalExerciseSolvedCorrect();
Q_EMIT signalExerciseSolvedCorrect();
/* yes, the user entered the correct result */
m_resultWidget->setResult(entered_result, 1);
} else {
// emit the signal for incorrect
signalExerciseSolvedWrong();
Q_EMIT signalExerciseSolvedWrong();
/* no, the user entered the wrong result */
m_resultWidget->setResult(correct_result, 0);
}
......@@ -371,7 +369,7 @@ void ExercisePercentage::nextTask()
m_resultWidget->setResult(m_result, -1);
/* clear user input */
answer_edit->setText(QStringLiteral(""));
answer_edit->clear();
answer_edit->setFocus();
/* create a new task */
......
......@@ -35,6 +35,7 @@
* \author Sebastian Stein */
class FractionBaseWidget : public QWidget
{
Q_OBJECT
public:
/** constructor */
explicit FractionBaseWidget(QWidget * parent = nullptr);
......
......@@ -34,6 +34,7 @@ class QPaintEvent;
* */
class FractionPainter : public FractionBaseWidget
{
Q_OBJECT
public:
/** constructor */
explicit FractionPainter(QWidget * parent = nullptr);
......
......@@ -108,7 +108,7 @@ void PrimeFactorsLineEdit::keyPressEvent(QKeyEvent * event)
if (allowedChars.contains(event->text()) || backspaceKey || returnKey) {
QString lastFactor;
QString ch = QStringLiteral("#");
QString factor = QStringLiteral("");
QString factor;
if (!event->text().isEmpty()) {
ch = event->text().at(0);
}
......
......@@ -33,6 +33,7 @@ class QPaintEvent;
* \author Sebastian Stein */
class RatioWidget : public FractionBaseWidget
{
Q_OBJECT
public:
/** constructor */
explicit RatioWidget(QWidget * parent = nullptr, const Ratio &para_ratio = Ratio());
......
......@@ -27,6 +27,7 @@ class QPaintEvent;
* \author Sebastian Stein */
class RationalWidget : public FractionBaseWidget
{
Q_OBJECT
public:
/** constructor */
RationalWidget(QWidget * parent, const QString &pnumber, const int pperiodStart = 1, const int pperiodLength = 0);
......
......@@ -92,7 +92,7 @@ void ResultWidget::Init()
pal.setColor(QPalette::WindowText, Qt::white);
setPalette(pal);
m_primaryText = new QLabel(QStringLiteral(""), this);
m_primaryText = new QLabel(this);
m_primaryText->setObjectName(QStringLiteral("primaryText"));
m_primaryText->setPalette(pal);
defaultFont.setPointSize(20);
......
......@@ -38,6 +38,7 @@ typedef QList<uint> uintList;
* \author Sebastian Stein */
class ResultWidget : public FractionBaseWidget
{
Q_OBJECT
public:
/** constructors */
ResultWidget(QWidget * parent, const Ratio &para_result);
......
......@@ -30,6 +30,7 @@ class QLabel;
* */
class StatisticsBarWidget : public QWidget
{
Q_OBJECT
public:
/** constructor */
explicit StatisticsBarWidget(QWidget * parent = nullptr);
......
......@@ -53,8 +53,6 @@ StatisticsView::StatisticsView(QWidget * parent) :
defaultFont.setBold(true);
defaultFont.setPointSize(28);
QPalette pal;
/* create a grid to show the labels */
labelGrid = new QGridLayout();
setLayout(labelGrid);
......@@ -189,7 +187,6 @@ void StatisticsView::calc()
statisticsBar->updateBar(m_correct, m_skipped, m_count);
QString new_text;
QString number;
new_text = QStringLiteral("<b>%1</b>").arg(m_count);
result1Label->setText(new_text);
......
......@@ -44,6 +44,7 @@ class StatisticsBarWidget;
class StatisticsView : public QFrame
{
Q_OBJECT
public:
/** constructor */
explicit StatisticsView(QWidget * parent = nullptr);
......
......@@ -120,17 +120,6 @@ public:
void clean();
private:
/** max. size of main denominator */
int max_md;
/** how many ratios should the task have */
short nr_ratios;
short add_sub;
short add_add;
short add_mult;
short add_div;
/** the ratio vector */
RatioArray ratio_vector;
......
......@@ -253,7 +253,7 @@ void TaskView::forceNewTask()
if (m_currentState == _CHECK_TASK) {
// emit the signal for skipped
signalTaskSkipped();
Q_EMIT signalTaskSkipped();
}
m_currentState = _CHECK_TASK;
m_checkButton->setText(i18n("&Check"));
......@@ -273,8 +273,6 @@ void TaskView::forceNewTask()
- emits signals if task was solved right or wrong */
void TaskView::showResult()
{
QString tmp_str; /* to build a string for a label */
QPalette pal;
bool wrong = false;
// change the tooltip of the check button
......@@ -358,7 +356,7 @@ void TaskView::showResult()
// in case the user entered the wrong result, try to give some hints
if (wrong == true) {
// emit the signal for wrong
signalTaskSolvedWrong();
Q_EMIT signalTaskSolvedWrong();
m_resultWidget->setResult(solution, 0);
// if the user entered a 0 for the denominator (division by 0) we have to
......@@ -382,7 +380,7 @@ void TaskView::showResult()
}
} else {
// emit the signal for correct
signalTaskSolvedCorrect();
Q_EMIT signalTaskSolvedCorrect();
m_resultWidget->setResult(solution, 1);
}
......@@ -406,9 +404,9 @@ void TaskView::nextTask()
m_resultWidget->setResult(solution, -1);
/* clear user input */
deno_edit->setText(QStringLiteral(""));
numer_edit->setText(QStringLiteral(""));
integer_edit->setText(QStringLiteral(""));
deno_edit->clear();
numer_edit->clear();
integer_edit->clear();
if (m_answerMixed == true)
integer_edit->setFocus();
else
......
......@@ -67,7 +67,7 @@ void TaskWidget::paintEvent(QPaintEvent* /* p_paintEvent */)
int old_y = 0;
// strings holding numerator, denominator and the operation sign
QString str_numerator, str_denominator, str_operation;
QString str_operation;
// operation sign as number
short tmp_operation;
......
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