Warning, file /education/parley/src/practice/summarybarwidget.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* 0002 SPDX-FileCopyrightText: 2010 Daniel Laidig <d.laidig@gmx.de> 0003 SPDX-License-Identifier: GPL-2.0-or-later 0004 */ 0005 0006 #ifndef SUMMARYBARWIDGET_H 0007 #define SUMMARYBARWIDGET_H 0008 0009 #include <QWidget> 0010 0011 class QLabel; 0012 class QHBoxLayout; 0013 0014 namespace Practice 0015 { 0016 class SummaryBarWidget : public QWidget 0017 { 0018 Q_OBJECT 0019 0020 public: 0021 explicit SummaryBarWidget(QWidget *parent = nullptr); 0022 0023 void setStatistics(int correct, int wrong, int notAnswered); 0024 0025 protected: 0026 void paintEvent(QPaintEvent *event) override; 0027 bool event(QEvent *event) override; 0028 0029 private: 0030 void setupCaption(); 0031 QString correctText(); 0032 QString wrongText(); 0033 QString notAnsweredText(); 0034 0035 QPixmap captionPixmap(QColor color); 0036 0037 int m_correct{0}; 0038 int m_wrong{0}; 0039 int m_notAnswered{0}; 0040 int m_total{0}; 0041 0042 QHBoxLayout *m_layout{nullptr}; 0043 QLabel *m_correctCaption{nullptr}; 0044 QLabel *m_wrongCaption{nullptr}; 0045 QLabel *m_notAnsweredCaption{nullptr}; 0046 0047 static const int BAR_HEIGHT = 30; 0048 }; 0049 0050 } 0051 0052 #endif // SUMMARYBARWIDGET_H