Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
src_gui_painting_qcolor.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
5
namespace
src_gui_painting_qcolor
{
6
int
width
() {
return
1; };
7
int
height
() {
return
1; };
8
QPainter
painter
;
9
void
wrapper
() {
10
11
12
//! [0]
13
// Specify semi-transparent red
14
painter
.setBrush(QColor(255, 0, 0, 127));
15
painter
.drawRect(0, 0,
width
(
)
/ 2,
height
(
)
);
16
17
// Specify semi-transparent blue
18
painter
.setBrush(QColor(0, 0, 255, 127));
19
painter
.drawRect(0, 0,
width
(
)
,
height
(
)
/ 2);
20
//! [0]
21
22
//! [QRgb]
23
const
QRgb rgb1 = 0x88112233;
24
const
QRgb rgb2 = QColor(
"red"
).rgb();
25
const
QRgb rgb3 = qRgb(qRed(rgb1), qGreen(rgb2), qBlue(rgb2));
26
const
QRgb rgb4 = qRgba(qRed(rgb1), qGreen(rgb2), qBlue(rgb2), qAlpha(rgb1));
27
//! [QRgb]
28
Q_UNUSED(rgb3);
29
Q_UNUSED(rgb4);
30
31
}
// wrapper
32
}
// src_gui_painting_qcolor
src_gui_painting_qcolor
Definition
src_gui_painting_qcolor.cpp:5
src_gui_painting_qcolor::wrapper
void wrapper()
Definition
src_gui_painting_qcolor.cpp:9
src_gui_painting_qcolor::painter
QPainter painter
Definition
src_gui_painting_qcolor.cpp:8
src_gui_painting_qcolor::width
int width()
Definition
src_gui_painting_qcolor.cpp:6
src_gui_painting_qcolor::height
int height()
Definition
src_gui_painting_qcolor.cpp:7
qtbase
src
gui
doc
snippets
code
src_gui_painting_qcolor.cpp
Generated on
for Qt by
1.18.0