zstockindexwidget.ui.h

来自「股票分析系统」· C头文件 代码 · 共 69 行

H
69
字号
/****************************************************************************** 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 ZStockIndexWidget::init(){    this->data=NULL;}void ZStockIndexWidget::clear(){    if(data!=NULL)delete(data);    data=NULL;    this->repaint();}void ZStockIndexWidget::destroy(){    if(data!=NULL)delete(data);}void ZStockIndexWidget::setData(ZCurrentIndexStruct* data,ZCodeTel* CodeTel){    this->SHIndex=CodeTel->findByCode("1A0001")->fgetLastClose();    this->SZIndex=CodeTel->findByCode("399001")->fgetLastClose();    setData(data);}void ZStockIndexWidget::setData(ZCurrentIndexStruct* data){    if(this->data!=NULL)delete(this->data);    this->data=new ZCurrentIndexStruct();    for(unsigned int i=0;i<sizeof(ZCurrentIndexStruct);i++)    {	*(((unsigned char*)(this->data))+i)= *(((unsigned char*)(data))+i);    }    this->repaint();}void ZStockIndexWidget::paintEvent( QPaintEvent * ){    int w=this->width();    int h=0; //   int dw=this->width()/12;    int dh=this->height();    QPainter p( this );    p.setFont(*TextFont);    p.setPen( QColor(0,0,255) );     p.drawRect(0,0,this->width()-1,height()-1);       if(data==NULL)     {	p.drawText(0,h,w/2,dh,Qt::AlignLeft | Qt::AlignVCenter,tr(QString("  上证 -------  涨跌 -------    ----------万 ----------手    ")));	p.drawText(w/2,h,w/2,dh,Qt::AlignLeft | Qt::AlignVCenter,tr(QString("  深证 -------  涨跌 -------    ----------万 ----------手   ")));	return;    }    	zDrawText(&p,0,h,w/2,dh,Qt::AlignLeft | Qt::AlignVCenter,tr(QString("  上证 %1  涨跌 %1    %1万 %1手    ").arg(data->getSHIndex(),8,'f',2).arg(data->getSHIndex()-SHIndex,7,'f',2).arg(data->getSHMoney(),10,'f',0).arg(data->getSHShou(),10,'f',0)),data->getSHIndex(),SHIndex);	zDrawText(&p,w/2,h,w/2,dh,Qt::AlignLeft | Qt::AlignVCenter,tr(QString("  深证 %1  涨跌 %1    %1万 %1手    ").arg(data->getSZIndex(),8,'f',2).arg(data->getSZIndex()-SZIndex,7,'f',2).arg(data->getSZMoney(),10,'f',0).arg(data->getSZShou(),10,'f',0)),data->getSZIndex(),SZIndex);}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?