You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.2 KiB
50 lines
1.2 KiB
#ifndef QUESTIONWIDGET_H
|
|
#define QUESTIONWIDGET_H
|
|
|
|
#include "base_widget.h"
|
|
#include <QWidget>
|
|
#include <QLabel>
|
|
#include <QRadioButton>
|
|
#include <QPushButton>
|
|
#include <QButtonGroup>
|
|
#include <QVBoxLayout>
|
|
#include <vector>
|
|
#include "../shared/backend_interface.h"
|
|
|
|
class QuestionWidget : public BaseWidget {
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit QuestionWidget(exam_system::BackendInterface* backend, QWidget* parent = nullptr);
|
|
void startTest(const QString& difficulty, int questionCount);
|
|
|
|
signals:
|
|
void testCompleted(const exam_system::TestResult& result);
|
|
|
|
private slots:
|
|
void onNextClicked();
|
|
void onSubmitClicked();
|
|
void onPrevClicked();
|
|
void onOptionSelected();
|
|
|
|
private:
|
|
void setupUI() override;
|
|
void showQuestion(int index);
|
|
void updateProgress();
|
|
void updateButtonStates();
|
|
bool isCurrentQuestionAnswered();
|
|
|
|
std::vector<exam_system::QuestionInfo> questions_;
|
|
std::vector<int> user_answers_;
|
|
int current_question_ = 0;
|
|
|
|
QLabel* questionLabel;
|
|
QLabel* progressLabel;
|
|
QButtonGroup* optionGroup;
|
|
QRadioButton* optionButtons[4];
|
|
QPushButton* nextBtn;
|
|
QPushButton* prevBtn;
|
|
QPushButton* submitBtn;
|
|
};
|
|
|
|
#endif |