本文整理汇总了C++中KstPainter::setBrush方法的典型用法代码示例。如果您正苦于以下问题:C++ KstPainter::setBrush方法的具体用法?C++ KstPainter::setBrush怎么用?C++ KstPainter::setBrush使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KstPainter
的用法示例。
在下文中一共展示了KstPainter::setBrush方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: paintSelf
void KstViewPicture::paintSelf(KstPainter& p, const QRegion& bounds) {
p.save();
if (p.type() != KstPainter::P_PRINT && p.type() != KstPainter::P_EXPORT) {
if (p.makingMask()) {
p.setRasterOp(Qt::OrROP);
} else {
const QRegion clip(clipRegion());
KstBorderedViewObject::paintSelf(p, bounds - _myClipMask);
p.setClipRegion(bounds & clip);
}
} else {
KstBorderedViewObject::paintSelf(p, bounds);
}
const QRect cr(contentsRectForDevice(p));
if (_image.isNull()) {
// fill with X
p.setBrush(QBrush(Qt::gray, Qt::SolidPattern));
p.setPen(QPen(Qt::black, 0, Qt::SolidLine));
p.drawRect(cr);
p.drawLine(cr.topLeft(), cr.bottomRight());
p.drawLine(cr.topRight(), cr.bottomLeft());
} else {
assert(!cr.isNull()); // Null view objects are not allowed. I want to see
// how this happens so it can be fixed.
if (_iCache.isNull() || _iCache.size() != cr.size()) {
_iCache = _image.copy();
if (!_iCache.isNull()) {
_iCache = _iCache.smoothScale(cr.size());
}
}
if (!_iCache.isNull()) {
if (p.makingMask()) {
// which indicates clipping / BW mode
if (_iCache.hasAlphaBuffer()) {
p.drawImage(cr.topLeft(), _iCache.createAlphaMask());
} else {
p.setBrush(Qt::color1);
p.drawRect(cr);
}
} else {
p.drawImage(cr.topLeft(), _iCache);
}
}
}
p.restore();
}
示例2: updateFocus
void KstTopLevelView::updateFocus(const QPoint& pos) {
if (_activeHandler) {
_activeHandler->updateFocus(this, pos);
return;
}
if (_mode == DisplayMode || _mode == Unknown || tracking()) {
return;
}
//TODO: make this work better with click-select mode
KstViewObjectPtr p = findDeepestChild(pos, false);
if (p) {
KstViewObjectPtr p2 = p;
while (p2->_parent && p2->_parent->_container) {
p2 = p2->_parent;
}
if (p2->_parent && !p2->_parent->_container) {
p = p2->_parent;
}
}
if (p) {
if (p->focused()) {
setCursorFor(pos, p);
_focusOn = true; // just in case - seems to be false on occasion
return;
}
p->setFocus(true);
if (_focusOn) { // something else has the focus, clear it
clearFocus();
}
setCursorFor(pos, p);
KstPainter painter;
painter.begin(_w);
painter.setRasterOp(Qt::NotROP);
painter.setPen(QPen(Qt::black, 0, Qt::SolidLine));
painter.setBrush(Qt::NoBrush);
p->drawFocusRect(painter);
painter.end();
_focusOn = true;
_hoverFocus = p;
} else {
clearFocus();
}
}
示例3: clearFocus
void KstTopLevelView::clearFocus() {
if (_focusOn) {
_pressDirection = -1;
_moveOffset = QPoint(-1, -1);
_moveOffsetSticky = QPoint(0, 0);
_w->unsetCursor();
_focusOn = false;
//recursively<bool>(&KstViewObject::setFocus, false);
if (_hoverFocus) {
KstPainter p;
p.begin(_w);
p.setViewXForm(true);
_hoverFocus->setFocus(false);
p.setRasterOp(Qt::NotROP);
p.setPen(QPen(Qt::black, 0, Qt::SolidLine));
p.setBrush(Qt::NoBrush);
_hoverFocus->drawFocusRect(p);
p.end();
_hoverFocus = 0L;
}
}
}
示例4: drawSelectRect
void KstViewLine::drawSelectRect(KstPainter& p) {
p.setPen(QPen(Qt::black, 0));
p.setBrush(QBrush(Qt::green, Qt::SolidPattern));
drawFocusRect(p);
}