📄 zdaysline.ui.h
字号:
/****************************************************************************** ui.h extension file, included from the uic-generated form implementation.**** If you wish to add, delete or rename functions or slots use** Qt Designer which will update this file, preserving your code. Create an** init() function in place of a constructor, and a destroy() function in** place of a destructor.*****************************************************************************/#include <qpainter.h>#include "datastruct.h"void ZDaysLine::paintEvent( QPaintEvent * ){ if(this->daysTel==NULL) {// cerr<< "no Minute data"<<endl; if(!hasGetData) { noData(); hasGetData=true; } }}void ZDaysLine::clear(){ KLine->clear();// CLine->clear(); DLine->clear(); PLine->clear(); StockInfoBox->clear(); if(daysTel!=NULL) { delete(daysTel); daysTel=NULL; } hasGetData=false; }void ZDaysLine::init(){ days=0; DaysData=NULL; MinutesData=NULL; daysTel=NULL; KLine=new ZKLineWidget(this);// CLine=new ZCLineWidget(this); DLine=new ZDLineWidget(this); PLine=new ZParmLine(this); PLine->initTab(&daysTel); StockInfoBox=new ZStockInfoBox(this);// StockInfoBox->clear(); StockInfoBox->setGeometry(0,0,250,300); connect( (this->KLine), SIGNAL(getCurrentDay(ZDaysStruct*,int)),SLOT(setCurrentDay(ZDaysStruct*,int)) );// connect((this),SIGNAL(clear()),this->KLine,SLOT(clear()));// connect( (this->CLine), SIGNAL(getCurrentDay(ZDaysStruct*,int)),SLOT(setCurrentDay(ZDaysStruct*,int)) ); // connect((this),SIGNAL(clear()),this->CLine,SLOT(clear())); // connect((this),SIGNAL(clear()),this->StockInfoBox,SLOT(clear())); /////// this->clear(); }void ZDaysLine::resizeEvent( QResizeEvent * ){ int w=this->width(); int h=this->height(); StockInfoBox->setGeometry(w-StockInfoBox->width()-5,5,StockInfoBox->width(),StockInfoBox->height()); KLine->setGeometry ( 0+5,5,StockInfoBox->x()-10,(h-10)*2/3); PLine->setGeometry ( KLine->x(),KLine->y()+KLine->height(),KLine->width(),(h-KLine->height()-10)); DLine->setGeometry ( StockInfoBox->x(),StockInfoBox->y()+StockInfoBox->height()+5,StockInfoBox->width(),(h-(StockInfoBox->y()+StockInfoBox->height()+10))); }void ZDaysLine::setData( ZCodeTel * CodeTel ){ StockInfoBox->setData(CodeTel);}void ZDaysLine::setData( int days, ZDaysStruct * DaysData,int Minutes,ZMinutesStruct* MinutesData ){ if(this->days!=0)delete[](this->DaysData); this->days=days; this->DaysData=new ZDaysStruct[days]; unsigned char* a=(unsigned char*)(this->DaysData); unsigned char* b=(unsigned char*)DaysData; for(unsigned int i=0;i<sizeof(ZDaysStruct)*days;i++) { *a=*b; a++;b++; } DisplayDays=days; setCurrentDay(NULL,0); if(this->Minutes!=0)delete[](this->MinutesData); this->Minutes=Minutes; this->MinutesData=new ZMinutesStruct[Minutes]; unsigned char* aa=(unsigned char*)(this->MinutesData); unsigned char* bb=(unsigned char*)MinutesData; for(unsigned int i=0;i<sizeof(ZMinutesStruct)*Minutes;i++) { *aa=*bb; aa++;bb++; } DLine->setData(this->Minutes,this->MinutesData); DLine->repaint();}void ZDaysLine::setData(ZDaysTel* tel,unsigned char style){ if(this->daysTel!=NULL)delete(daysTel); daysTel=(ZDaysTel*)new ZTel((ZTel*)tel); StockInfoBox->setData((ZTel* )daysTel,style); KLine->setData((ZTel*)daysTel,style);// CLine->setData((ZTel*)daysTel,style); DLine->setData((ZTel*)daysTel,style); PLine->setData();}void ZDaysLine::setData(ZDaysTel* tel,ZNameCode* currentStock){ if(this->daysTel!=NULL)delete(daysTel); daysTel=(ZDaysTel*)new ZTel((ZTel*)tel); StockInfoBox->setLastClose(currentStock->fgetLastClose()); StockInfoBox->setData((ZTel* )daysTel,currentStock->getStyle()); KLine->setLastClose(currentStock->fgetLastClose()); KLine->setData((ZTel*)daysTel,currentStock->getStyle());// CLine->setData((ZTel*)daysTel,currentStock->getStyle()); DLine->setData((ZTel*)daysTel,currentStock); PLine->setData();}void ZDaysLine::setData(int Minutes,ZOldMinutesStruct* MinutesData ){ if(this->Minutes!=0)delete[](this->MinutesData); this->Minutes=Minutes; this->MinutesData=new ZMinutesStruct[Minutes]; for(int i=0;i<Minutes;i++) { (this->MinutesData+i)->setPrice((MinutesData+i)->price()); (this->MinutesData+i)->setCount((MinutesData+i)->count()); } DLine->setData(this->Minutes,this->MinutesData); DLine->repaint();}void ZDaysLine::setData(ZOldMinutesTel* tel){ DLine->setLastClose(tel->fgetLastClose()); setData(tel->getMinutes(),tel->getMinute(0));}void ZDaysLine::setCurrentDay( ZDaysStruct* pDay,int day ){ if( (pDay==NULL)) {// DateOutLabel->setText("");// OpenOutLabel->setText("");// HighOutLabel->setText("");// LowOutLabel->setText("");// CloseOutLabel->setText("");// CountOutLabel->setText(""); return; } ZDaysStruct *cc=pDay;// DateOutLabel->setText(QString("%1").arg(cc->date()));// OpenOutLabel->setText(QString("%1").arg(cc->open()));// HighOutLabel->setText(QString("%1").arg(cc->high()));// LowOutLabel->setText(QString("%1").arg(cc->low()));// CloseOutLabel->setText(QString("%1").arg(cc->close()));// CountOutLabel->setText(QString("%1").arg(cc->count())); // KLine->setCurrentDay(day);// CLine->setCurrentDay(day);}unsigned int ZDaysLine::getDate(int i){ return((DaysData+i)->date());}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -