Skip to content
Snippets Groups Projects
Commit 669b5e7c authored by SeeLook's avatar SeeLook :musical_note:
Browse files

Exam summary: Hide 'Analyze' button when no questions in exercise

- it occurs when exercise is stopped on first question
- also hide pie chart in that case
parent c6ac7799
No related branches found
No related tags found
No related merge requests found
Pipeline #3675 skipped
......@@ -171,6 +171,11 @@ void TexamSummary::continueExecutor() {
}
bool TexamSummary::hasQuestions() const {
return m_exam && m_exam->count() > 0;
}
void TexamSummary::exerciseToExam() {
m_accepted = true;
EXECUTOR->restoreExerciseAfterSummary();
......
......@@ -46,6 +46,7 @@ class TexamSummary : public QQuickItem
Q_PROPERTY(QList<int> kindOfMistakes READ kindOfMistakes NOTIFY updateExam)
Q_PROPERTY(bool hasVariousMistakes READ hasVariousMistakes NOTIFY updateExam)
Q_PROPERTY(QList<int> answersModel READ answersModel NOTIFY updateExam)
Q_PROPERTY(bool hasQuestions READ hasQuestions NOTIFY updateExam)
public:
explicit TexamSummary(QQuickItem* parent = nullptr);
......@@ -62,6 +63,8 @@ public:
QList<int> kindOfMistakes() const { return m_kindOfMistakes; }
QList<int> answersModel() const { return m_answersModel; }
bool hasQuestions() const;
/**
* @p TRUE when there are more than one kind of mistake
*/
......
......@@ -66,6 +66,7 @@ TexamSummary {
}
Item {
width: NOO.factor() * (NOO.isAndroid() ? 15 : 20); height: width + NOO.factor()
visible: hasQuestions
TpieChartItem {
id: answId
width: parent.width; height: width
......@@ -179,7 +180,7 @@ TexamSummary {
onClicked: { continueExecutor(); dialLoader.close() }
}
TiconButton {
visible: !NOO.isAndroid() || !isExercise()
visible: hasQuestions && (!NOO.isAndroid() || !isExercise())
width: buttGrid.buttWidth
pixmap: NOO.pix(NOO.isAndroid() ? "send" : "charts"); iconHeight: buttGrid.buttHeight
text: NOO.isAndroid() ? NOO.TR("QShortcut", "Send") : qsTr("Analyze")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment