-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdlgselectdate.cpp
51 lines (38 loc) · 1.44 KB
/
dlgselectdate.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include "dlgselectdate.h"
#include "ui_dlgselectdate.h"
#include "StockDataMgr.h"
DlgSelectDate::DlgSelectDate(QWidget *parent) :
QDialog(parent),
ui(new Ui::DlgSelectDate)
{
setWindowFlags(Qt::CustomizeWindowHint | Qt::WindowCloseButtonHint);
ui->setupUi(this);
StockData* pStockData=stockDataMgr()->FindStockData("SH000001");
QSharedPointer<StockDataInfo> pLastStockDataInfo=pStockData->GetLastStockDataInfo(STOCK_DATA_TYPE_DAY);
QSharedPointer<StockDataInfo> pFirstStockDataInfo=pStockData->GetFirstStockDataInfo(STOCK_DATA_TYPE_DAY);
QString strLastDateTime=pLastStockDataInfo->GetDate();
strLastDateTime+=" 15:00";
QDateTime mLastDateTime=QDateTime::fromString( strLastDateTime,"yyyy/MM/dd hh:mm");
QDate mLastDate=mLastDateTime.date();
QString strFirstDateTime=pFirstStockDataInfo->GetDate();
strFirstDateTime+=" 15:00";
QDateTime mFirstDateTime=QDateTime::fromString( strFirstDateTime,"yyyy/MM/dd hh:mm");
QDate mFirstDate=mFirstDateTime.date();
ui->dateEdit->setCalendarPopup(true);
ui->dateEdit->setMinimumDate(mFirstDate);
ui->dateEdit->setMaximumDate(mLastDate);
ui->dateEdit->setDate(mLastDate);
}
DlgSelectDate::~DlgSelectDate()
{
delete ui;
}
void DlgSelectDate::on_pushButton_Ok_clicked()
{
mSelectDate=ui->dateEdit->date();
accept();
}
void DlgSelectDate::on_pushButton_Cancel_clicked()
{
reject();
}