Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qquickcolorimage.cpp
Go to the documentation of this file.
1// Copyright (C) 2017 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
5
6#include <QtQuick/private/qquickimagebase_p_p.h>
7
9
14
16{
17 return m_color;
18}
19
21{
22 if (m_color == color)
23 return;
24
25 m_color = color;
27 load();
29}
30
35
37{
38 return m_defaultColor;
39}
40
42{
43 if (m_defaultColor == color)
44 return;
45
46 m_defaultColor = color;
48}
49
54
56{
58 if (m_color.alpha() > 0 && m_color != m_defaultColor) {
60 QImage image = d->currentPix->image();
61 if (!image.isNull()) {
64 painter.fillRect(image.rect(), m_color);
65 d->currentPix->setImage(image);
66 }
67 }
68}
69
71
72#include "moc_qquickcolorimage_p.cpp"
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition qcolor.h:31
int alpha() const noexcept
Returns the alpha color component of this color.
Definition qcolor.cpp:1466
\inmodule QtGui
Definition qimage.h:37
The QPainter class performs low-level painting on widgets and other paint devices.
Definition qpainter.h:46
void setCompositionMode(CompositionMode mode)
Sets the composition mode to the given mode.
@ CompositionMode_SourceIn
Definition qpainter.h:103
void fillRect(const QRectF &, const QBrush &)
Fills the given rectangle with the brush specified.
QQuickColorImage(QQuickItem *parent=nullptr)
void setColor(const QColor &color)
void setDefaultColor(const QColor &color)
void pixmapChange() override
void defaultColorChanged()
virtual void load()
void pixmapChange() override
static QQuickItemPrivate * get(QQuickItem *item)
The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
Definition qquickitem.h:63
bool isComponentComplete() const
Returns true if construction of the QML component is complete; otherwise returns false.
Combined button and popup list for selecting options.
@ transparent
Definition qnamespace.h:47
Definition image.cpp:4
GLuint color
[2]
#define emit
QPainter painter(this)
[7]