本文整理汇总了C++中GraphicsLayer::getColor方法的典型用法代码示例。如果您正苦于以下问题:C++ GraphicsLayer::getColor方法的具体用法?C++ GraphicsLayer::getColor怎么用?C++ GraphicsLayer::getColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GraphicsLayer
的用法示例。
在下文中一共展示了GraphicsLayer::getColor方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: paint
void BGI_AirWire::paint(QPainter* painter,
const QStyleOptionGraphicsItem* option,
QWidget* widget) {
Q_UNUSED(widget);
bool highlight =
mAirWire.isSelected() || mAirWire.getNetSignal().isHighlighted();
const qreal lod =
option->levelOfDetailFromTransform(painter->worldTransform());
// draw line
if (mLayer && mLayer->isVisible()) {
qreal width = highlight ? 3 / lod : 0; // highlighted airwires are thicker
QPen pen(mLayer->getColor(highlight), width, Qt::SolidLine, Qt::RoundCap);
painter->setPen(pen);
painter->drawLines(mLines);
if (mLines.count() > 1) {
painter->setBrush(Qt::NoBrush);
painter->drawEllipse(mBoundingRect);
}
}
#ifdef QT_DEBUG
GraphicsLayer* layer =
getLayer(GraphicsLayer::sDebugGraphicsItemsBoundingRects);
Q_ASSERT(layer);
if (layer && layer->isVisible()) {
// draw bounding rect
painter->setPen(QPen(layer->getColor(highlight), 0));
painter->setBrush(Qt::NoBrush);
painter->drawRect(mBoundingRect);
}
#endif
}
示例2: paint
void SGI_SymbolPin::paint(QPainter* painter,
const QStyleOptionGraphicsItem* option,
QWidget* widget) {
Q_UNUSED(widget);
const bool deviceIsPrinter =
(dynamic_cast<QPrinter*>(painter->device()) != 0);
const qreal lod =
option->levelOfDetailFromTransform(painter->worldTransform());
const NetSignal* netsignal = mPin.getCompSigInstNetSignal();
bool highlight =
mPin.isSelected() || (netsignal && netsignal->isHighlighted());
// draw line
GraphicsLayer* layer = getLayer(GraphicsLayer::sSymbolOutlines);
Q_ASSERT(layer);
if (layer->isVisible()) {
painter->setPen(QPen(layer->getColor(highlight), Length(158750).toPx(),
Qt::SolidLine, Qt::RoundCap));
painter->drawLine(QPointF(0, 0),
Point(*mLibPin.getLength(), 0).toPxQPointF());
}
// draw circle
if (mPin.isRequired()) {
layer = getLayer(GraphicsLayer::sSymbolPinCirclesReq);
} else {
layer = getLayer(GraphicsLayer::sSymbolPinCirclesOpt);
}
Q_ASSERT(layer);
if ((layer->isVisible()) && (!deviceIsPrinter) && (!netsignal)) {
painter->setPen(QPen(layer->getColor(highlight), 0));
painter->setBrush(Qt::NoBrush);
painter->drawEllipse(QPointF(0, 0), mRadiusPx, mRadiusPx);
}
// fill circle
if (mIsVisibleJunction && mJunctionLayer && mJunctionLayer->isVisible()) {
painter->setPen(QPen(mJunctionLayer->getColor(highlight), 0));
painter->setBrush(mJunctionLayer->getColor(highlight));
painter->drawEllipse(QPointF(0, 0), mRadiusPx, mRadiusPx);
}
// draw text or filled rect
layer = getLayer(GraphicsLayer::sSymbolPinNames);
Q_ASSERT(layer);
if ((layer->isVisible()) && (!mStaticText.text().isEmpty())) {
if ((deviceIsPrinter) || (lod > 1)) {
// draw text
painter->save();
if (mMirrored) {
static const QTransform gMirror(-1.0, 0.0, 0.0, 1.0, 0.0, 0.0);
painter->setTransform(gMirror, true);
}
if (mRotate180) painter->rotate(180);
painter->setPen(QPen(layer->getColor(highlight), 0));
painter->setFont(mFont);
painter->drawStaticText(mTextOrigin, mStaticText);
painter->restore();
} else {
// draw filled rect
painter->setPen(Qt::NoPen);
painter->setBrush(QBrush(layer->getColor(highlight), Qt::Dense5Pattern));
painter->drawRect(mTextBoundingRect);
}
}
#ifdef QT_DEBUG
layer = getLayer(GraphicsLayer::sDebugSymbolPinNetSignalNames);
Q_ASSERT(layer);
if ((layer->isVisible()) && (netsignal)) {
// draw net signal name
QFont font = qApp->getDefaultMonospaceFont();
font.setPixelSize(3);
painter->setFont(font);
painter->setPen(QPen(layer->getColor(highlight), 0));
painter->save();
if (mRotate180) painter->rotate(180);
painter->drawText(QRectF(),
Qt::AlignHCenter | Qt::AlignBottom | Qt::TextSingleLine |
Qt::TextDontClip,
*netsignal->getName());
painter->restore();
}
layer = getLayer(GraphicsLayer::sDebugGraphicsItemsBoundingRects);
Q_ASSERT(layer);
if (layer->isVisible()) {
// draw bounding rect
painter->setPen(QPen(layer->getColor(highlight), 0));
painter->setBrush(Qt::NoBrush);
painter->drawRect(mBoundingRect);
}
layer = getLayer(GraphicsLayer::sDebugGraphicsItemsTextsBoundingRects);
Q_ASSERT(layer);
if (layer->isVisible()) {
// draw text bounding rect
painter->setPen(QPen(layer->getColor(highlight), 0));
painter->setBrush(Qt::NoBrush);
painter->drawRect(mTextBoundingRect);
}
//.........这里部分代码省略.........