diff options
-rw-r--r-- | src/gui/doc/snippets/code/src_gui_painting_qcolor.cpp | 8 | ||||
-rw-r--r-- | src/gui/painting/qcolor.cpp | 6 |
2 files changed, 13 insertions, 1 deletions
diff --git a/src/gui/doc/snippets/code/src_gui_painting_qcolor.cpp b/src/gui/doc/snippets/code/src_gui_painting_qcolor.cpp index fa3d7c9733..ecb52d0756 100644 --- a/src/gui/doc/snippets/code/src_gui_painting_qcolor.cpp +++ b/src/gui/doc/snippets/code/src_gui_painting_qcolor.cpp @@ -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 diff --git a/src/gui/painting/qcolor.cpp b/src/gui/painting/qcolor.cpp index 46f212fa7a..f6f77518b5 100644 --- a/src/gui/painting/qcolor.cpp +++ b/src/gui/painting/qcolor.cpp @@ -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() */ /*! |