コード例 #1
0
ファイル: Util.cpp プロジェクト: crayonink/calligra-2
//not used anywhere
int Calligra::Sheets::Util::penCompare(QPen const & pen1, QPen const & pen2)
{
    if (pen1.style() == Qt::NoPen && pen2.style() == Qt::NoPen)
        return 0;

    if (pen1.style() == Qt::NoPen)
        return -1;

    if (pen2.style() == Qt::NoPen)
        return 1;

    if (pen1.width() < pen2.width())
        return -1;

    if (pen1.width() > pen2.width())
        return 1;

    if (pen1.style() < pen2.style())
        return -1;

    if (pen1.style() > pen2.style())
        return 1;

    if (pen1.color().name() < pen2.color().name())
        return -1;

    if (pen1.color().name() > pen2.color().name())
        return 1;

    return 0;
}
コード例 #2
0
ファイル: Util.cpp プロジェクト: crayonink/calligra-2
QString Calligra::Sheets::Odf::encodePen(const QPen & pen)
{
//     kDebug()<<"encodePen( const QPen & pen ) :"<<pen;
    // NOTE Stefan: QPen api docs:
    //              A line width of zero indicates a cosmetic pen. This means
    //              that the pen width is always drawn one pixel wide,
    //              independent of the transformation set on the painter.
    QString s = QString("%1pt ").arg((pen.width() == 0) ? 1 : pen.width());
    switch (pen.style()) {
    case Qt::NoPen:
        return "none";
    case Qt::SolidLine:
        s += "solid";
        break;
    case Qt::DashLine:
        s += "dashed";
        break;
    case Qt::DotLine:
        s += "dotted";
        break;
    case Qt::DashDotLine:
        s += "dot-dash";
        break;
    case Qt::DashDotDotLine:
        s += "dot-dot-dash";
        break;
    default: break;
    }
    //kDebug() << " encodePen :" << s;
    if (pen.color().isValid()) {
        s += ' ' + Style::colorName(pen.color());
    }
    return s;
}
コード例 #3
0
ファイル: cursor.cpp プロジェクト: milkmiruku/qmidiarp
// Paint event handler.
void Cursor::paintEvent(QPaintEvent*)
{
    QPainter p(this);
    QColor bg, fg;
    QPen pen;

    int xpos, xscale;
    int x;
    w = QWidget::width();
    h = QWidget::height();
    int notestreak_thick = 2;

    if (modType == 'L') {
        bg = QColor(50, 10, 10);
        fg = QColor(200, 180, 70);
    }
    else if (modType == 'S') {
        bg = QColor(10, 10, 50);
        fg = QColor(50, 180, 220);
    }

    p.fillRect(0, 0, w, h, bg);

    xscale = (w - 2 * CSR_HMARG);

    // Cursor
    pen.setWidth(notestreak_thick * 2);
    pen.setColor(fg);
    p.setPen(pen);
    x = currentIndex * xscale / nPoints;
    xpos = CSR_HMARG + x + pen.width() / 2;
    p.drawLine(xpos, h - 2,
                    xpos + (xscale / nPoints) - pen.width(), h - 2);

}
void QAbstractDiagramGraphicsItem::setPen(const QPen & pen)
{
    QStringList mAttrs;
    mAttrs << QString("color:#%1").arg(pen.color().rgb(),3, 16)
           << QString("width:%1").arg(pen.width());
    switch(pen.style()){
    case Qt::SolidLine:
        mAttrs << "style::solid";
        break;
    case Qt::DashLine:
        mAttrs << "style::dash";
        break;
    case Qt::DotLine:
        mAttrs << "style::dor";
        break;
    case Qt::DashDotLine:
        mAttrs << "style::dashdot";
        break;
    case Qt::DashDotDotLine:
        mAttrs << "style::dashdotdot";
        break;
    default:
        mAttrs << "style::solid";
        break;
    }
    setProperty("pen", mAttrs.join(";"));
}
コード例 #5
0
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();
}
コード例 #6
0
void KeypointItem::showDescription()
{
	if(!placeHolder_ || !placeHolder_->isVisible())
	{
		if(!placeHolder_)
		{
			QString info = QString( "Keypoint = %1\n"
									"Word = %2\n"
									"Response = %3\n"
									"Angle = %4\n"
									"X = %5\n"
									"Y = %6\n"
									"Size = %7").arg(id_).arg(wordID_).arg(kpt_.response).arg(kpt_.angle).arg(kpt_.pt.x).arg(kpt_.pt.y).arg(kpt_.size);

			placeHolder_ = new QGraphicsRectItem();
			placeHolder_->setVisible(false);
			this->scene()->addItem(placeHolder_);
			placeHolder_->setBrush(QBrush(QColor ( 0, 0, 0, 170 ))); // Black transparent background
			QGraphicsTextItem * text = new QGraphicsTextItem(placeHolder_);
			text->setDefaultTextColor(this->pen().color().rgb());
			text->setPlainText(info);
			placeHolder_->setRect(text->boundingRect());
		}


		QPen pen = this->pen();
		this->setPen(QPen(pen.color(), pen.width()+2));
		placeHolder_->setZValue(this->zValue()+1);
		placeHolder_->setPos(this->mapToScene(0,0));
		placeHolder_->setVisible(true);
	}
}
コード例 #7
0
ファイル: colorItemPopup.cpp プロジェクト: Axroy/qreal
ColorItemPopup::ColorItemPopup(const QPen &pen, graphicsUtils::AbstractScene &scene, QWidget *parent)
	: ItemPopup(scene, parent)
	, mLastColor(pen.color())
	, mLastThickness(pen.width())
{
	initWidget();
}
コード例 #8
0
ファイル: util.cpp プロジェクト: joonhwan/GammaRay
QVariant Util::decorationForVariant(const QVariant &value)
{
  switch (value.type()) {
  case QVariant::Brush:
  {
    const QBrush b = value.value<QBrush>();
    if (b.style() != Qt::NoBrush) {
      QPixmap p(16, 16);
      p.fill(QColor(0, 0, 0, 0));
      QPainter painter(&p);
      painter.setBrush(b);
      painter.drawRect(0, 0, p.width() - 1, p.height() - 1);
      return p;
    }
  }
  case QVariant::Color:
  {
    const QColor c = value.value<QColor>();
    if (c.isValid()) {
      QPixmap p(16, 16);
      QPainter painter(&p);
      painter.setBrush(QBrush(c));
      painter.drawRect(0, 0, p.width() - 1, p.height() - 1);
      return p;
    }
  }
  case QVariant::Cursor:
  {
    const QCursor c = value.value<QCursor>();
    if (!c.pixmap().isNull()) {
      return c.pixmap().scaled(16, 16, Qt::KeepAspectRatio, Qt::FastTransformation);
    }
  }
  case QVariant::Icon:
  {
    return value;
  }
  case QVariant::Pen:
  {
    const QPen pen = value.value<QPen>();
    if (pen.style() != Qt::NoPen) {
      QPixmap p(16, 16);
      p.fill(QColor(0, 0, 0, 0));
      QPainter painter(&p);
      painter.setPen(pen);
      painter.translate(0, 8 - pen.width() / 2);
      painter.drawLine(0, 0, p.width(), 0);
      return p;
    }
  }
  case QVariant::Pixmap:
  {
    const QPixmap p = value.value<QPixmap>();
    return QVariant::fromValue(p.scaled(16, 16, Qt::KeepAspectRatio, Qt::FastTransformation));
  }
  default: break;
  }

  return QVariant();
}
コード例 #9
0
ファイル: qwt_scale_draw.cpp プロジェクト: szmurlor/fiver
/*!
   Calculate the minimum length that is needed to draw the scale

   \param pen Pen that is used for painting backbone and ticks
   \param font Font used for painting the labels

   \sa extent()
*/
int QwtScaleDraw::minLength(const QPen &pen, const QFont &font) const
{
    int startDist, endDist;
    getBorderDistHint(font, startDist, endDist);

    const QwtScaleDiv &sd = scaleDiv();

    const uint minorCount =
        sd.ticks(QwtScaleDiv::MinorTick).count() +
        sd.ticks(QwtScaleDiv::MediumTick).count();
    const uint majorCount =
        sd.ticks(QwtScaleDiv::MajorTick).count();

    int lengthForLabels = 0;
    if ( hasComponent(QwtAbstractScaleDraw::Labels) )
    {
        if ( majorCount >= 2 )
            lengthForLabels = minLabelDist(font) * (majorCount - 1);
    }

    int lengthForTicks = 0;
    if ( hasComponent(QwtAbstractScaleDraw::Ticks) )
    {
        const int pw = qwtMax( 1, pen.width() );  // penwidth can be zero
        lengthForTicks = 2 * (majorCount + minorCount) * pw;
    }

    return startDist + endDist + qwtMax(lengthForLabels, lengthForTicks);
}
コード例 #10
0
//=============================================================================
int sstQt01PathStoreViewCls::AppendPathSymbol(int          iKey,
                                      QPainterPath oTmpPath,
                                      sstQt01ShapeType_enum eTmpPathType,
                                      QColor       oTmpColor,
                                      QPen         oTmpPen)
{

  //-----------------------------------------------------------------------------
  if ( iKey != 0) return -1;

  int iEleNum = oTmpPath.elementCount();
  for (int ii =1; ii <= iEleNum; ii++)
  {
    sstQt01PathElementCsv3Cls oShapeItemCsv;
    QPainterPath::Element oElement;
    oElement = oTmpPath.elementAt(ii-1);
    oShapeItemCsv.setAll(oElement.type,oElement.x,oElement.y, oTmpColor);
    if (oElement.type == 0)
    {
      oShapeItemCsv.setIPenStyle(oTmpPen.style());
      oShapeItemCsv.setIPenWidth(oTmpPen.width());
      oShapeItemCsv.setShapeType(eTmpPathType);
    }
  }

  return 0;
}
コード例 #11
0
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);
}
コード例 #12
0
ファイル: kigpainter.cpp プロジェクト: KDE/kig
void KigPainter::setPen( const QPen& p )
{
    color = p.color();
    width = p.width();
    style = p.style();
    mP.setPen(p);
}
コード例 #13
0
PaintSchemePolyline::PaintSchemePolyline(const QPen &pen) :
    PaintScheme(pen,QBrush()),
    p_borderWidth(0),
    p_lineWidth(pen.width()),
    p_lineSimplified(true)
{
}
コード例 #14
0
PaintSchemePolyline::PaintSchemePolyline(const QPen &pen, const QBrush &brush, int width) :
    PaintScheme(pen,brush),
    p_borderWidth(pen.width()),
    p_lineWidth(width - p_borderWidth * 2),
    p_lineSimplified(true)
{
}
コード例 #15
0
void EllipseWidget::drawFrame(QPainter *p, const QRect& rect)
{
	p->save();
	if (d_plot->antialiasing())
		p->setRenderHints(QPainter::Antialiasing);

	QPainterPath ellipse;
	if (d_frame == Line){
		QPen pen = QwtPainter::scaledPen(d_frame_pen);
		p->setPen(pen);

		int lw = pen.width()/2;
		QRect r = rect.adjusted(lw + 1, lw + 1, -lw - 1, -lw - 1);

		ellipse.addEllipse(r);
		p->fillPath(ellipse, palette().color(QPalette::Window));
		if (d_brush.style() != Qt::NoBrush)
			p->setBrush(d_brush);

        p->drawEllipse(r);
	} else {
		ellipse.addEllipse(rect);
		p->fillPath(ellipse, palette().color(QPalette::Window));
		if (d_brush.style() != Qt::NoBrush)
			p->fillPath(ellipse, d_brush);
	}

	p->restore();
}
コード例 #16
0
ファイル: mythrender_opengl1.cpp プロジェクト: Openivo/mythtv
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);
}
コード例 #17
0
ファイル: nmgchartitem.cpp プロジェクト: Shwe-123/netmeter
void NMGChartSeries::paint(QPainter* painter,
                           const QStyleOptionGraphicsItem* option, 
                           QWidget* widget)
{
  if(!vertexList.isEmpty())
  { 
    if(spaceAvailableIntoSceneChanged || rebuildScaleFactors)
    {
      calculateScaleFactors();
      if(spaceAvailableIntoSceneChanged) spaceAvailableIntoSceneChanged = FALSE;
      if(rebuildScaleFactors) rebuildScaleFactors = FALSE;
    }
    
    QPen pen;
    pen.setColor(baseColor);
    pen.setWidth(1);
    painter->setPen(pen);
  
    if(isClipped)
    {
      painter->setClipRect(0, 0, currentWidthIntoScene + pen.width(), currentHeightIntoScene);
    }
    painter->save();
    painter->translate(0,currentHeightIntoScene);
        
    if(representation == LINE_TYPE) paintLine(painter, option, widget);
    else if(representation == AREA_TYPE) paintArea(painter, option, widget);
    else if(representation == POINTS_TYPE) paintPoints(painter, option, widget);
    else if(representation == BARS_TYPE) paintBars(painter, option, widget);
    
    painter->restore();
  }
}
コード例 #18
0
ファイル: CPuzzleNodeArtist.cpp プロジェクト: raymyers/gnat
////////////////////////////////////////////////////////////////////////////////
/// CPuzzleNodeArtist::paintNode
///
/// @description     This function paints a single node to the screen.  It
///                  draws the node using the given QPainter object.
/// @pre             None
/// @post            The given node is painted to the screen.
///
/// @param node:     This is a pointer to the node to be painted to the screen.
/// @param painter:  This is a pointer to the QPainter object to be used to
///                  paint the node on the screen.
///
/// @limitations     None
///
////////////////////////////////////////////////////////////////////////////////
void CPuzzleNodeArtist::paintNode( const SPuzzleNode * node,
                                   QPainter *painter )
{
    int radius = m_style->getNodeRadius();
    QRect rect(0, 0, radius * 2, radius * 2);
    rect.moveCenter(node->s_position-QPoint(1,0));
    QPen pen = m_style->getPen();
    if ( node->s_flag & SPuzzleNode::EndNode )
        pen.setWidth( pen.width() + m_style->getBoldWidth() );
    painter->setPen(pen);
    painter->setBrush(m_style->getBrush());
    painter->setFont(m_style->getFont());
    painter->setRenderHint(QPainter::Antialiasing);

	QString text;

	text.append(node->s_name);

	if(node->s_name.isEmpty() == false)
		text.append(QString(" "));

	if(m_showHeuristics)
		text.append(QString::number(node->s_heuristic));

    painter->drawEllipse(rect);
    painter->drawText(rect, Qt::AlignCenter, text);
    if( node->s_flag & SPuzzleNode::StartNode )
        drawArrow( painter, rect );
}
コード例 #19
0
ファイル: qwt_scale_draw.cpp プロジェクト: szmurlor/fiver
/*!
   Calculate the width/height that is needed for a
   vertical/horizontal scale.

   The extent is calculated from the pen width of the backbone,
   the major tick length, the spacing and the maximum width/height
   of the labels.

   \param pen Pen that is used for painting backbone and ticks
   \param font Font used for painting the labels

   \sa minLength()
*/
int QwtScaleDraw::extent(const QPen &pen, const QFont &font) const
{
    int d = 0;

    if ( hasComponent(QwtAbstractScaleDraw::Labels) )
    {
        if ( orientation() == Qt::Vertical )
            d = maxLabelWidth(font);
        else
            d = maxLabelHeight(font);

        if ( d > 0 )
            d += spacing();
    }

    if ( hasComponent(QwtAbstractScaleDraw::Ticks) )
    {
        d += majTickLength();
    }

    if ( hasComponent(QwtAbstractScaleDraw::Backbone) )
    {
        const int pw = qwtMax( 1, pen.width() );  // penwidth can be zero
        d += pw;
    }

    d = qwtMax(d, minimumExtent());
    return d;
}
コード例 #20
0
ファイル: mythpainter.cpp プロジェクト: dhaber/mythtv
void MythPainter::DrawRectPriv(MythImage *im, const QRect &area, int radius,
                               int ellipse,
                               const QBrush &fillBrush, const QPen &linePen)
{
    if (!im)
        return;

    QImage image(QSize(area.width(), area.height()), QImage::Format_ARGB32);
    image.fill(0x00000000);
    QPainter painter(&image);
    painter.setRenderHint(QPainter::Antialiasing);
    painter.setPen(linePen);
    painter.setBrush(fillBrush);

    if ((area.width() / 2) < radius)
        radius = area.width() / 2;

    if ((area.height() / 2) < radius)
        radius = area.height() / 2;

    int lineWidth = linePen.width();
    QRect r(lineWidth, lineWidth,
            area.width() - (lineWidth * 2), area.height() - (lineWidth * 2));

    if (ellipse)
        painter.drawEllipse(r);
    else if (radius == 0)
        painter.drawRect(r);
    else
        painter.drawRoundedRect(r, (qreal)radius, qreal(radius));

    painter.end();
    im->Assign(image);
}
コード例 #21
0
ファイル: QRoundedRect.cpp プロジェクト: maqiangddb/pc_code
void QRoundedRect::setRectA(const QRectF &rect)
{
    QRectF rectA = rect;
    qreal dDelta = 0.0;

    QPen pen = this->pen();
    int iPenWidth = pen.width();
    if (iPenWidth > 0)
    {
        dDelta = (iPenWidth * 1.0) / 2;
        rectA.setTop(rectA.top() + dDelta);
        rectA.setLeft(rectA.left() + dDelta);
        rectA.setWidth(rectA.width() - dDelta);
        rectA.setHeight(rectA.height() - dDelta);
    }

    qHeight = rectA.height();
    qWidth = rectA.width();
    Rpos.setX(rectA.x());
    Rpos.setY(rectA.y());

    QPainterPath path;
    path.addRoundedRect(rectA,xRadius,yRadius,Qt::AbsoluteSize);
    RectPath = path;
    setPath(RectPath);
    SetPattern(nPatternType);
}
コード例 #22
0
ファイル: qwt_symbol.cpp プロジェクト: CaptainFalco/OpenPilot
static inline void qwtDrawXCrossSymbols( QPainter *painter,
    const QPointF *points, int numPoints, const QwtSymbol &symbol )
{
    const QSize size = symbol.size();
    int off = 0;

    QPen pen = symbol.pen();
    if ( pen.width() > 1 )
    {
        pen.setCapStyle( Qt::FlatCap );
        off = 1;
    }
    painter->setPen( pen );


    if ( QwtPainter::roundingAlignment( painter ) )
    {
        const int sw = size.width();
        const int sh = size.height();
        const int sw2 = size.width() / 2;
        const int sh2 = size.height() / 2;

        for ( int i = 0; i < numPoints; i++ )
        {
            const QPointF &pos = points[i];

            const int x = qRound( pos.x() );
            const int y = qRound( pos.y() );

            const int x1 = x - sw2;
            const int x2 = x1 + sw + off;
            const int y1 = y - sh2;
            const int y2 = y1 + sh + off;

            QwtPainter::drawLine( painter, x1, y1, x2, y2 );
            QwtPainter::drawLine( painter, x2, y1, x1, y2 );
        }
    }
    else
    {
        const double sw = size.width();
        const double sh = size.height();
        const double sw2 = 0.5 * size.width();
        const double sh2 = 0.5 * size.height();

        for ( int i = 0; i < numPoints; i++ )
        {
            const QPointF &pos = points[i];

            const double x1 = pos.x() - sw2;
            const double x2 = x1 + sw;
            const double y1 = pos.y() - sh2;
            const double y2 = y1 + sh;

            QwtPainter::drawLine( painter, x1, y1, x2, y2 );
            QwtPainter::drawLine( painter, x1, y2, x2, y1 );
        }
    }
}
コード例 #23
0
ファイル: qgsgrassoptions.cpp プロジェクト: AM7000000/QGIS
QgsGrassOptions::QgsGrassOptions( QWidget *parent )
    : QgsOptionsDialogBase( "GrassOptions", parent )
    , QgsGrassOptionsBase()
    , mImportSettingsPath( "/GRASS/browser/import" )
    , mModulesSettingsPath( "/GRASS/modules/config" )
{
  setupUi( this );
  initOptionsBase( false );

  connect( this, SIGNAL( accepted() ), SLOT( saveOptions() ) );
  connect( buttonBox->button( QDialogButtonBox::Apply ), SIGNAL( clicked() ), SLOT( saveOptions() ) );

  QSettings settings;

  // General
  QString version = QString( GRASS_VERSION_STRING ).remove( "@(#)" ).trimmed();
  QString revision = QString( GIS_H_VERSION ).remove( "$" ).trimmed();
  mGrassVersionLabel->setText( tr( "GRASS version" ) + " : " + version + " " + revision );

  bool customGisbase = settings.value( "/GRASS/gidbase/custom", false ).toBool();
  QString customGisbaseDir = settings.value( "/GRASS/gidbase/customDir" ).toString();
  mGisbaseDefaultRadioButton->setText( tr( "Default" ) + " (" + QgsGrass::defaultGisbase() + ")" );
  mGisbaseDefaultRadioButton->setChecked( !customGisbase );
  mGisbaseCustomRadioButton->setChecked( customGisbase );
  mGisbaseLineEdit->setText( customGisbaseDir );
  gisbaseChanged();
  connect( mGisbaseDefaultRadioButton, SIGNAL( toggled( bool ) ), SLOT( gisbaseChanged() ) );
  connect( mGisbaseLineEdit, SIGNAL( textChanged( const QString & ) ), SLOT( gisbaseChanged() ) );
  connect( mGisbaseLineEdit, SIGNAL( textEdited( const QString & ) ), SLOT( gisbaseChanged() ) );
  connect( mGisbaseGroupBox, SIGNAL( collapsedStateChanged( bool ) ), SLOT( gisbaseChanged() ) );

  // Modules
  bool customModules = settings.value( mModulesSettingsPath + "/custom", false ).toBool();
  QString customModulesDir = settings.value( mModulesSettingsPath + "/customDir" ).toString();
  mModulesConfigDefaultRadioButton->setText( tr( "Default" ) + " (" + QgsGrass::modulesConfigDefaultDirPath() + ")" );
  mModulesConfigDefaultRadioButton->setChecked( !customModules );
  mModulesConfigCustomRadioButton->setChecked( customModules );
  mModulesConfigDirLineEdit->setText( customModulesDir );
  mModulesDebugCheckBox->setChecked( QgsGrass::modulesDebug() );

  // Browser
  QgsRasterProjector::Precision crsTransform = ( QgsRasterProjector::Precision ) settings.value( mImportSettingsPath + "/crsTransform", QgsRasterProjector::Approximate ).toInt();
  mCrsTransformationComboBox->addItem( QgsRasterProjector::precisionLabel( QgsRasterProjector::Approximate ), QgsRasterProjector::Approximate );
  mCrsTransformationComboBox->addItem( QgsRasterProjector::precisionLabel( QgsRasterProjector::Exact ), QgsRasterProjector::Exact );
  mCrsTransformationComboBox->setCurrentIndex( mCrsTransformationComboBox->findData( crsTransform ) );

  mImportExternalCheckBox->setChecked( settings.value( mImportSettingsPath + "/external", true ).toBool() );

  mTopoLayersCheckBox->setChecked( settings.value( "/GRASS/showTopoLayers", false ).toBool() );

  // Region
  QPen regionPen = QgsGrass::regionPen();
  mRegionColorButton->setContext( "gui" );
  mRegionColorButton->setColorDialogTitle( tr( "Select color" ) );
  mRegionColorButton->setColor( regionPen.color() );
  mRegionWidthSpinBox->setValue( regionPen.width() );

  restoreOptionsBaseUi();
}
コード例 #24
0
ファイル: luapen.cpp プロジェクト: Daandelange/Fugio
int LuaPen::luaWidth( lua_State *L )
{
	QPen		*Pen = checkpen( L );

	lua_pushinteger( L, Pen->width() );

	return( 1 );
}
コード例 #25
0
ファイル: Util.cpp プロジェクト: crayonink/calligra-2
QDomElement Calligra::Sheets::NativeFormat::createElement(const QString & tagname, const QPen & pen, QDomDocument & doc)
{
    QDomElement e(doc.createElement(tagname));
    e.setAttribute("color", pen.color().name());
    e.setAttribute("style", (int)pen.style());
    e.setAttribute("width", (int)pen.width());
    return e;
}
コード例 #26
0
ファイル: FNTextDialog.cpp プロジェクト: 4doe/openembedded
void FNTextDialog::setPen(const QPen& pen)
{
	_pen = pen;
	if (cboFontSize->count() <= (int)pen.width()) {
		_pen.setWidth(cboFontSize->count()-1);
	}
	cboFontSize->setCurrentItem(_pen.width());
	fraColor->setBackgroundColor(_pen.color());
}
コード例 #27
0
void QJsonPaintEngine::updatePen(const QPen &pen)
{
	Q_D(QJsonPaintEngine);
#ifdef QT_PICTURE_DEBUG
	qDebug() << " -> updatePen(): width:" << pen.width() << "style:" << pen.style() << "color:" << pen.color().name();
#endif
	d->strokePen = pen;
	setCanvasPen();
}
コード例 #28
0
void createPenNode( QDomDocument& doc, QDomNode& parent,
                    const QString& elementName, const QPen& pen )
{
    QDomElement penElement = doc.createElement( elementName );
    parent.appendChild( penElement );
    createIntNode( doc, penElement, "Width", pen.width() );
    createColorNode( doc, penElement, "Color", pen.color() );
    createStringNode( doc, penElement, "Style", penStyleToString( pen.style() ) );
}
コード例 #29
0
ファイル: SAPenSetWidget.cpp プロジェクト: czyt1988/sa
void SAPenSetWidget::setPen(const QPen &pen)
{
    m_curPen = pen;
    m_enableEmit = false;
    ui->pushButtonColor->setCurrentColor(pen.color());
    ui->comboBoxPenStyle->setStyle(pen.style());
    ui->spinBoxPenWidth->setValue(pen.width());
    ui->horizontalSliderColorAlpha->setValue(pen.color().alpha());
    m_enableEmit = true;
}
コード例 #30
0
void QwtPlotPropertySetDialog::updateCurveValue(QwtPlotCurve *cur)
{
    int baseID = getCurveBaseID(cur);
    m_property_id.setVarPropertyData(makeCurvePropertyID(baseID,ID_CurveTitle)
                                     ,cur->title().text());
    const QPen pen = cur->pen();
    m_property_id.setVarPropertyData(makeCurvePropertyID(baseID,ID_CurveColore)
                                     ,pen.color());
    m_property_id.setVarPropertyData(makeCurvePropertyID(baseID,ID_CurveWidth)
                                     ,pen.width());
    m_property_id.setVarPropertyData(makeCurvePropertyID(baseID,ID_CurvePenStyle)
                                     ,penStyle2Order(pen.style()));
}