void CLSValueSetpointEditor::updateToolTip() { setToolTip( getToolTipText() ); }
bool PSV_ChartItem::addEllipseItem(PSV_CurveInfo &curveInfo) { if(curveInfo.m_isHidden) { return true; } setCurrentAxisType(curveInfo.m_axisType); QMap<double, double> curveData = curveInfo.m_curveDataMap; QMapIterator<double, double> iter(curveData); QPolygonF polygon; int m_radius = curveInfo.m_pointSize; double pointY0 = getAxisY(*m_min_y_curP,m_radius);; QPointF fisrtPoint(0,pointY0); QString curveName = curveInfo.m_curveName; QPen pen(curveInfo.m_pointColor); QBrush brush(curveInfo.m_pointColor); int count =1; double previous_time = 1.0 * qrand(); QGraphicsEllipseItem* preItem = NULL; int index = 1; while(iter.hasNext()) { iter.next(); double x = getAxisX(iter.key(),m_radius); double y = getAxisY(iter.value(),m_radius); QPointF point(x, y); if(index == 1) { fisrtPoint = QPointF(x + m_radius,pointY0 + m_radius); polygon.append(fisrtPoint); } polygon.append(QPointF(x+m_radius,y+m_radius)); if(index == curveData.count()) { polygon.append(QPointF(x + m_radius,pointY0 + m_radius)); polygon.append(fisrtPoint); } index++; QGraphicsEllipseItem *ellipse_item = new QGraphicsEllipseItem(this); ellipse_item->setZValue(m_curveZValue); ellipse_item->setRect(0,0,2*m_radius,2*m_radius); ellipse_item->setPos(point); ellipse_item->setFlag(QGraphicsItem::ItemIsSelectable); ellipse_item->setPen(pen); ellipse_item->setBrush(brush); ellipse_item->setData(E_CURVE_NAME,curveName); //设置属于哪条曲线 ellipse_item->setData(E_AXIS_X,iter.key()); //设置对应的X坐标轴值 ellipse_item->setData(E_PREVIOUS_TIME,previous_time); ellipse_item->setData(E_NEXT_TIME,previous_time); ellipse_item->setData(E_POINT_TYPE,EV_FIRST); ellipse_item->setData(E_ITEM_TYPE,PSV::ellipseItem); ellipse_item->setToolTip(getToolTipText(iter.key(),iter.value())); ellipse_item->installSceneEventFilter(this); if(ellipse_item != NULL) { preItem->setData(E_NEXT_TIME,iter.key()); if(count == curveData.count() - 1) { ellipse_item->setData(E_POINT_TYPE,EV_LAST); } else if(count != 1) { ellipse_item->setData(E_POINT_TYPE,EV_MID); } } preItem = ellipse_item; previous_time = iter.key(); } curveInfo.m_polygon = polygon; m_curveZValue++; return true; }