本文整理汇总了C++中PlotCurve::getPen方法的典型用法代码示例。如果您正苦于以下问题:C++ PlotCurve::getPen方法的具体用法?C++ PlotCurve::getPen怎么用?C++ PlotCurve::getPen使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlotCurve
的用法示例。
在下文中一共展示了PlotCurve::getPen方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: displayLabels
void PlotScene::displayLabels(const QPointF& mousePos, const QPointF& scenePos)
{
QPalette palette;
PlotCurve* currentCurve = NULL;
for (int i(0); i < this->curves.count(); i++)
{
currentCurve = this->curves.at(i);
/* Get the CoordinateItem which abscisse is the nearest
* to the mouse position abscisse */
CoordinateItem* itemAtMousePos =
currentCurve->nearestCoordinateitemsOfX(scenePos.x());
if (itemAtMousePos == NULL) continue;
// Get the label associate to the curve
QLabel* curveLabel = this->curveLabels.at(i);
if (curveLabel == NULL) continue;
// Change the text color of the label associate to the curve
palette.setColor(QPalette::WindowText, currentCurve->getPen().color());
curveLabel->setPalette(palette);
// Change the text of the label associate to the curve
curveLabel->setText(QString("%1, %2").arg(
itemAtMousePos->x(), 6, 'f', 2).arg(
itemAtMousePos->y(), 6, 'f', 2));
curveLabel->adjustSize();
// Move the label
curveLabel->move(mousePos.x(), mousePos.y() - (i * 12));
}
}
示例2: highlightSector
void PlotScene::highlightSector(float t1, float t2, const QVariant& trackId)
{
qDebug() << "sector délimité sur mapping. Bornes : " << t1 << t2;
PlotCurve* targetPlotCurve = NULL;
// Find the curve associate to trackId of the point selected on the mapping
for(int i(0); targetPlotCurve == NULL && i < this->curves.count(); i++)
if (this->curves.at(i)->id() == trackId)
targetPlotCurve = this->curves[i];
if (targetPlotCurve == NULL)
{
qDebug() << "No PlotCurve associate to the trackId found";
return;
}
/* Get the sector that contains all the points
* corresponding to the time interval t1 to t2 */
AnimateSectorItem* sect = targetPlotCurve->sectorOn(t1, t2);
if (sect == NULL)
{
qDebug() << "impossible de déterminer le secteur correspondant "
<< "à la sélection de la vue mapping";
return;
}
// The sector will have the same color that the curve
sect->setBrush(targetPlotCurve->getPen().brush());
/* Create the group that will contain all the GraphicsItem corresponding
* to the selected zone or point */
if (this->selectedGroup == NULL)
{
this->selectedGroup = new QGraphicsItemGroup;
this->addItem(this->selectedGroup);
}
this->selectedGroup->addToGroup(sect);
sect->launchAnimation();
}