Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
src_gui_painting_qpen.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3#include <QPainter>
4#include <QPen>
5
8{
9 void wrapper0();
10 void wrapper1();
11 void wrapper2();
12 void wrapper3();
13};
14
16
18QPainter painter(this);
20painter.setPen(pen);
22
23} // Wrapper::wrapper0
24
25
27
29QPainter painter(this);
30QPen pen; // creates a default pen
31
33pen.setWidth(3);
37
38painter.setPen(pen);
40
41} // Wrapper::wrapper1
42
43
45
47QPen pen;
48QList<qreal> dashes;
49qreal space = 4;
50
51dashes << 1 << space << 3 << space << 9 << space
52 << 27 << space << 9 << space;
53
54pen.setDashPattern(dashes);
56
57} // Wrapper::wrapper2
58
59
62QPen pen;
63QList<qreal> dashes;
64qreal space = 4;
65dashes << 1 << space << 3 << space << 9 << space
66 << 27 << space << 9 << space;
67pen.setDashPattern(dashes);
69
70} // Wrapper::wrapper3
71} // src_gui_painting_qpen
The QPainter class performs low-level painting on widgets and other paint devices.
Definition qpainter.h:46
void setPen(const QColor &color)
This is an overloaded member function, provided for convenience. It differs from the above function o...
\inmodule QtGui
Definition qpen.h:28
void setCapStyle(Qt::PenCapStyle pcs)
Sets the pen's cap style to the given style.
Definition qpen.cpp:650
void setStyle(Qt::PenStyle)
[0]
void setWidth(int width)
Sets the pen width to the given width in pixels with integer precision.
Definition qpen.cpp:592
void setBrush(const QBrush &brush)
Sets the brush used to fill strokes generated with this pen to the given brush.
Definition qpen.cpp:726
void setJoinStyle(Qt::PenJoinStyle pcs)
Sets the pen's join style to the given style.
Definition qpen.cpp:677
void setDashPattern(const QList< qreal > &pattern)
Sets the dash pattern for this pen to the given pattern.
Definition qpen.cpp:463
@ green
Definition qnamespace.h:36
@ DashDotLine
@ RoundJoin
@ RoundCap
double qreal
Definition qtypes.h:187
QPainter painter(this)
[7]