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


C++ QBrush::style方法代码示例

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


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

示例1: applySettings

void PostWindow::applySettings(Settings::Manager * settings)
{
    int scrollback = settings->value("IDE/postWindow/scrollback").toInt();

    QFont font = settings->codeFont();

    QPalette palette;
    settings->beginGroup("IDE/editor/colors");
    if (settings->contains("text")) {
        QTextCharFormat format = settings->value("text").value<QTextCharFormat>();
        QBrush bg = format.background();
        QBrush fg = format.foreground();
        if (bg.style() != Qt::NoBrush)
            palette.setBrush(QPalette::Base, bg);
        if (fg.style() != Qt::NoBrush)
            palette.setBrush(QPalette::Text, fg);
    }
    settings->endGroup(); // colors

    bool lineWrap = settings->value("IDE/postWindow/lineWrap").toBool();

    setMaximumBlockCount(scrollback);
    setFont(font);
    setPalette(palette);
    setLineWrap( lineWrap );
}
开发者ID:tintinnabuli,项目名称:supercollider,代码行数:26,代码来源:post_window.cpp

示例2: applySettings

void PostWindow::applySettings(Settings::Manager * settings)
{
    int scrollback = settings->value("IDE/postWindow/scrollback").toInt();

    QFont font = settings->codeFont();

    QPalette palette;
    settings->beginGroup("IDE/editor/colors");
    if (settings->contains("text")) {
        QTextCharFormat format = settings->value("text").value<QTextCharFormat>();
        QBrush bg = format.background();
        QBrush fg = format.foreground();
        if (bg.style() != Qt::NoBrush)
            palette.setBrush(QPalette::Base, bg);
        if (fg.style() != Qt::NoBrush)
            palette.setBrush(QPalette::Text, fg);
    }
    settings->endGroup(); // colors

    bool lineWrap = settings->value("IDE/postWindow/lineWrap").toBool();

    setMaximumBlockCount(scrollback);
    setFont(font);
    setPalette(palette);
    setLineWrap( lineWrap );

    QFontMetrics metrics (font);
    QString stringOfSpaces (settings->value("IDE/editor/indentWidth").toInt(), QChar(' '));
    setTabStopWidth(metrics.width(stringOfSpaces));

    updateActionShortcuts(settings);
}
开发者ID:mblewett,项目名称:supercollider,代码行数:32,代码来源:post_window.cpp

示例3: saveCurveLayout

QString PlotCurve::saveCurveLayout()
{
  Plot *plot = static_cast<Plot *>(this->plot());
  Graph *g = static_cast<Graph *>(plot->parent());

  int index = g->curveIndex(static_cast<QwtPlotCurve *>(this));
  int style = g->curveType(index);
  QString s = "<Style>" + QString::number(style) + "</Style>\n";

  if (style == Graph::Spline)
    s += "<LineStyle>5</LineStyle>\n";
  else if (style == Graph::VerticalSteps)
    s += "<LineStyle>6</LineStyle>\n";
  else
    s += "<LineStyle>" + QString::number(this->style()) + "</LineStyle>\n";

  QPen pen = this->pen();
  if (pen.style() != Qt::NoPen){
    s += "<Pen>\n";
    s += "\t<Color>" + pen.color().name() + "</Color>\n";
    s += "\t<Style>" + QString::number(pen.style()-1) + "</Style>\n";
    s += "\t<Width>" + QString::number(pen.widthF()) + "</Width>\n";
    s += "</Pen>\n";
  }

  QBrush brush = this->brush();
  if (brush.style() != Qt::NoBrush){
    s += "<Brush>\n";
    s += "\t<Color>" + brush.color().name() + "</Color>\n";
    s += "\t<Style>" + QString::number(PatternBox::patternIndex(brush.style())) + "</Style>\n";
    s += "</Brush>\n";
  }

  const QwtSymbol symbol = this->symbol();
  if (symbol.style() != QwtSymbol::NoSymbol){
    s += "<Symbol>\n";
    s += "\t<Style>" + QString::number(SymbolBox::symbolIndex(symbol.style())) + "</Style>\n";
    s += "\t<Size>" + QString::number(symbol.size().width()) + "</Size>\n";

    s += "\t<SymbolPen>\n";
    s += "\t\t<Color>" + symbol.pen().color().name() + "</Color>\n";
    s += "\t\t<Width>" + QString::number(symbol.pen().widthF()) + "</Width>\n";
    s += "\t</SymbolPen>\n";

    brush = this->brush();
    if (brush.style() != Qt::NoBrush){
      s += "\t<SymbolBrush>\n";
      s += "\t\t<Color>" + symbol.brush().color().name() + "</Color>\n";
      s += "\t\t<Style>" + QString::number(PatternBox::patternIndex(symbol.brush().style())) + "</Style>\n";
      s += "\t</SymbolBrush>\n";
    }
    s += "</Symbol>\n";
  }
  s += "<xAxis>" + QString::number(xAxis()) + "</xAxis>\n";
  s += "<yAxis>" + QString::number(yAxis()) + "</yAxis>\n";
  s += "<Visible>" + QString::number(isVisible()) + "</Visible>\n";
  return s;
}
开发者ID:jkrueger1,项目名称:mantid,代码行数:58,代码来源:PlotCurve.cpp

示例4: updateBackground

void QJsonPaintEngine::updateBackground(Qt::BGMode bgMode, const QBrush &bgBrush)
{
	Q_D(QJsonPaintEngine);
#ifdef QT_PICTURE_DEBUG
	qDebug() << " -> updateBackground(): mode:" << bgMode << "style:" << bgBrush.style();
#endif
	d->s << QString("\t{\"b\": { \"m\": \"%1\", \"b\": {\"c\": \"%2\", \"s\": \"%3\"}}},\r\n")
			.arg(bgMode)
			.arg(bgBrush.color().name())
			.arg(bgBrush.style());
}
开发者ID:jhihn,项目名称:Vaudeville,代码行数:11,代码来源:qpaintengine_json.cpp

示例5: saveOdfGradientStyle

QString KoOdfGraphicStyles::saveOdfGradientStyle(KoGenStyles &mainStyles, const QBrush &brush)
{
    KoGenStyle gradientStyle;
    if (brush.style() == Qt::RadialGradientPattern) {
        const QRadialGradient *gradient = static_cast<const QRadialGradient*>(brush.gradient());
        gradientStyle = KoGenStyle(KoGenStyle::RadialGradientStyle /*no family name*/);
        gradientStyle.addAttributePercent("svg:cx", gradient->center().x() * 100);
        gradientStyle.addAttributePercent("svg:cy", gradient->center().y() * 100);
        gradientStyle.addAttributePercent("svg:r",  gradient->radius() * 100);
        gradientStyle.addAttributePercent("svg:fx", gradient->focalPoint().x() * 100);
        gradientStyle.addAttributePercent("svg:fy", gradient->focalPoint().y() * 100);
    } else if (brush.style() == Qt::LinearGradientPattern) {
        const QLinearGradient *gradient = static_cast<const QLinearGradient*>(brush.gradient());
        gradientStyle = KoGenStyle(KoGenStyle::LinearGradientStyle /*no family name*/);
        gradientStyle.addAttributePercent("svg:x1", gradient->start().x() * 100);
        gradientStyle.addAttributePercent("svg:y1", gradient->start().y() * 100);
        gradientStyle.addAttributePercent("svg:x2", gradient->finalStop().x() * 100);
        gradientStyle.addAttributePercent("svg:y2", gradient->finalStop().y() * 100);
    } else if (brush.style() == Qt::ConicalGradientPattern) {
        const QConicalGradient * gradient = static_cast<const QConicalGradient*>(brush.gradient());
        gradientStyle = KoGenStyle(KoGenStyle::ConicalGradientStyle /*no family name*/);
        gradientStyle.addAttributePercent("svg:cx", gradient->center().x() * 100);
        gradientStyle.addAttributePercent("svg:cy", gradient->center().y() * 100);
        gradientStyle.addAttribute("draw:angle", QString("%1").arg(gradient->angle()));
    }
    const QGradient * gradient = brush.gradient();
    if (gradient->spread() == QGradient::RepeatSpread)
        gradientStyle.addAttribute("svg:spreadMethod", "repeat");
    else if (gradient->spread() == QGradient::ReflectSpread)
        gradientStyle.addAttribute("svg:spreadMethod", "reflect");
    else
        gradientStyle.addAttribute("svg:spreadMethod", "pad");

    if (! brush.transform().isIdentity()) {
        gradientStyle.addAttribute("svg:gradientTransform", saveTransformation(brush.transform()));
    }

    QBuffer buffer;
    buffer.open(QIODevice::WriteOnly);
    KoXmlWriter elementWriter(&buffer);    // TODO pass indentation level

    // save stops
    QGradientStops stops = gradient->stops();
    Q_FOREACH (const QGradientStop & stop, stops) {
        elementWriter.startElement("svg:stop");
        elementWriter.addAttribute("svg:offset", QString("%1").arg(stop.first));
        elementWriter.addAttribute("svg:stop-color", stop.second.name());
        if (stop.second.alphaF() < 1.0)
            elementWriter.addAttribute("svg:stop-opacity", QString("%1").arg(stop.second.alphaF()));
        elementWriter.endElement();
    }
开发者ID:ChrisJong,项目名称:krita,代码行数:51,代码来源:KoOdfGraphicStyles.cpp

示例6: hasChildren

bool QBrushPropertyItem::hasChildren()
{
   if (!m_childrenSet)
   {
      m_childrenSet = true;

      QBrush brush = qvariant_cast<QBrush>(m_metaProperty.read(m_parent->qObject()));

      QPropertyItem* width = new QPropertyItem(brush.color(), "Color", this);
      m_children.append(width);
      connect(width, SIGNAL(valueChanged(const QString&, const QVariant&)), this,
              SLOT(onChildItemValueChanged(const QString&, const QVariant&)));


      int index = staticQtMetaObject.indexOfEnumerator("BrushStyle");
      QMetaEnum enumeration = staticQtMetaObject.enumerator(index);
      QChildEnumPropertyItem* brushStyle = new QChildEnumPropertyItem((int)brush.style(), "Brush Style",enumeration , this);
      m_children.append(brushStyle);
      connect(brushStyle, SIGNAL(valueChanged(const QString&, const QVariant&)), this,
              SLOT(onChildItemValueChanged(const QString&, const QVariant&)));


      QChildImagePropertyItem* textureImage = new QChildImagePropertyItem(brush.texture(), "Texture", this);
      m_children.append(textureImage);
      connect(textureImage, SIGNAL(valueChanged(const QString&, const QVariant&)), this,
              SLOT(onChildItemValueChanged(const QString&, const QVariant&)));

      return true;
   }
开发者ID:calebbuahin,项目名称:QPropertyModel,代码行数:29,代码来源:qbrushpropertyitem.cpp

示例7: setChildValues

void QBrushPropertyItem::setChildValues()
{
   if (!m_isSettingChildren)
   {
      m_isSettingChildren = true;

      QBrush brush = qvariant_cast<QBrush>(m_metaProperty.read(m_parent->qObject()));

      for (int i = 0; i < m_children.count(); i++)
      {
         QPropertyItem* child = m_children[i];
         QString propertyName = child->name();
         QVariant tval;

         if (propertyName == "Color")
         {
            tval = brush.color();
         }
         else if (propertyName == "Brush Style")
         {
            tval = (int)brush.style();
         }
         else if (propertyName == "Texture")
         {
            tval = brush.texture();
         }

         m_model->setData(child->index(), tval);
      }


      m_isSettingChildren = false;
   }
}
开发者ID:calebbuahin,项目名称:QPropertyModel,代码行数:34,代码来源:qbrushpropertyitem.cpp

示例8: fillBackground

static void fillBackground(QPainter *p, const QRectF &rect, QBrush brush, QRectF gradientRect = QRectF())//copy from QPlainTextEditor from 4.8.1
{
    p->save();
    if (brush.style() >= Qt::LinearGradientPattern && brush.style() <= Qt::ConicalGradientPattern) {
        if (!gradientRect.isNull()) {
            QTransform m = QTransform::fromTranslate(gradientRect.left(), gradientRect.top());
            m.scale(gradientRect.width(), gradientRect.height());
            brush.setTransform(m);
            const_cast<QGradient *>(brush.gradient())->setCoordinateMode(QGradient::LogicalMode);
        }
    } else {
        p->setBrushOrigin(rect.topLeft());
    }
    p->fillRect(rect, brush);
    p->restore();
}
开发者ID:3rdpaw,项目名称:MdCharm,代码行数:16,代码来源:baseeditor.cpp

示例9: paint

void EventItemDelegate::paint( QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index ) const
{
    painter->save();

    QStyleOptionViewItemV4 opt = option;
    initStyleOption(&opt, index);

    QVariant value = index.data();
    QBrush bgBrush = qvariant_cast<QBrush>(index.data(Qt::BackgroundRole));
    QBrush fgBrush = qvariant_cast<QBrush>(index.data(Qt::ForegroundRole));
    painter->setClipRect( opt.rect );
    painter->setBackgroundMode(Qt::OpaqueMode);
    painter->setBackground(Qt::transparent);
    painter->setBrush(bgBrush);

    if (bgBrush.style() != Qt::NoBrush) {
        QPen bgPen;
        bgPen.setColor(bgBrush.color().darker(250));
        bgPen.setStyle(Qt::SolidLine);
        bgPen.setWidth(1);
        painter->setPen(bgPen);
        painter->drawRoundedRect(opt.rect.x(), opt.rect.y(), opt.rect.width() - bgPen.width(), opt.rect.height() - bgPen.width(), 3.0, 3.0);
    }

    QTextDocument doc;
    doc.setDocumentMargin(3);
    doc.setDefaultStyleSheet("* {color: " + fgBrush.color().name() + ";}");
    doc.setHtml("<html><qt></head><meta name=\"qrichtext\" content=\"1\" />" + displayText(value, QLocale::system()) + "</qt></html>");
    QAbstractTextDocumentLayout::PaintContext context;
    doc.setPageSize( opt.rect.size());
    painter->translate(opt.rect.x(), opt.rect.y());
    doc.documentLayout()->draw(painter, context);
    painter->restore();
}
开发者ID:KDE,项目名称:plasmoid-eventlist,代码行数:34,代码来源:eventitemdelegate.cpp

示例10: writeBackgroundColor

void QTableModelWordMLWriter::writeBackgroundColor(QXmlStreamWriter & stream, const QBrush & b)
{
	if (b.style() != Qt::NoBrush){
		//stream.writeEmptyElement("w:color");
		stream.writeAttribute("w:fill", b.color().name());
	}
}
开发者ID:lit-uriy,项目名称:QAdvancedItemViews,代码行数:7,代码来源:qtablemodelwordmlwriter.cpp

示例11: brush

QBrush FillTab::brush(QBrush b) const {

  QColor this_color = colorDirty() ? color() : b.color();
  Qt::BrushStyle this_style = styleDirty() ? style() : b.style();

  if (useGradientDirty()) {
    // Apply / unapply gradient
    if (useGradient()) {
      b = QBrush(gradient());
    } else {
      b.setColor(this_color);
      b.setStyle(this_style);
    }
  } else {
    // Leave gradient but make other changes.
    QGradient this_gradient;
    if (const QGradient *grad = b.gradient()) {
      if (gradientDirty()) {
        this_gradient = gradient();
      } else {
        this_gradient = *grad;
      }
      b = QBrush(this_gradient);
    } else {
      b.setColor(this_color);
      b.setStyle(this_style);
    }
  }

  return b;
}
开发者ID:Kst-plot,项目名称:kst-subversion-archive,代码行数:31,代码来源:filltab.cpp

示例12: draw

/*!
  \brief Draw an intervall of the curve
  \param painter Painter
  \param xMap maps x-values into pixel coordinates.
  \param yMap maps y-values into pixel coordinates.
  \param from index of the first point to be painted
  \param to index of the last point to be painted. If to < 0 the 
         curve will be painted to its last point.

  \sa QwtCurve::drawCurve, QwtCurve::drawDots,
      QwtCurve::drawLines, QwtCurve::drawSpline,
      QwtCurve::drawSteps, QwtCurve::drawSticks
*/
void QwtCurve::draw(QPainter *painter,
    const QwtDiMap &xMap, const QwtDiMap &yMap, int from, int to)
{
    if ( !painter || dataSize() <= 0 )
        return;

    if (to < 0)
        to = dataSize() - 1;

    if ( verifyRange(from, to) > 0 )
    {
        painter->save();
        painter->setPen(d_pen);

        QBrush b = d_brush;
        if ( b.style() != Qt::NoBrush && !b.color().isValid() )
            b.setColor(d_pen.color());

        painter->setBrush(b);

        drawCurve(painter, d_style, xMap, yMap, from, to);
        painter->restore();

        if (d_sym.style() != QwtSymbol::None)
        {
            painter->save();
            drawSymbols(painter, d_sym, xMap, yMap, from, to);
            painter->restore();
        }
    }
}
开发者ID:BackupTheBerlios,项目名称:qtiplot-svn,代码行数:44,代码来源:qwt_curve.cpp

示例13: SetBlend

void MythRenderOpenGL1::DrawRectPriv(const QRect &area, const QBrush &fillBrush,
                                     const QPen &linePen, int alpha)
{
    SetBlend(true);
    DisableTextures();
    glEnableClientState(GL_VERTEX_ARRAY);

    if (fillBrush.style() != Qt::NoBrush)
    {
        SetColor(fillBrush.color().red(), fillBrush.color().green(),
                 fillBrush.color().blue(), fillBrush.color().alpha());
        GLfloat *vertices = GetCachedVertices(GL_TRIANGLE_STRIP, area);
        glVertexPointer(2, GL_FLOAT, 0, vertices);
        glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
    }

    if (linePen.style() != Qt::NoPen)
    {
        SetColor(linePen.color().red(), linePen.color().green(),
                 linePen.color().blue(), linePen.color().alpha());
        glLineWidth(linePen.width());
        GLfloat *vertices = GetCachedVertices(GL_LINE_LOOP, area);
        glVertexPointer(2, GL_FLOAT, 0, vertices);
        glDrawArrays(GL_LINE_LOOP, 0, 4);
    }

    glDisableClientState(GL_VERTEX_ARRAY);
}
开发者ID:Openivo,项目名称:mythtv,代码行数:28,代码来源:mythrender_opengl1.cpp

示例14: saveOdf

void KoTableRowStyle::saveOdf(KoGenStyle &style) const
{
    QList<int> keys = d->stylesPrivate.keys();
    foreach(int key, keys) {
        if (key == QTextFormat::BackgroundBrush) {
            QBrush backBrush = background();
            if (backBrush.style() != Qt::NoBrush)
                style.addProperty("fo:background-color", backBrush.color().name(), KoGenStyle::TableRowType);
            else
                style.addProperty("fo:background-color", "transparent", KoGenStyle::TableRowType);
        } else if (key == MinimumRowHeight) {
            style.addPropertyPt("style:min-row-height", minimumRowHeight(), KoGenStyle::TableRowType);
        } else if (key == RowHeight) {
            style.addPropertyPt("style:row-height", rowHeight(), KoGenStyle::TableRowType);
        } else if (key == UseOptimalHeight) {
            style.addProperty("style:use-optimal-row-height", useOptimalHeight(), KoGenStyle::TableRowType);
        } else if (key == BreakBefore) {
            style.addProperty("fo:break-before", KoText::textBreakToString(breakBefore()), KoGenStyle::TableRowType);
        } else if (key == BreakAfter) {
            style.addProperty("fo:break-after", KoText::textBreakToString(breakAfter()), KoGenStyle::TableRowType);
        } else if (key == KeepTogether) {
            if (keepTogether())
                style.addProperty("fo:keep-together", "always", KoGenStyle::TableRowType);
            else
                style.addProperty("fo:keep-together", "auto", KoGenStyle::TableRowType);
        }
    }
}
开发者ID:abhishekmurthy,项目名称:Calligra,代码行数:28,代码来源:KoTableRowStyle.cpp

示例15: top

void MythD3D9Painter::DrawRect(const QRect &area, const QBrush &fillBrush,
                               const QPen &linePen, int alpha)
{
    int style = fillBrush.style();
    if (style == Qt::SolidPattern || style == Qt::NoBrush)
    {
        if (!m_render)
            return;

        if (style != Qt::NoBrush)
            m_render->DrawRect(area, fillBrush.color(), alpha);

        if (linePen.style() != Qt::NoPen)
        {
            int lineWidth = linePen.width();
            QRect top(QPoint(area.x(), area.y()),
                      QSize(area.width(), lineWidth));
            QRect bot(QPoint(area.x(), area.y() + area.height() - lineWidth),
                      QSize(area.width(), lineWidth));
            QRect left(QPoint(area.x(), area.y()),
                       QSize(lineWidth, area.height()));
            QRect right(QPoint(area.x() + area.width() - lineWidth, area.y()),
                        QSize(lineWidth, area.height()));
            m_render->DrawRect(top,   linePen.color(), alpha);
            m_render->DrawRect(bot,   linePen.color(), alpha);
            m_render->DrawRect(left,  linePen.color(), alpha);
            m_render->DrawRect(right, linePen.color(), alpha);
        }
        return;
    }

    MythPainter::DrawRect(area, fillBrush, linePen, alpha);
}
开发者ID:DaveDaCoda,项目名称:mythtv,代码行数:33,代码来源:mythpainter_d3d9.cpp


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