You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
|
#ifndef QREPORTWIDGET_H
|
|
|
|
|
|
#define QREPORTWIDGET_H
|
|
|
|
|
|
|
|
|
|
|
|
#include <QWidget>
|
|
|
|
|
|
#include <QPainter>
|
|
|
|
|
|
#include <QDateTime>
|
|
|
|
|
|
#include <QMap>
|
|
|
|
|
|
#include <QTableView>
|
|
|
|
|
|
#include <QLabel>
|
|
|
|
|
|
#include <QGridLayout>
|
|
|
|
|
|
#include <QHBoxLayout>
|
|
|
|
|
|
#include <QVBoxLayout>
|
|
|
|
|
|
#include <QStandardItemModel>
|
|
|
|
|
|
#include <QStandardItem>
|
|
|
|
|
|
struct DataItem
|
|
|
|
|
|
{
|
|
|
|
|
|
QString m_str;
|
|
|
|
|
|
int num;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class QReportWidget : public QWidget
|
|
|
|
|
|
{
|
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
QReportWidget(QString str =QString(), QWidget *parent=0);
|
|
|
|
|
|
~QReportWidget();
|
|
|
|
|
|
protected:
|
|
|
|
|
|
virtual void paintEvent(QPaintEvent *event);
|
|
|
|
|
|
void resizeEvent(QResizeEvent *event);
|
|
|
|
|
|
private:
|
|
|
|
|
|
void drawTexts(QPainter* painter);
|
|
|
|
|
|
private:
|
|
|
|
|
|
QMap<QString, int> m_str;
|
|
|
|
|
|
QString m_Title;
|
|
|
|
|
|
public:
|
|
|
|
|
|
Q_SLOT void SetData(QMap<QString, int> &m_strMap);
|
|
|
|
|
|
void UpdateTableView();
|
|
|
|
|
|
void DrawOneItem(QPainter* painter, QPoint& point, QStringList &mList);
|
|
|
|
|
|
void AppendData(QString str, int num, bool model = 0);
|
|
|
|
|
|
void ClearData();
|
|
|
|
|
|
void setTitle(QString str);
|
|
|
|
|
|
QList<DataItem> m_listStr;
|
|
|
|
|
|
|
|
|
|
|
|
QLabel *m_titleLabel;
|
|
|
|
|
|
QTableView *m_TableView;
|
|
|
|
|
|
QStandardItemModel *m_tableViewModel;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif // QREPORTWIDGET_H
|