QTM_BEGIN_NAMESPACE

QGeoTiledMapPolygonObjectInfo::QGeoTiledMapPolygonObjectInfo(QGeoTiledMapData *mapData, QGeoMapObject *mapObject)
    : QGeoTiledMapObjectInfo(mapData, mapObject)
{
    polygon = static_cast<QGeoMapPolygonObject*>(mapObject);

    connect(polygon,
            SIGNAL(pathChanged(QList<QGeoCoordinate>)),
            this,
            SLOT(pathChanged(QList<QGeoCoordinate>)));
    connect(polygon,
            SIGNAL(penChanged(QPen)),
            this,
            SLOT(penChanged(QPen)));
    connect(polygon,
            SIGNAL(brushChanged(QBrush)),
            this,
            SLOT(brushChanged(QBrush)));

    polygonItem = new QGraphicsPolygonItem();
    graphicsItem = polygonItem;

    penChanged(polygon->pen());
    brushChanged(polygon->brush());
    pathChanged(polygon->path());
}
Ejemplo n.º 2
0
QT_BEGIN_NAMESPACE

/*!
    \internal
    \class QDeclarativePen
    \brief The QDeclarativePen class provides a pen used for drawing rectangle borders on a QDeclarativeView.

    By default, the pen is invalid and nothing is drawn. You must either set a color (then the default
    width is 1) or a width (then the default color is black).

    A width of 1 indicates is a single-pixel line on the border of the item being painted.

    Example:
    \qml
    Rectangle {
        border.width: 2
        border.color: "red"
    }
    \endqml
*/

void QDeclarativePen::setColor(const QColor &c)
{
    _color = c;
    _valid = (_color.alpha() && _width >= 1) ? true : false;
    emit penChanged();
}
Ejemplo n.º 3
0
void QQuickPen::setPixelAligned(bool aligned)
{
    if (aligned == m_aligned)
        return;
    m_aligned = aligned;
    m_valid = m_color.alpha() && (qRound(m_width) >= 1 || (!m_aligned && m_width > 0));
    emit penChanged();
}
Ejemplo n.º 4
0
void TupBrushManager::setPenColor(const QColor &color)
{
    QBrush brush = k->pen.brush();
    brush.setColor(color);
    k->pen.setBrush(brush);

    emit penChanged(k->pen);
}
Ejemplo n.º 5
0
void SAPenSetWidget::onCurrentPenColorAlphaChanged(int v)
{
    QColor c = m_curPen.color();
    c.setAlpha(v);
    m_curPen.setColor(c);
    if(m_enableEmit)
        emit penChanged(m_curPen);
}
Ejemplo n.º 6
0
void QDeclarativePen::setWidth(int w)
{
    if (_width == w && _valid)
        return;

    _width = w;
    _valid = (_color.alpha() && _width >= 1) ? true : false;
    emit penChanged();
}
Ejemplo n.º 7
0
void QQuickPen::setWidth(qreal w)
{
    if (m_width == w && m_valid)
        return;

    m_width = w;
    m_valid = m_color.alpha() && (qRound(m_width) >= 1 || (!m_aligned && m_width > 0));
    emit penChanged();
}
Ejemplo n.º 8
0
void ModelItem::setPenWidth(qreal width, bool notify)
{
    if(width>=0.75 && m_pen.widthF()!=width) {
        m_pen.setWidthF(width);
        if(notify) {
            emit penChanged();
        }
    }
}
Ejemplo n.º 9
0
void ModelItem::setPenColor(const QColor &color, bool notify)
{
    if(color.isValid() && m_pen.color()!=color) {
        m_pen.setColor(color);
        if(notify) {
            emit penChanged();
        }
    }
}
Ejemplo n.º 10
0
QPieLegendMarkerPrivate::QPieLegendMarkerPrivate(QPieLegendMarker *q, QPieSeries *series, QPieSlice *slice, QLegend *legend) :
    QLegendMarkerPrivate(q,legend),
    q_ptr(q),
    m_series(series),
    m_slice(slice)
{
    QObject::connect(m_slice, SIGNAL(labelChanged()), this, SLOT(updated()));
    QObject::connect(m_slice, SIGNAL(brushChanged()), this, SLOT(updated()));
    QObject::connect(m_slice, SIGNAL(penChanged()), this, SLOT(updated()));
}
Ejemplo n.º 11
0
void QGeoMapRouteObject::setPen(const QPen &pen)
{
    QPen newPen = pen;
    newPen.setCosmetic(false);

    if (d_ptr->pen == newPen)
        return;

    d_ptr->pen = newPen;
    emit penChanged(newPen);
}
/*!
    \property QGeoMapPolylineObject::pen
    \brief This property holds the pen that will be used to draw this object.

    The pen is used to draw the polyline.

    The pen will be treated as a cosmetic pen, which means that the width
    of the pen will be independent of the zoom level of the map.
*/
void QGeoMapPolylineObject::setPen(const QPen &pen)
{
    QPen newPen = pen;
    newPen.setCosmetic(true);

    if (d_ptr->pen == newPen)
        return;

    d_ptr->pen = newPen;
    emit penChanged(d_ptr->pen);
}
QTM_BEGIN_NAMESPACE

QGeoTiledMapTextObjectInfo::QGeoTiledMapTextObjectInfo(QGeoTiledMapData *mapData, QGeoMapObject *mapObject)
    : QGeoTiledMapObjectInfo(mapData, mapObject)
{
    text = static_cast<QGeoMapTextObject*>(mapObject);

    connect(text,
            SIGNAL(textChanged(QString)),
            this,
            SLOT(textChanged(QString)));
    connect(text,
            SIGNAL(fontChanged(QFont)),
            this,
            SLOT(fontChanged(QFont)));
    connect(text,
            SIGNAL(penChanged(QPen)),
            this,
            SLOT(penChanged(QPen)));
    connect(text,
            SIGNAL(brushChanged(QBrush)),
            this,
            SLOT(brushChanged(QBrush)));
    connect(text,
            SIGNAL(offsetChanged(QPoint)),
            this,
            SLOT(offsetChanged(QPoint)));
    connect(text,
            SIGNAL(alignmentChanged(Qt::Alignment)),
            this,
            SLOT(alignmentChanged(Qt::Alignment)));

    textItem = new QGraphicsSimpleTextItem();
    graphicsItem = textItem;

    penChanged(text->pen());
    brushChanged(text->brush());
    originChanged(text->origin());
    fontChanged(text->font());
    textChanged(text->text());
}
Ejemplo n.º 14
0
/*!
    \property QGeoMapCircleObject::pen
    \brief This property holds the pen that will be used to draw this object.

    The pen is used to draw an outline around the circle. The circle is
    filled using the QGeoMapCircleObject::brush property.

    The pen will be treated as a cosmetic pen, which means that the width
    of the pen will be independent of the zoom level of the map.
    \since 1.1
*/
void QGeoMapCircleObject::setPen(const QPen &pen)
{
    QPen newPen = pen;
    newPen.setCosmetic(true);
    const QPen oldPen = d_ptr->pen;

    if (oldPen == newPen)
        return;

    d_ptr->pen = newPen;
    emit penChanged(newPen);
}
Ejemplo n.º 15
0
void QEmulationPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textItem)
{
    if (state()->bgMode == Qt::OpaqueMode) {
        const QTextItemInt &ti = static_cast<const QTextItemInt &>(textItem);
        QRectF rect(p.x(), p.y() - ti.ascent.toReal(), ti.width.toReal(), (ti.ascent + ti.descent + 1).toReal());
        fillBGRect(rect);
    }

    QPainterState *s = state();
    Qt::BrushStyle style = qbrush_style(s->pen.brush());
    if (style >= Qt::LinearGradientPattern && style <= Qt::ConicalGradientPattern)
    {
        QPen savedPen = s->pen;
        QGradient g = *s->pen.brush().gradient();

        if (g.coordinateMode() > QGradient::LogicalMode) {
            QTransform mat = s->pen.brush().transform();
            if (g.coordinateMode() == QGradient::StretchToDeviceMode) {
                mat.scale(real_engine->painter()->device()->width(), real_engine->painter()->device()->height());
            } else if (g.coordinateMode() == QGradient::ObjectBoundingMode) {
                const QTextItemInt &ti = static_cast<const QTextItemInt &>(textItem);
                QRectF r(p.x(), p.y() - ti.ascent.toReal(), ti.width.toReal(), (ti.ascent + ti.descent + 1).toReal());
                mat.translate(r.x(), r.y());
                mat.scale(r.width(), r.height());
            }
            g.setCoordinateMode(QGradient::LogicalMode);
            QBrush brush(g);
            brush.setTransform(mat);
            s->pen.setBrush(brush);
            penChanged();
            real_engine->drawTextItem(p, textItem);
            s->pen = savedPen;
            penChanged();
            return;
        }
    }

    real_engine->drawTextItem(p, textItem);
}
Ejemplo n.º 16
0
void ModelItem::sendAttributeChanges()
{
    emit valueChanged();

    emit enabledChanged();
    emit selectedChanged();
    emit opacityChanged();
    emit visibilityChanged();

    emit brushChanged();
    emit fontChanged();
    emit penChanged();

    emit posChanged(true, true);
}
Ejemplo n.º 17
0
int Window::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: shapeChanged(); break;
        case 1: penChanged(); break;
        case 2: brushChanged(); break;
        case 3: fontChanged(); break;
        default: ;
        }
        _id -= 4;
    }
    return _id;
}
Ejemplo n.º 18
0
void QBlitterPaintEngine::setState(QPainterState *s)
{
    Q_D(QBlitterPaintEngine);
    d->lock();
    QPaintEngineEx::setState(s);
    d->raster->setState(s);

    clipEnabledChanged();
    penChanged();
    brushChanged();
    brushOriginChanged();
    opacityChanged();
    compositionModeChanged();
    renderHintsChanged();
    transformChanged();

    d->updateClip();
}
Ejemplo n.º 19
0
 Window::Window()
 {
     renderArea = new RenderArea;					// making renderArea point to a new location

     shapeComboBox = new QComboBox;					// making the pointer shapeComboBox pointing to a ComboBox
     shapeComboBox->addItem(tr("Remove"), RenderArea::Remove);		// adding items to the comboBox  
     shapeComboBox->addItem(tr("Insert"), RenderArea::Insert);		// adding items to the comboBox 
     shapeComboBox->addItem(tr("Search"), RenderArea::Search);		// adding items to the comboBox   
     shapeComboBox->addItem(tr("Find_Minimum"), RenderArea::Find_Minimum);// adding items to the comboBox 
     shapeComboBox->addItem(tr("Find_Maximum"), RenderArea::Find_Maximum);// adding items to the comboBox 

     shapeLabel = new QLabel(tr("&Operation:"));		
     // making shapeLabel point to a QLabel storing "Operation"  (& in front of O means a shortcut "Alt+O")
     shapeLabel->setBuddy(shapeComboBox);			// associating the label with the comboBox
     
     Box = new QSpinBox;					// creating a new QSpinBox which would be used to input text
     Box->setRange(INT_MIN, INT_MAX);
     BoxLabel = new QLabel(tr("&Text:"));			// making BoxLabel point to a QLabel storing "Text"
     BoxLabel->setBuddy(Box);					// associating the label with the spinbox

     connect(shapeComboBox, SIGNAL(activated(int) ),this, SLOT( shapeChanged() ) );// connecting the "stack" button
             
     connect(Box, SIGNAL(valueChanged(int) ),this, SLOT( a() ) ) ;		   // connecting the "text" button

     QGridLayout *mainLayout = new QGridLayout;
     mainLayout->setColumnStretch(0, 1);			// set the stretch factor of the specified column to the second argument
     mainLayout->setColumnStretch(3, 1);
     mainLayout->addWidget(renderArea, 0, 0, 1, 4);		// adds widget to the grid
     mainLayout->setRowMinimumHeight(1, 6);
     mainLayout->addWidget(shapeLabel, 2, 1, Qt::AlignRight);	// the arguments are widget *,row no.,column no.,alignment
     mainLayout->addWidget(shapeComboBox, 2, 2);
     mainLayout->addWidget(BoxLabel, 7, 1, Qt::AlignRight);
     mainLayout->addWidget(Box, 7, 2);
     setLayout(mainLayout);

     shapeChanged();					// calling these functions to set the shape,pen and brush of the renderArea class
     penChanged();
     fontChanged();
     setWindowTitle(tr("Binary Search Tree"));		// setting the title of the window
 }
Ejemplo n.º 20
0
/**
 * Called when the color was changed by the user.
 */
void QG_PenToolBar::slotColorChanged(const RS_Color& color) {
    currentPen.setColor(color);
    //printf("  color changed\n");

    emit penChanged(currentPen);
}
Ejemplo n.º 21
0
void SAPenSetWidget::onCurrentColorChanged(const QColor &clr)
{
    m_curPen.setColor(clr);
    if(m_enableEmit)
        emit penChanged(m_curPen);
}
Ejemplo n.º 22
0
void SAPenSetWidget::onCurrentPenWidthChanged(int v)
{
    m_curPen.setWidth(v);
    if(m_enableEmit)
        emit penChanged(m_curPen);
}
Ejemplo n.º 23
0
void SAPenSetWidget::onCurrentPenStyleChanged(Qt::PenStyle style)
{
    m_curPen.setStyle(style);
    if(m_enableEmit)
        emit penChanged(m_curPen);
}
Ejemplo n.º 24
0
Draw::Draw()
   : QWidget()
{
    setWindowTitle(tr("Basic Drawing"));

    m_renderArea = new DrawArea;

    shapeComboBox = new QComboBox;
    shapeComboBox->addItem(tr("Polygon"),    DrawArea::Polygon);
    shapeComboBox->addItem(tr("Rectangle"),  DrawArea::Rect);
    shapeComboBox->addItem(tr("Rounded Rectangle"), DrawArea::RoundedRect);
    shapeComboBox->addItem(tr("Ellipse"),    DrawArea::Ellipse);
    shapeComboBox->addItem(tr("Pie"),        DrawArea::Pie);
    shapeComboBox->addItem(tr("Chord"),      DrawArea::Chord);
    shapeComboBox->addItem(tr("Path"),       DrawArea::Path);
    shapeComboBox->addItem(tr("Line"),       DrawArea::Line);
    shapeComboBox->addItem(tr("Polyline"),   DrawArea::Polyline);
    shapeComboBox->addItem(tr("Arc"),        DrawArea::Arc);
    shapeComboBox->addItem(tr("Points"),     DrawArea::Points);
    shapeComboBox->addItem(tr("Text"),       DrawArea::Text);

    shapeLabel = new QLabel(tr("&Shape:"));
    shapeLabel->setBuddy(shapeComboBox);

    penWidthSpinBox = new QSpinBox;
    penWidthSpinBox->setRange(0, 20);
    penWidthSpinBox->setSpecialValueText(tr("0 (cosmetic pen)"));

    penWidthLabel = new QLabel(tr("Pen &Width:"));
    penWidthLabel->setBuddy(penWidthSpinBox);

    penStyleComboBox = new QComboBox;
    penStyleComboBox->addItem(tr("Solid"), Qt::SolidLine);
    penStyleComboBox->addItem(tr("Dash"), Qt::DashLine);
    penStyleComboBox->addItem(tr("Dot"), Qt::DotLine);
    penStyleComboBox->addItem(tr("Dash Dot"), Qt::DashDotLine);
    penStyleComboBox->addItem(tr("Dash Dot Dot"), Qt::DashDotDotLine);
    penStyleComboBox->addItem(tr("None"), Qt::NoPen);

    penStyleLabel = new QLabel(tr("&Pen Style:"));
    penStyleLabel->setBuddy(penStyleComboBox);

    penCapComboBox = new QComboBox;
    penCapComboBox->addItem(tr("Flat"), Qt::FlatCap);
    penCapComboBox->addItem(tr("Square"), Qt::SquareCap);
    penCapComboBox->addItem(tr("Round"), Qt::RoundCap);

    penCapLabel = new QLabel(tr("Pen &Cap:"));
    penCapLabel->setBuddy(penCapComboBox);

    penJoinComboBox = new QComboBox;
    penJoinComboBox->addItem(tr("Miter"), Qt::MiterJoin);
    penJoinComboBox->addItem(tr("Bevel"), Qt::BevelJoin);
    penJoinComboBox->addItem(tr("Round"), Qt::RoundJoin);

    penJoinLabel = new QLabel(tr("Pen &Join:"));
    penJoinLabel->setBuddy(penJoinComboBox);    

    brushStyleComboBox = new QComboBox;
    brushStyleComboBox->addItem(tr("Linear Gradient"),  Qt::LinearGradientPattern);
    brushStyleComboBox->addItem(tr("Radial Gradient"),  Qt::RadialGradientPattern);
    brushStyleComboBox->addItem(tr("Conical Gradient"), Qt::ConicalGradientPattern);
    brushStyleComboBox->addItem(tr("Texture"), Qt::TexturePattern);
    brushStyleComboBox->addItem(tr("Solid"), Qt::SolidPattern);
    brushStyleComboBox->addItem(tr("Horizontal"), Qt::HorPattern);
    brushStyleComboBox->addItem(tr("Vertical"), Qt::VerPattern);
    brushStyleComboBox->addItem(tr("Cross"), Qt::CrossPattern);
    brushStyleComboBox->addItem(tr("Backward Diagonal"), Qt::BDiagPattern);
    brushStyleComboBox->addItem(tr("Forward Diagonal"), Qt::FDiagPattern);
    brushStyleComboBox->addItem(tr("Diagonal Cross"), Qt::DiagCrossPattern);
    brushStyleComboBox->addItem(tr("Dense 1"), Qt::Dense1Pattern);
    brushStyleComboBox->addItem(tr("Dense 2"), Qt::Dense2Pattern);
    brushStyleComboBox->addItem(tr("Dense 3"), Qt::Dense3Pattern);
    brushStyleComboBox->addItem(tr("Dense 4"), Qt::Dense4Pattern);
    brushStyleComboBox->addItem(tr("Dense 5"), Qt::Dense5Pattern);
    brushStyleComboBox->addItem(tr("Dense 6"), Qt::Dense6Pattern);
    brushStyleComboBox->addItem(tr("Dense 7"), Qt::Dense7Pattern);
    brushStyleComboBox->addItem(tr("None"), Qt::NoBrush);

    brushStyleLabel = new QLabel(tr("&Brush:"));
    brushStyleLabel->setBuddy(brushStyleComboBox);

    otherOptionsLabel       = new QLabel(tr("Options:"));
    antialiasingCheckBox    = new QCheckBox(tr("&Antialiasing"));
    transformationsCheckBox = new QCheckBox(tr("&Transformations"));

    //
    QGridLayout *mainLayout = new QGridLayout;

    mainLayout->setColumnStretch(5, 1);
    mainLayout->setHorizontalSpacing(10);
    mainLayout->setVerticalSpacing(10);
    mainLayout->addWidget(m_renderArea,      0, 0, 1, 6);

    mainLayout->addWidget(shapeLabel,        2, 0);
    mainLayout->addWidget(shapeComboBox,     2, 1);
    mainLayout->addWidget(penWidthLabel,     3, 0);
    mainLayout->addWidget(penWidthSpinBox,   3, 1);
    mainLayout->addWidget(penStyleLabel,     4, 0);
    mainLayout->addWidget(penStyleComboBox,  4, 1);

    mainLayout->addWidget(penJoinLabel,      2, 3);
    mainLayout->addWidget(penJoinComboBox,   2, 4);
    mainLayout->addWidget(penCapLabel,       3, 3);
    mainLayout->addWidget(penCapComboBox,    3, 4);
    mainLayout->addWidget(brushStyleLabel,   4, 3);
    mainLayout->addWidget(brushStyleComboBox,4, 4);

    mainLayout->addWidget(otherOptionsLabel,       5, 0);
    mainLayout->addWidget(antialiasingCheckBox,    5, 1);
    mainLayout->addWidget(transformationsCheckBox, 5, 4);
    setLayout(mainLayout);

    // signals
    connect(shapeComboBox,           SIGNAL(activated(int)),     this, SLOT(shapeChanged()));
    connect(penWidthSpinBox,         SIGNAL(valueChanged(int)),  this, SLOT(penChanged()));
    connect(penStyleComboBox,        SIGNAL(activated(int)),     this, SLOT(penChanged()));
    connect(penCapComboBox,          SIGNAL(activated(int)),     this, SLOT(penChanged()));
    connect(penJoinComboBox,         SIGNAL(activated(int)),     this, SLOT(penChanged()));
    connect(brushStyleComboBox,      SIGNAL(activated(int)),     this, SLOT(brushChanged()));
    connect(antialiasingCheckBox,    SIGNAL(toggled(bool)),      m_renderArea, SLOT(setAntialiased(bool)));
    connect(transformationsCheckBox, SIGNAL(toggled(bool)),      m_renderArea, SLOT(setTransformed(bool)));

    shapeChanged();
    penChanged();
    brushChanged();
    antialiasingCheckBox->setChecked(true);   
}
Ejemplo n.º 25
0
//! [1]
Window::Window()
{
    renderArea = new RenderArea;

    shapeComboBox = new QComboBox;
    shapeComboBox->addItem(tr("Polygon"), RenderArea::Polygon);
    shapeComboBox->addItem(tr("Rectangle"), RenderArea::Rect);
    shapeComboBox->addItem(tr("Rounded Rectangle"), RenderArea::RoundedRect);
    shapeComboBox->addItem(tr("Ellipse"), RenderArea::Ellipse);
    shapeComboBox->addItem(tr("Pie"), RenderArea::Pie);
    shapeComboBox->addItem(tr("Chord"), RenderArea::Chord);
    shapeComboBox->addItem(tr("Path"), RenderArea::Path);
    shapeComboBox->addItem(tr("Line"), RenderArea::Line);
    shapeComboBox->addItem(tr("Polyline"), RenderArea::Polyline);
    shapeComboBox->addItem(tr("Arc"), RenderArea::Arc);
    shapeComboBox->addItem(tr("Points"), RenderArea::Points);
    shapeComboBox->addItem(tr("Text"), RenderArea::Text);
    shapeComboBox->addItem(tr("Pixmap"), RenderArea::Pixmap);

    shapeLabel = new QLabel(tr("&Shape:"));
    shapeLabel->setBuddy(shapeComboBox);
//! [1]

//! [2]
    penWidthSpinBox = new QSpinBox;
    penWidthSpinBox->setRange(0, 20);
#if defined(Q_OS_SYMBIAN) || defined(Q_WS_MAEMO_5) || defined(Q_WS_SIMULATOR)
    penWidthSpinBox->setSpecialValueText(tr("0"));
#else
    penWidthSpinBox->setSpecialValueText(tr("0 (cosmetic pen)"));
#endif

    penWidthLabel = new QLabel(tr("Pen &Width:"));
    penWidthLabel->setBuddy(penWidthSpinBox);
//! [2]

//! [3]
    penStyleComboBox = new QComboBox;
    penStyleComboBox->addItem(tr("Solid"), Qt::SolidLine);
    penStyleComboBox->addItem(tr("Dash"), Qt::DashLine);
    penStyleComboBox->addItem(tr("Dot"), Qt::DotLine);
    penStyleComboBox->addItem(tr("Dash Dot"), Qt::DashDotLine);
    penStyleComboBox->addItem(tr("Dash Dot Dot"), Qt::DashDotDotLine);
    penStyleComboBox->addItem(tr("None"), Qt::NoPen);

    penStyleLabel = new QLabel(tr("&Pen Style:"));
    penStyleLabel->setBuddy(penStyleComboBox);

    penCapComboBox = new QComboBox;
    penCapComboBox->addItem(tr("Flat"), Qt::FlatCap);
    penCapComboBox->addItem(tr("Square"), Qt::SquareCap);
    penCapComboBox->addItem(tr("Round"), Qt::RoundCap);

    penCapLabel = new QLabel(tr("Pen &Cap:"));
    penCapLabel->setBuddy(penCapComboBox);

    penJoinComboBox = new QComboBox;
    penJoinComboBox->addItem(tr("Miter"), Qt::MiterJoin);
    penJoinComboBox->addItem(tr("Bevel"), Qt::BevelJoin);
    penJoinComboBox->addItem(tr("Round"), Qt::RoundJoin);

    penJoinLabel = new QLabel(tr("Pen &Join:"));
    penJoinLabel->setBuddy(penJoinComboBox);
//! [3]

//! [4]
    brushStyleComboBox = new QComboBox;
    brushStyleComboBox->addItem(tr("Linear Gradient"),
            Qt::LinearGradientPattern);
    brushStyleComboBox->addItem(tr("Radial Gradient"),
            Qt::RadialGradientPattern);
    brushStyleComboBox->addItem(tr("Conical Gradient"),
            Qt::ConicalGradientPattern);
    brushStyleComboBox->addItem(tr("Texture"), Qt::TexturePattern);
    brushStyleComboBox->addItem(tr("Solid"), Qt::SolidPattern);
    brushStyleComboBox->addItem(tr("Horizontal"), Qt::HorPattern);
    brushStyleComboBox->addItem(tr("Vertical"), Qt::VerPattern);
    brushStyleComboBox->addItem(tr("Cross"), Qt::CrossPattern);
    brushStyleComboBox->addItem(tr("Backward Diagonal"), Qt::BDiagPattern);
    brushStyleComboBox->addItem(tr("Forward Diagonal"), Qt::FDiagPattern);
    brushStyleComboBox->addItem(tr("Diagonal Cross"), Qt::DiagCrossPattern);
    brushStyleComboBox->addItem(tr("Dense 1"), Qt::Dense1Pattern);
    brushStyleComboBox->addItem(tr("Dense 2"), Qt::Dense2Pattern);
    brushStyleComboBox->addItem(tr("Dense 3"), Qt::Dense3Pattern);
    brushStyleComboBox->addItem(tr("Dense 4"), Qt::Dense4Pattern);
    brushStyleComboBox->addItem(tr("Dense 5"), Qt::Dense5Pattern);
    brushStyleComboBox->addItem(tr("Dense 6"), Qt::Dense6Pattern);
    brushStyleComboBox->addItem(tr("Dense 7"), Qt::Dense7Pattern);
    brushStyleComboBox->addItem(tr("None"), Qt::NoBrush);

    brushStyleLabel = new QLabel(tr("&Brush:"));
    brushStyleLabel->setBuddy(brushStyleComboBox);
//! [4]

//! [5]
    otherOptionsLabel = new QLabel(tr("Options:"));
//! [5] //! [6]
    antialiasingCheckBox = new QCheckBox(tr("&Antialiasing"));
//! [6] //! [7]
    transformationsCheckBox = new QCheckBox(tr("&Transformations"));
//! [7]

//! [8]
    connect(shapeComboBox, SIGNAL(activated(int)),
            this, SLOT(shapeChanged()));
    connect(penWidthSpinBox, SIGNAL(valueChanged(int)),
            this, SLOT(penChanged()));
    connect(penStyleComboBox, SIGNAL(activated(int)),
            this, SLOT(penChanged()));
    connect(penCapComboBox, SIGNAL(activated(int)),
            this, SLOT(penChanged()));
    connect(penJoinComboBox, SIGNAL(activated(int)),
            this, SLOT(penChanged()));
    connect(brushStyleComboBox, SIGNAL(activated(int)),
            this, SLOT(brushChanged()));
    connect(antialiasingCheckBox, SIGNAL(toggled(bool)),
            renderArea, SLOT(setAntialiased(bool)));
    connect(transformationsCheckBox, SIGNAL(toggled(bool)),
            renderArea, SLOT(setTransformed(bool)));
//! [8]

//! [9]
    QGridLayout *mainLayout = new QGridLayout;
//! [9] //! [10]
#if defined(Q_OS_SYMBIAN) || defined(Q_WS_MAEMO_5) || defined(Q_WS_SIMULATOR)
    mainLayout->setSizeConstraint(QLayout::SetNoConstraint);
#endif
    mainLayout->setColumnStretch(0, 1);
    mainLayout->setColumnStretch(3, 1);
    mainLayout->addWidget(renderArea, 0, 0, 1, 4);
    mainLayout->addWidget(shapeLabel, 2, 0, Qt::AlignRight);
    mainLayout->addWidget(shapeComboBox, 2, 1);
    mainLayout->addWidget(penWidthLabel, 3, 0, Qt::AlignRight);
    mainLayout->addWidget(penWidthSpinBox, 3, 1);
    mainLayout->addWidget(penStyleLabel, 4, 0, Qt::AlignRight);
    mainLayout->addWidget(penStyleComboBox, 4, 1);
    mainLayout->addWidget(penCapLabel, 3, 2, Qt::AlignRight);
    mainLayout->addWidget(penCapComboBox, 3, 3);
    mainLayout->addWidget(penJoinLabel, 2, 2, Qt::AlignRight);
    mainLayout->addWidget(penJoinComboBox, 2, 3);
    mainLayout->addWidget(brushStyleLabel, 4, 2, Qt::AlignRight);
    mainLayout->addWidget(brushStyleComboBox, 4, 3);
    mainLayout->addWidget(otherOptionsLabel, 5, 0, Qt::AlignRight);
    mainLayout->addWidget(antialiasingCheckBox, 5, 1, 1, 1, Qt::AlignRight);
    mainLayout->addWidget(transformationsCheckBox, 5, 2, 1, 2, Qt::AlignRight);
    setLayout(mainLayout);

    shapeChanged();
    penChanged();
    brushChanged();
    antialiasingCheckBox->setChecked(true);

    setWindowTitle(tr("Basic Drawing"));
}
Ejemplo n.º 26
0
void QQuickPen::setColor(const QColor &c)
{
    m_color = c;
    m_valid = m_color.alpha() && (qRound(m_width) >= 1 || (!m_aligned && m_width > 0));
    emit penChanged();
}
Ejemplo n.º 27
0
void TupBrushManager::setPen(const QPen &pen)
{
    k->pen = pen;
    emit penChanged(k->pen);
}
Ejemplo n.º 28
0
/**
 * Called when the width was changed by the user.
 */
void QG_PenToolBar::slotWidthChanged(RS2::LineWidth w) {
    currentPen.setWidth(w);
    //printf("  width changed\n");

    emit penChanged(currentPen);
}
Ejemplo n.º 29
0
/**
 * Called when the linetype was changed by the user.
 */
void QG_PenToolBar::slotLineTypeChanged(RS2::LineType w) {
    currentPen.setLineType(w);
    //printf("  line type changed\n");

    emit penChanged(currentPen);
}