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_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
6int width() { return 1; };
7int height() { return 1; };
9void wrapper() {
10
11
12//! [0]
13// Specify semi-transparent red
14painter.setBrush(QColor(255, 0, 0, 127));
15painter.drawRect(0, 0, width() / 2, height());
16
17// Specify semi-transparent blue
18painter.setBrush(QColor(0, 0, 255, 127));
19painter.drawRect(0, 0, width(), height() / 2);
20//! [0]
21
22//! [QRgb]
23const QRgb rgb1 = 0x88112233;
24const QRgb rgb2 = QColor("red").rgb();
25const QRgb rgb3 = qRgb(qRed(rgb1), qGreen(rgb2), qBlue(rgb2));
26const QRgb rgb4 = qRgba(qRed(rgb1), qGreen(rgb2), qBlue(rgb2), qAlpha(rgb1));
27//! [QRgb]
28Q_UNUSED(rgb3);
29Q_UNUSED(rgb4);
30
31} // wrapper
32} // src_gui_painting_qcolor