Improve QRgb documentation

- Add examples of how to create QRgb values
- Link to qRgba()

Pick-to: 5.15 5.12
Change-Id: I2a86b1c8e00137ba868426b8157a3aa0d924d7a6
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
bb10
Mitch Curtis 2020-09-28 12:58:31 +02:00
parent 0aa8925f1a
commit 8095829758
2 changed files with 13 additions and 1 deletions

View File

@ -66,6 +66,14 @@ painter.setBrush(QColor(0, 0, 255, 127));
painter.drawRect(0, 0, width(), height() / 2);
//! [0]
//! [QRgb]
const QRgb rgb1 = 0x88112233;
const QRgb rgb2 = QColor("red").rgb();
const QRgb rgb3 = qRgb(qRed(rgb1), qGreen(rgb2), qBlue(rgb2));
const QRgb rgb4 = qRgba(qRed(rgb1), qGreen(rgb2), qBlue(rgb2), qAlpha(rgb1));
//! [QRgb]
Q_UNUSED(rgb3);
Q_UNUSED(rgb4);
} // wrapper
} // src_gui_painting_qcolor

View File

@ -3203,7 +3203,11 @@ const uint qt_inv_premul_factor[256] = {
channel is \c ff, i.e opaque. For more information, see the
\l{QColor#Alpha-Blended Drawing}{Alpha-Blended Drawing} section.
\sa QColor::rgb(), QColor::rgba()
Here are some exammples of how QRgb values can be created:
\snippet code/src_gui_painting_qcolor.cpp QRgb
\sa qRgb(), qRgba(), QColor::rgb(), QColor::rgba()
*/
/*!