#ifndef QUESTIONOPTION_H
#define QUESTIONOPTION_H

#include <QWidget>
#include "json/json.h"
#include "CBaseWidget.h"

namespace Ui {
class questionOption;
}

class questionOption : public CBaseWidget
{
    Q_OBJECT

public:
    explicit questionOption(int nOrder, Json::Value jOption, int nLimitedPlayTimes, QWidget *parent = nullptr);
    ~questionOption();

    int setUI(const int nWidth);
    int widgetType();
    void setMultiChoice(bool bIsMultiChoice);
    void setAnswered(bool bAnswered);
    void setChecked(bool bChecked);
    bool checked();
    int optionMumber();
signals:
    void answerChanged(int); //单选
    void answered();         //单选
    void cancelAnswered();   //单选

    void mutiAnswerChanged();
    void audioPlayCountChange();
private slots:
    void on_chkb_option_clicked();

private:
    void initOption();
    void setCheckStyle();

    Ui::questionOption *ui;

    Json::Value m_jOption;
    int m_nOrder;
    int m_nLimitedPlayTimes;
    int m_nListHeight;
    bool m_bHasAns;
    bool m_bIsMultiChoice;
};

#endif // QUESTIONOPTION_H
