Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
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
17//! [0]
18QPainter painter(this);
19QPen pen(Qt::green, 3, Qt::DashDotLine, Qt::RoundCap, Qt::RoundJoin);
20painter.setPen(pen);
21//! [0]
22
23} // Wrapper::wrapper0
24
25
27
28//! [1]
29QPainter painter(this);
30QPen pen; // creates a default pen
31
32pen.setStyle(Qt::DashDotLine);
33pen.setWidth(3);
34pen.setBrush(Qt::green);
35pen.setCapStyle(Qt::RoundCap);
36pen.setJoinStyle(Qt::RoundJoin);
37
38painter.setPen(pen);
39//! [1]
40
41} // Wrapper::wrapper1
42
43
45
46//! [2]
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);
55//! [2]
56
57} // Wrapper::wrapper2
58
59
61//! [3]
62QPen pen;
63QList<qreal> dashes;
64qreal space = 4;
65dashes << 1 << space << 3 << space << 9 << space
66 << 27 << space << 9 << space;
67pen.setDashPattern(dashes);
68//! [3]
69
70} // Wrapper::wrapper3
71} // src_gui_painting_qpen