当前位置: 首页>>代码示例>>C++>>正文


C++ KstPainter::setPen方法代码示例

本文整理汇总了C++中KstPainter::setPen方法的典型用法代码示例。如果您正苦于以下问题:C++ KstPainter::setPen方法的具体用法?C++ KstPainter::setPen怎么用?C++ KstPainter::setPen使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在KstPainter的用法示例。


在下文中一共展示了KstPainter::setPen方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: paintSelf

void KstViewArrow::paintSelf(KstPainter& p, const QRegion& bounds) {
  p.save();
  if (p.type() != KstPainter::P_PRINT && p.type() != KstPainter::P_EXPORT) {
    if (p.makingMask()) {
      p.setCompositionMode(QPainter::CompositionMode_Source);
    } else {
      const QRegion clip(clipRegion());
      KstViewLine::paintSelf(p, bounds - _myClipMask);
      p.setClipRegion(bounds & clip);
    }
  } else {
      KstViewLine::paintSelf(p, bounds);
  }
  
  if (hasArrow()) {
    QPoint to = KstViewLine::to();
    QPoint from = KstViewLine::from();    
    const int w = width() * p.lineWidthAdjustmentFactor();
    QPen pen(_foregroundColor, w);
    
    pen.setCapStyle(capStyle());
    p.setPen(pen);
    p.setBrush(_foregroundColor);
    
    if (_hasToArrow) {      
      paintArrow(p, to, from, w, _toArrowScaling);
    }
    if (_hasFromArrow) {      
      paintArrow(p, from, to, w, _fromArrowScaling);
    }
  }
  p.restore();
}
开发者ID:,项目名称:,代码行数:33,代码来源:

示例2: pressMoveLayoutModeMove

void KstTopLevelView::pressMoveLayoutModeMove(const QPoint& pos, bool shift) {
  Q_UNUSED(shift)
  
  const QRect old(_prevBand);

  QRect r(_pressTarget->geometry());
  for (KstViewObjectList::ConstIterator i = _selectionList.begin(); i != _selectionList.end(); ++i) {
    r = r.unite((*i)->geometry());
  }
  const QPoint originalTopLeft(r.topLeft());
  QPoint topLeft(pos - _moveOffset - _pressTarget->geometry().topLeft() + r.topLeft());
  r.moveTopLeft(topLeft);
  _moveOffsetSticky = QPoint(0, 0);
      
  int xMin = STICKY_THRESHOLD;
  int yMin = STICKY_THRESHOLD;

  snapToBorders(&xMin, &yMin, _selectionList, _pressTarget, r);

  if (labs(xMin) < STICKY_THRESHOLD) {
    _moveOffsetSticky.setX(xMin);
    topLeft.setX(topLeft.x() - xMin);
  }
  if (labs(yMin) < STICKY_THRESHOLD) {
    _moveOffsetSticky.setY(yMin);
    topLeft.setY(topLeft.y() - yMin);
  }

  r.moveTopLeft(topLeft);

  if (!_geom.contains(r, true)) {
    slideInto(_geom, r);
  }
  _prevBand = r;
  if (_prevBand != old) {
    KstPainter p;
        
    p.begin(_w);
    p.setRasterOp(Qt::NotROP);
    p.setPen(QPen(Qt::black, 0, Qt::DotLine));
    if (_selectionList.isEmpty()) {
      if (old.topLeft() != QPoint(-1, -1)) {
        _pressTarget->drawShadow(p, old.topLeft());  
      }
      _pressTarget->drawShadow(p, r.topLeft());
    } else {
      for (KstViewObjectList::Iterator iter = _selectionList.begin(); iter != _selectionList.end(); ++iter) {
        if (old.topLeft() != QPoint(-1, -1)) {
          (*iter)->drawShadow(p, old.topLeft() + (*iter)->geometry().topLeft() - originalTopLeft);
        }
        (*iter)->drawShadow(p, r.topLeft() + (*iter)->geometry().topLeft() - originalTopLeft);
      }
    }
    p.end();
  }
}
开发者ID:,项目名称:,代码行数:56,代码来源:

示例3: pressMoveLayoutModeEndPoint

void KstTopLevelView::pressMoveLayoutModeEndPoint(const QPoint& pos, bool maintainAspect) {
  // FIXME: remove this!!  Should not know about any specific type
  // for now we only know how to deal with lines 

  QRect bounds = _pressTarget->_parent->geometry();
  QPoint npos = pos;

  //pos must be inside the parent
  npos.setX(QMAX(npos.x(), bounds.left()));
  npos.setX(QMIN(npos.x(), bounds.right()));
  npos.setY(QMIN(npos.y(), bounds.bottom()));
  npos.setY(QMAX(npos.y(), bounds.top()));

  if (KstViewLinePtr line = kst_cast<KstViewLine>(_pressTarget)) {
    QPoint movePoint, anchorPoint;
    QPoint *fromPoint, *toPoint;

    if (_pressDirection & UP) {
      // UP means we are on the start endpoint
      movePoint = line->from();
      anchorPoint = line->to();
      fromPoint = &movePoint;
      toPoint = &anchorPoint;
    } else { // (_pressDirection & DOWN)
      // DOWN means we are on the end endpoint
      movePoint = line->to();
      anchorPoint = line->from();
      fromPoint = &anchorPoint;
      toPoint = &movePoint;
    }

    if (maintainAspect) {
      movePoint = KstGfxMouseHandlerUtils::findNearestPtOnLine(anchorPoint, movePoint, npos, bounds);
    } else {
      movePoint = npos; // already enforced pos inside parent.
    }

    const QRect old(_prevBand);
    
    _prevBand.setTopLeft(*fromPoint);
    _prevBand.setBottomRight(*toPoint);

    if (old != _prevBand) {
      KstPainter p;
      p.begin(_w);
      p.setPen(QPen(Qt::black, 0, Qt::DotLine));
      p.setRasterOp(Qt::NotROP);
      if (old.topLeft() != QPoint(-1, -1)) {
        p.drawLine(old.topLeft(), old.bottomRight());
      } 
      p.drawLine(_prevBand.topLeft(), _prevBand.bottomRight());
      p.end();
    }
  }
}
开发者ID:,项目名称:,代码行数:55,代码来源:

示例4: drawToBuffer

void KstViewLegend::drawToBuffer() {
  setDirty(false);

  _backBuffer.buffer().resize(contentsRect().size());
  _backBuffer.buffer().fill(backgroundColor());
  KstPainter p;
  p.begin(&_backBuffer.buffer());
  QPen pen;
  pen.setColor(foregroundColor());
  p.setPen(pen);
  drawToPainter(p);
  p.end();
}
开发者ID:,项目名称:,代码行数:13,代码来源:

示例5: pressMoveLayoutModeResize

void KstTopLevelView::pressMoveLayoutModeResize(const QPoint& pos, bool maintainAspect) {
  const QRect old(_prevBand);

  _prevBand = newSize(_pressTarget->geometry(), _pressTarget->_parent->geometry(), _pressDirection, pos, maintainAspect);
  if (_prevBand != old) {
    KstPainter p;
        
    p.begin(_w);
    p.setRasterOp(Qt::NotROP);
    p.setPen(QPen(Qt::black, 0, Qt::DotLine));
    if (old.topLeft() != QPoint(-1, -1)) {
      p.drawRect(old);
    } 
    p.drawRect(_prevBand);
    p.end();
  }
}
开发者ID:,项目名称:,代码行数:17,代码来源:

示例6: 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();
  }
}
开发者ID:,项目名称:,代码行数:46,代码来源:

示例7: pressMoveLayoutModeCenteredResize

void KstTopLevelView::pressMoveLayoutModeCenteredResize(const QPoint& pos, bool maintainAspect) {
  //centered resize means that the center of the object stays constant
  const QRect old(_prevBand);
  
  _prevBand = newSizeCentered(_pressTarget->geometry(), _pressTarget->_parent->geometry(), pos, maintainAspect);

  if (_prevBand != old) {
    KstPainter p;

    p.begin(_w);
    p.setPen(QPen(Qt::black, 0, Qt::DotLine));
    p.setRasterOp(Qt::NotROP);
    if (old.topLeft() != QPoint(-1, -1)) {
      p.drawEllipse(old);
    } 
    p.drawEllipse(_prevBand);
    p.end();
  }
}
开发者ID:,项目名称:,代码行数:19,代码来源:

示例8: 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;
    }
  }
}
开发者ID:,项目名称:,代码行数:22,代码来源:

示例9: drawSelectRect

void KstViewLine::drawSelectRect(KstPainter& p) {
  p.setPen(QPen(Qt::black, 0));
  p.setBrush(QBrush(Qt::green, Qt::SolidPattern));
  drawFocusRect(p);
}
开发者ID:,项目名称:,代码行数:5,代码来源:


注:本文中的KstPainter::setPen方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。