QGeoMapCircleObject * MapBox::addCircle(const QGeoCoordinate & center, qreal radius) { QGeoMapCircleObject * circle = new QGeoMapCircleObject(center, radius); circle->setPen(defaultPen()); circle->setBrush(defaultBrush()); m_mapWidget->addMapObject(circle); return circle; }
QGeoMapRectangleObject * MapBox::addRectangle(const QGeoCoordinate & topLeft, const QGeoCoordinate & bottomRight) { QGeoMapRectangleObject * rectangle = new QGeoMapRectangleObject(topLeft, bottomRight); rectangle->setPen(defaultPen()); rectangle->setBrush(defaultBrush()); m_mapWidget->addMapObject(rectangle); return rectangle; }
QGeoMapPolygonObject * MapBox::addPolygon(const QList<QGeoCoordinate> & path) { QGeoMapPolygonObject * polygon = new QGeoMapPolygonObject(); polygon->setPen(defaultPen()); polygon->setBrush(defaultBrush()); polygon->setPath(path); m_mapWidget->addMapObject(polygon); return polygon; }
//----------------------------------------------------------------------------- // Function: setConflicted() //----------------------------------------------------------------------------- void AddressSpaceVisualizationItem::setConflicted(bool conflicted) { conflicted_ = conflicted; if (conflicted) { setBrush(KactusColors::MISSING_COMPONENT); } else { setBrush(defaultBrush()); } }
void MainWindow::setupSelectTest(QCustomPlot *customPlot) { customPlot->xAxis->setRange(-10, 10); customPlot->yAxis->setRange(-10, 10); QBrush defaultBrush(QColor(255,255,255,30)); //defaultBrush = Qt::NoBrush; /* // QCPItemPixmap QCPItemPixmap *pixmapItem = new QCPItemPixmap(customPlot); customPlot->addItem(pixmapItem); pixmapItem->setPixmap(QPixmap("./gnu.png")); pixmapItem->setScaled(true, Qt::IgnoreAspectRatio); pixmapItem->topLeft->setCoords(-0.2, 1); pixmapItem->bottomRight->setCoords(0.3, 0); QCPItemPixmap *pixmapItem2 = new QCPItemPixmap(customPlot); customPlot->addItem(pixmapItem2); pixmapItem2->setPixmap(QPixmap("./gnu.png")); pixmapItem2->setScaled(true, Qt::IgnoreAspectRatio); pixmapItem2->topLeft->setCoords(1.2, 0); pixmapItem2->bottomRight->setCoords(0.7, 1); // QCPItemRect QCPItemRect *rect = new QCPItemRect(customPlot); customPlot->addItem(rect); rect->setBrush(defaultBrush); rect->topLeft->setCoords(0, 1); rect->bottomRight->setCoords(1, 0); // QCPItemEllipse QCPItemEllipse *ellipse = new QCPItemEllipse(customPlot); customPlot->addItem(ellipse); ellipse->setBrush(defaultBrush); ellipse->topLeft->setCoords(-0.15, 1.1); ellipse->bottomRight->setCoords(1.15, 0); // QCPItemLine QCPItemLine *line = new QCPItemLine(customPlot); customPlot->addItem(line); line->start->setCoords(-0.1, 0.8); line->end->setCoords(1.1, 0.2); line->setHead(QCPLineEnding::esSpikeArrow); // QCPItemStraightLine QCPItemStraightLine *straightLine = new QCPItemStraightLine(customPlot); customPlot->addItem(straightLine); straightLine->point1->setCoords(0, 0.4); straightLine->point2->setCoords(1, 0.6); */ // QCPItemCurve QCPItemCurve *curve = new QCPItemCurve(customPlot); customPlot->addItem(curve); curve->start->setCoords(0, 1); curve->startDir->setCoords(0.5, 1); curve->endDir->setCoords(0.7, 0.2); curve->end->setCoords(1, 0); curve->setHead(QCPLineEnding::esSpikeArrow); curve->setTail(QCPLineEnding::esLineArrow); /* // QCPItemBracket QCPItemBracket *bracket = new QCPItemBracket(customPlot); customPlot->addItem(bracket); bracket->left->setCoords(-0.2, 0.35); bracket->right->setCoords(1.2, 0.65); bracket->setLength(22); */ connect(customPlot, SIGNAL(beforeReplot()), this, SLOT(selectTestColorMapRefresh())); }