File indexing completed on 2025-04-27 03:38:46
0001 /* 0002 SPDX-FileCopyrightText: 2009 Frederik Gladhorn <gladhorn@kde.org> 0003 SPDX-License-Identifier: GPL-2.0-or-later 0004 */ 0005 0006 #ifndef MULTIPLECHOICEMODEWIDGET_H 0007 #define MULTIPLECHOICEMODEWIDGET_H 0008 0009 #include "abstractwidget.h" 0010 0011 namespace Ui 0012 { 0013 class MultiplechoicePracticeWidget; 0014 } 0015 class QPushButton; 0016 0017 namespace Practice 0018 { 0019 class LatexRenderer; 0020 0021 class MultiplechoiceModeWidget : public AbstractModeWidget 0022 { 0023 Q_OBJECT 0024 0025 public: 0026 explicit MultiplechoiceModeWidget(GuiFrontend *frontend, QWidget *parent = nullptr); 0027 QVariant userInput() override; 0028 0029 void setQuestion(const QVariant &question) override; 0030 void setSolution(const QVariant &solution) override; 0031 void setHint(const QVariant &hint) override; 0032 void setFeedback(const QVariant &feedback) override; 0033 void setFeedbackState(AbstractFrontend::ResultState feedbackState) override 0034 { 0035 Q_UNUSED(feedbackState); 0036 } 0037 void setResultState(AbstractFrontend::ResultState resultState) override 0038 { 0039 Q_UNUSED(resultState); 0040 } 0041 0042 void setQuestionFont(const QFont &font) override; 0043 void setSolutionFont(const QFont &font) override; 0044 void setQuestionSound(const QUrl &soundUrl) override; 0045 void setSolutionSound(const QUrl &soundUrl) override; 0046 void setSolutionPronunciation(const QString &pronunciationText) override; 0047 void setQuestionPronunciation(const QString &pronunciationText) override; 0048 0049 void setSynonym(const QString &entry) override; 0050 0051 public Q_SLOTS: 0052 void showQuestion() override; 0053 void showSolution() override; 0054 virtual void setNumberOfPushButtons(const int numberOfChoices); 0055 void showSynonym() override; 0056 0057 protected: 0058 bool eventFilter(QObject *obj, QEvent *event) override; 0059 virtual void resetButtonStyleSheet(); 0060 0061 private: 0062 Ui::MultiplechoicePracticeWidget *m_ui{nullptr}; 0063 int m_solution; 0064 QList<QPushButton *> m_choiceButtons{nullptr}; 0065 QList<QAction *> m_actions; 0066 LatexRenderer *m_latexRenderer{nullptr}; 0067 QFont m_solutionFont; 0068 }; 0069 0070 } 0071 0072 #endif // FLASHCARDMODEWIDGET_H