本文整理汇总了C++中CCurve::GetWidth方法的典型用法代码示例。如果您正苦于以下问题:C++ CCurve::GetWidth方法的具体用法?C++ CCurve::GetWidth怎么用?C++ CCurve::GetWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCurve
的用法示例。
在下文中一共展示了CCurve::GetWidth方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DrawLegend
void QGraph::DrawLegend(QPainter &painter, QPoint &Place, QFont &LegendFont, QColor &LegendColor)
{
painter.save();
int LegendSize, ypos;
QString strong;
LegendSize = 30;
ypos = 12;
painter.setFont(LegendFont);
CCurve* pCurve;
QPen TextPen(LegendColor);
QPen LegendPen(Qt::gray);
int npos = 0;
for (int nc=0; nc< m_oaCurves.size(); nc++)
{
pCurve = (CCurve*) m_oaCurves[nc];
if(pCurve->IsVisible())
{
pCurve->GetTitle(strong);
if(pCurve->n>0 && strong.length())//is there anything to draw ?
{
LegendPen.setColor(pCurve->GetColor());
LegendPen.setStyle(GetStyle(pCurve->GetStyle()));
LegendPen.setWidth(pCurve->GetWidth());
painter.setPen(LegendPen);
painter.drawLine(Place.x(), Place.y() + ypos*npos,
Place.x() + (int)(LegendSize), Place.y() + ypos*npos);
painter.setPen(TextPen);
painter.drawText(Place.x() + (int)(1.5*LegendSize), Place.y() + ypos*npos+(int)(ypos/2),
strong);
npos++;
}
}
}
painter.restore();
}
示例2: DrawCurve
void QGraph::DrawCurve(int nIndex, QPainter &painter)
{
painter.save();
static double scaley;
static int i, ptside;
static QPoint From, To, Min, Max;
static QRect rViewRect;
ptside = 2;
CCurve* pCurve = GetCurve(nIndex);
scaley = m_scaley;
QBrush FillBrush(m_BkColor);
painter.setBrush(FillBrush);
QPen CurvePen(pCurve->GetColor());
CurvePen.setStyle(GetStyle(pCurve->GetStyle()));
CurvePen.setWidth((int)pCurve->GetWidth());
painter.setPen(CurvePen);
Min.setX(int(xmin/m_scalex) +m_ptoffset.x());
Min.setY(int(ymin/scaley) +m_ptoffset.y());
Max.setX(int(xmax/m_scalex) +m_ptoffset.x());
Max.setY(int(ymax/scaley) +m_ptoffset.y());
rViewRect.setTopLeft(Min);
rViewRect.setBottomRight(Max);
if(pCurve->n>=1)
{
From.setX(int(pCurve->x[0]/m_scalex+m_ptoffset.x()));
From.setY(int(pCurve->y[0]/scaley +m_ptoffset.y()));
if(pCurve->IsVisible())
{
for (i=1; i<pCurve->n;i++)
{
To.setX(int(pCurve->x[i]/m_scalex+m_ptoffset.x()));
To.setY(int(pCurve->y[i]/scaley +m_ptoffset.y()));
painter.drawLine(From, To);
From = To;
}
}
if(pCurve->PointsVisible())
{
for (i=0; i<pCurve->n;i++)
{
if(pCurve->GetSelected() !=i)
painter.drawRect(int(pCurve->x[i]/m_scalex+m_ptoffset.x())-ptside,
int(pCurve->y[i]/ scaley+m_ptoffset.y())-ptside,
2*ptside,2*ptside);
}
}
}
if(m_bHighlightPoint)
{
int point = pCurve->GetSelected();
if(point>=0)
{
//highlight
QColor HighColor(0,40, 150);
CurvePen.setWidth((int)pCurve->GetWidth());
CurvePen.setColor(HighColor);
painter.setPen(CurvePen);
To.setX(int(pCurve->x[point]/m_scalex+m_ptoffset.x()));
To.setY(int(pCurve->y[point]/scaley +m_ptoffset.y()));
painter.drawRect(To.x()-ptside-1,To.y()-ptside-1, 2*(ptside+1),2*(ptside+1));
}
}
painter.restore();
}