📄 zstockinfobox.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.*****************************************************************************/extern QFont* TextFont;void ZStockInfoBox::init(){ drawHistroy=false; this->clear();}void ZStockInfoBox::clear(){ this->style=0; this->Tel=NULL; this->repaint();}void ZStockInfoBox::setStyle( unsigned char style ){ this->style=style;}void ZStockInfoBox::setData( ZTel * tel, unsigned char style ){ this->style=style; this->Tel=tel; this->repaint();}void ZStockInfoBox::setData( ZCodeTel * CodeTel ){ this->SHIndexLast=CodeTel->findByCode("1A0001")->fgetLastClose(); this->SHAIndexLast=CodeTel->findByCode("1A0002")->fgetLastClose(); this->SHBIndexLast=CodeTel->findByCode("1A0003")->fgetLastClose(); this->SZIndexLast=CodeTel->findByCode("399001")->fgetLastClose(); this->SZAIndexLast=CodeTel->findByCode("399002")->fgetLastClose(); this->SZBIndexLast=CodeTel->findByCode("399003")->fgetLastClose();}void ZStockInfoBox::paintEvent( QPaintEvent * ){ QPainter paint( this ); paint.setFont(*TextFont); { switch(style) { case 0x10: drawSHIndexName(&paint); if(Tel==NULL)drawIndexNULL(&paint); else drawIndexData(&paint); break; case 0x20: drawSZIndexName(&paint); if(Tel==NULL)drawIndexNULL(&paint); else drawIndexData(&paint); break; case 0x11: case 0x12: case 0x21: case 0x22: drawStockName(&paint); if(Tel==NULL)drawStockNULL(&paint); else drawStockData(&paint); break; default: drawStockName(&paint); drawStockNULL(&paint); break; } }}void ZStockInfoBox::drawStockNULL(QPainter *p){ int dw,dh; int w=0; int h=0; if(drawHistroy) { dw=this->width()/4;dh=this->height()/30; } else { dw=this->width()/4;dh=this->height()/18; } QString s=tr("-"); p->setPen(DataColor); p->drawText( w,h,dw,dh,Qt::AlignRight | Qt::AlignVCenter,s); h+=dh; p->drawText( w,h,dw,dh,Qt::AlignRight | Qt::AlignVCenter,s); h+=dh; p->drawText( w,h,dw,dh,Qt::AlignRight | Qt::AlignVCenter,s); h+=dh; p->drawText( w,h,dw,dh,Qt::AlignRight | Qt::AlignVCenter,s); h+=dh; p->drawText( w,h,dw,dh,Qt::AlignRight | Qt::AlignVCenter,s); h+=dh; p->drawText( w,h,dw,dh,Qt::AlignRight | Qt::AlignVCenter,s); h+=dh; p->drawText( w,h,dw,dh,Qt::AlignRight | Qt::AlignVCenter,s); h+=dh; p->drawText( w,h,dw,dh,Qt::AlignRight | Qt::AlignVCenter,s); h+=dh; p->drawText( w,h,dw,dh,Qt::AlignRight | Qt::AlignVCenter,s); h+=dh; p->drawText( w,h,dw,dh,Qt::AlignRight | Qt::AlignVCenter,s); h+=dh; p->drawText( w,h,dw,dh,Qt::AlignRight | Qt::AlignVCenter,s); h+=dh; p->drawText( w,h,dw,dh,Qt::AlignRight | Qt::AlignVCenter,s); h+=dh; p->drawText( w,h,dw,dh,Qt::AlignRight | Qt::AlignVCenter,s); h+=dh; p->drawText( w,h,dw,dh,Qt::AlignRight | Qt::AlignVCenter,s); h+=dh; p->drawText( w,h,dw,dh,Qt::AlignRight | Qt::AlignVCenter,s); h+=dh; p->drawText( w,h,dw,dh,Qt::AlignRight | Qt::AlignVCenter,s); h+=dh; p->drawText( w,h,dw,dh,Qt::AlignRight | Qt::AlignVCenter,s); h+=dh; p->drawText( w,h,dw,dh,Qt::AlignRight | Qt::AlignVCenter,s); w=3*dw; h=6*dh; p->drawText( w,h,dw,dh,Qt::AlignRight | Qt::AlignVCenter,s); h=12*dh; p->drawText( w,h,dw,dh,Qt::AlignRight | Qt::AlignVCenter,s); h+=dh; p->drawText( w,h,dw,dh,Qt::AlignRight | Qt::AlignVCenter,s); h+=dh; p->drawText( w,h,dw,dh,Qt::AlignRight | Qt::AlignVCenter,s); h+=dh; p->drawText( w,h,dw,dh,Qt::AlignRight | Qt::AlignVCenter,s); h+=dh; p->drawText( w,h,dw,dh,Qt::AlignRight | Qt::AlignVCenter,s); h+=dh; p->drawText( w,h,dw,dh,Qt::AlignRight | Qt::AlignVCenter,s); }void ZStockInfoBox::drawIndexData(QPainter *p){ int dw=this->width()/2;int dh=this->height()/17; int w=dw; int h=0; QString s=tr("-"); ZIndexInfoDays *data; if(Tel->isDaysTel())data=((ZDaysTel*)Tel)->getIndexInfo(); else if(Tel->isIndexMinutesTel())data=((ZMinutesTel*)Tel)->getIndexInfo(); else return; p->setPen(DataColor); if( style==0x10) { zDrawFloat( p,w,h,dw,dh,data->fgetIndex(),LastClose); h+=dh; //涨跌 zDrawFloat(p, w,h,dw,dh,data->fgetIndex()-SHIndexLast,0); } else if(style==0x20) { zDrawFloat( p,w,h,dw,dh,data->fgetIndex(),LastClose); h+=dh; //涨跌 zDrawFloat(p, w,h,dw,dh,data->fgetIndex()-SZIndexLast,0); } else { zDrawFloat( p,w,h,dw,dh,data->fgetIndex(),LastClose); h+=dh; //涨跌 p->drawText(w,h,dw,dh,Qt::AlignRight | Qt::AlignVCenter,s); } if( style==0x10) { h+=dh; //上证A股 zDrawFloat( p,w,h,dw,dh,data->fgetIndexA(),SHAIndexLast); h+=dh; //涨跌 zDrawFloat(p, w,h,dw,dh,data->fgetIndexA()-SHAIndexLast,0); } else if(style==0x20) { h+=dh; //深圳A股 zDrawFloat( p,w,h,dw,dh,data->fgetIndexA(),SZAIndexLast); h+=dh; //涨跌 zDrawFloat(p, w,h,dw,dh,data->fgetIndexA()-SZAIndexLast,0); } else { h+=dh; // p->drawText( w,h,dw,dh,Qt::AlignRight | Qt::AlignVCenter,s); h+=dh; //涨跌 p->drawText( w,h,dw,dh,Qt::AlignRight | Qt::AlignVCenter,s); } if( style==0x10) { h+=dh; //上证B股 zDrawFloat( p,w,h,dw,dh,data->fgetIndexB(),SHBIndexLast); h+=dh; //涨跌 zDrawFloat( p,w,h,dw,dh,data->fgetIndexB()-SHBIndexLast,(float)0); } else if(style==0x20) { h+=dh; //深圳B股 zDrawFloat( p,w,h,dw,dh,data->fgetIndexB(),SZBIndexLast); h+=dh; //涨跌 zDrawFloat( p,w,h,dw,dh,data->fgetIndexB()-SZBIndexLast,(float)0); } else { h+=dh; p->drawText( w,h,dw,dh,Qt::AlignRight | Qt::AlignVCenter,s); h+=dh; p->drawText( w,h,dw,dh,Qt::AlignRight | Qt::AlignVCenter,s); } h+=dh; //成交总额 p->drawText( w,h,dw,dh,Qt::AlignRight | Qt::AlignVCenter,tr(QString("%1万").arg(data->fgetChenJiao(),0,'f',2))); h+=dh; //成交手数 p->drawText( w,h,dw,dh,Qt::AlignRight | Qt::AlignVCenter,tr(QString("%1手").arg(data->fgetShouShu(),0,'f',0))); h+=dh; //委买手数 zDrawText( p,w-dw/2,h,dw*3/2,dh,Qt::AlignRight | Qt::AlignVCenter,tr(QString("%1手").arg(data->fgetBuyShou(),0,'f',0)),UpColor); h+=dh; //委卖手数 zDrawText( p,w,h,dw,dh,Qt::AlignRight | Qt::AlignVCenter,tr(QString("%1手").arg(data->fgetSellShou(),0,'f',0)),DownColor); h+=dh; //委比 p->drawText( w-dw/2,h,dw*3/2,dh,Qt::AlignRight | Qt::AlignVCenter,tr(QString("%1手").arg(data->fgetWeiC(),0,'f',0)+QString("%1\%").arg(data->fgetWeiR(),0,'f',2))); h+=dh; //开盘 zDrawFloat( p,w,h,dw,dh,data->fgetOpen(),LastClose); h+=dh; //最高 zDrawFloat( p,w,h,dw,dh,data->fgetHigh(),LastClose); h+=dh; //最低 zDrawFloat( p,w,h,dw,dh,data->fgetLow(),LastClose); h+=dh; //上涨家数 zDrawInt( p,w,h,dw,dh,data->igetUp(),UpColor); h+=dh; //平盘家数 p->drawText(w,h,dw,dh,Qt::AlignRight | Qt::AlignVCenter,s); h+=dh; //平盘家数 zDrawInt(p, w,h,dw,dh,data->igetUp(),DownColor); }void ZStockInfoBox::drawIndexNULL(QPainter *p){ if(Tel->isDaysTel()|| Tel->isMinutesTel()) { int dw=this->width()/2;int dh=this->height()/17; int w=dw; int h=0;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -