#ifndef TRENDWIDET_H
#define TRENDWIDET_H

#include <QWidget>
#include <QSqlQueryModel>
#include "datamanagerthread.h"
#include "db/structs.h"

class QStandardItemModel;
class TrendTableModel;
namespace Ui {
class trendWidet;
}

class trendWidet : public QWidget
{
    Q_OBJECT

public:
    explicit trendWidet(QWidget *parent = nullptr);
    ~trendWidet();

private slots:
    void on_pushButton_trend_clicked();

    void on_pushButton_query_clicked();

private:
    void queryStocks(QString type);//type  "10" 10日  “20” 20日
    void queryTrends(QString date,QString type);//type  "10" 10日  “20” 20日
    void updateViews(QStringList dates);
private:
    Ui::trendWidet *ui;
    QSqlDatabase db;
    QSqlQueryModel *trend10Model;
    QSqlQueryModel *trend20Model;
    QSqlQueryModel *stocks10Model;
    QSqlQueryModel *stocks20Model;

    DataManagerThread dthread;

    QStandardItemModel* trend20_Model;
    TrendTableModel* m_trend20_Model;

    QHash<QString,QList<trends> > trends20;
};

#endif // TRENDWIDET_H
