📄 zminutesline.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.*****************************************************************************/using namespace std;void ZMinutesLine::paintEvent( QPaintEvent * ){ if(this->Tel==NULL) {// cerr<< "no Minute data"<<endl; if(!hasGetData) { noData(); hasGetData=true; } }}void ZMinutesLine::clear(){ DLine->clear(); StockInfoBox->clear(); if(this->Tel!=NULL) { delete(this->Tel); this->Tel=NULL; }; style=0; hasGetData=false; LastClose=-1;}void ZMinutesLine::init(){ Minutes=0; currentMinute=0; MinutesData=NULL; this->Tel=NULL; DLine=new ZDLineWidget(this); DLine->setCanClick(true); StockInfoBox=new ZStockInfoBox(this); StockInfoBox->setGeometry(0,0,250,300); StockInfoBox->setDrawHistroy(true); connect(DLine,SIGNAL(clickMinutes(ZMinutesStruct*,int)),this,SLOT(setCurrentMinute( ZMinutesStruct* ,int)));}void ZMinutesLine::resizeEvent( QResizeEvent * ){ int w=this->width(); int h=this->height(); StockInfoBox->setGeometry(w-StockInfoBox->width()-5,5,StockInfoBox->width(),h-10); DLine->setGeometry ( 5,10,StockInfoBox->x()-10,(h-20));}void ZMinutesLine::setData( ZCodeTel * CodeTel ){ StockInfoBox->setData(CodeTel);}void ZMinutesLine::setData( int Minutes,ZMinutesStruct* MinutesData ){ if(this->Minutes!=0)delete[](this->MinutesData); this->Minutes=Minutes; this->MinutesData=new ZMinutesStruct[Minutes]; unsigned char * a=(unsigned char*)(this->MinutesData); unsigned char * b=(unsigned char*)MinutesData; for(unsigned int i=0;i<sizeof(ZMinutesStruct)*Minutes;i++) { *a=*b; a++;b++; } DLine->setData(this->Minutes,this->MinutesData); setCurrentMinute(NULL,0);}void ZMinutesLine::setData( ZTel* tel,unsigned char style){ this->style=style; if(this->Tel!=NULL)delete(this->Tel); this->Tel=new ZTel(tel); StockInfoBox->setData(this->Tel,style); DLine->setData(this->Tel,style); // Tel->writeToFile("MinutesTel.log"); // this->repaint();}void ZMinutesLine::setData( ZTel* tel,unsigned char style,ZNameCode* currentStock){ this->LastClose=currentStock->fgetLastClose(); this->style=style; if(this->Tel!=NULL)delete(this->Tel); this->Tel=new ZTel(tel); StockInfoBox->setLastClose(currentStock->fgetLastClose()); StockInfoBox->setData(this->Tel,style); DLine->setData(this->Tel,currentStock);}void ZMinutesLine::setCurrentMinute(ZMinutesStruct* pM,int minute ){ if(pM==NULL) {// TimeOutLabel->setText("");// NewOutLabel->setText("");// UpdownOutLabel->setText("");// AvrOutLabel->setText("");// CountOutLabel->setText(""); return; } this->currentMinute=minute;// ZMinutesStruct *cc=pM;// TimeOutLabel->setText(QString(sgetTime(minute).c_str()));// NewOutLabel->setText(QString("%1").arg(cc->price()));// if(LastClose>0)// {// UpdownOutLabel->setText(QString("%1").arg(cc->price()-LastClose,0,'f',2));// }//// UpdownOutLabel->setText(QString("%1").arg(cc->updown()));//// AvrOutLabel->setText(QString("%1").arg(cc->avr()));// int c;// if(minute==0)c=cc->count();// else c=cc->count()-(cc-1)->count();// CountOutLabel->setText(QString("%1").arg(c/100));// DLine->setCurrentMinute(currentMinute); }string ZMinutesLine::sgetTime(int Time){ int H,M; if(Time<=120) { H=9; M=30; H=H+(Time+M)/60; M=(Time+M)%60; } else { H=13; M=0; H=H+(Time+M-120)/60; M=(Time+M-120)%60; } string s; stringstream ss; ss<<H<<":"<<M; ss>>s; return(s);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -