void Item::setPenBrush(const QString& penStyle, int width, const QString& penColor, const QString& brushStyle, const QString& brushColor) { setPenStyle(penStyle); setPenWidth(width); setPenColor(penColor); setBrushStyle(brushStyle); setBrushColor(brushColor); }
void DrawingPolyItem::setPen(const QPen& pen) { setPenColor(pen.brush().color()); setPenWidth(pen.widthF()); setPenStyle(pen.style()); setPenCapStyle(pen.capStyle()); setPenJoinStyle(pen.joinStyle()); }
void KstViewLine::setPenStyleWrap(int style) { switch (style) { case 1: setPenStyle(Qt::DashLine); break; case 2: setPenStyle(Qt::DotLine); break; case 3: setPenStyle(Qt::DashDotLine); break; case 4: setPenStyle(Qt::DashDotDotLine); break; case 0: default: setPenStyle(Qt::SolidLine); break; } }
void DrawingPolyItem::readXmlAttributes(QXmlStreamReader& xmlReader, const QList<DrawingItem*>& items) { QXmlStreamAttributes attributes = xmlReader.attributes(); DrawingItem::readXmlAttributes(xmlReader, items); if (attributes.hasAttribute("penColor")) setPenColor(Drawing::colorFromString(attributes.value("penColor").toString())); if (attributes.hasAttribute("penWidth")) setPenWidth(attributes.value("penWidth").toString().toDouble()); if (attributes.hasAttribute("penStyle")) setPenStyle((Qt::PenStyle)attributes.value("penStyle").toString().toUInt()); if (attributes.hasAttribute("penCapStyle")) setPenCapStyle((Qt::PenCapStyle)attributes.value("penCapStyle").toString().toUInt()); if (attributes.hasAttribute("penJoinStyle")) setPenJoinStyle((Qt::PenJoinStyle)attributes.value("penJoinStyle").toString().toUInt()); }
PaintLine::PaintLine(QMainWindow *parent) :PaintTool(parent), mode(Sing) { //Default Pen drawPen.setWidth(1); drawPen.setCapStyle(Qt::FlatCap); //Lay the config window config_window.resize(300, 220); config_window.setFixedSize(300, 220); config_window.setCaption("Line Dialog"); //Add linestyle PaintLinestyle *linestyle = new PaintLinestyle(&config_window, 180); //Add Capstyle PaintCapstyle *capstyle = new PaintCapstyle(&config_window, 120, Qt::Vertical); capstyle->move(180, 0); //Add Linemode PaintLinemode *linemode = new PaintLinemode(&config_window, 120); linemode->move(180, 100); //Add slider PaintSlider *slider = new PaintSlider(&config_window, config_window.width(), "Line Width"); slider->setMin(1); slider->setMax(40); slider->move(0, 185); //Connect Attributes QObject::connect(linestyle, SIGNAL(valueChanged(Qt::PenStyle)), this, SLOT(setPenStyle(Qt::PenStyle))); QObject::connect(capstyle, SIGNAL(valueChanged(Qt::PenCapStyle)), this, SLOT(setPenCap(Qt::PenCapStyle))); QObject::connect(linemode, SIGNAL(valueChanged(PaintLineMode)), this, SLOT(setLineMode(PaintLineMode))); QObject::connect(slider, SIGNAL(valueChanged(int)), this, SLOT(setLineWidth(int))); }