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
qtcolorbutton_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 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// Qt-Security score:significant reason:default
4
5//
6// W A R N I N G
7// -------------
8//
9// This file is not part of the Qt API. It exists for the convenience
10// of Qt Designer. This header file may change from version to version
11// without notice, or even be removed.
12//
13// We mean it.
14//
15
16#ifndef QTCOLORBUTTON_H
17#define QTCOLORBUTTON_H
18
19#include <QtWidgets/qtoolbutton.h>
20
22
24{
25 Q_OBJECT
26 Q_PROPERTY(bool backgroundCheckered READ isBackgroundCheckered WRITE setBackgroundCheckered)
27public:
28 QtColorButton(QWidget *parent = nullptr);
30
31 bool isBackgroundCheckered() const;
32 void setBackgroundCheckered(bool checkered);
33
34 QColor color() const;
35
36public slots:
37 void setColor(QColor color);
38
41
42protected:
43 void paintEvent(QPaintEvent *event) override;
44 void mousePressEvent(QMouseEvent *event) override;
45 void mouseMoveEvent(QMouseEvent *event) override;
46#ifndef QT_NO_DRAGANDDROP
47 void dragEnterEvent(QDragEnterEvent *event) override;
48 void dragLeaveEvent(QDragLeaveEvent *event) override;
49 void dropEvent(QDropEvent *event) override;
50#endif
51
52private:
56};
57
58QT_END_NAMESPACE
59
60#endif
QColor color() const
void mouseMoveEvent(QMouseEvent *event) override
\reimp
void paintEvent(QPaintEvent *event) override
\reimp
void dragLeaveEvent(QDragLeaveEvent *event) override
void setBackgroundCheckered(bool checkered)
void dragEnterEvent(QDragEnterEvent *event) override
void dropEvent(QDropEvent *event) override
bool isBackgroundCheckered() const
void mousePressEvent(QMouseEvent *event) override
\reimp
~QtColorButton() override
void setBrush(const QBrush &brush)
QSize sizeHint(const QStyleOptionViewItem &opt, const QModelIndex &index) const override
This pure abstract function must be reimplemented if you want to provide custom rendering.
void paint(QPainter *painter, const QStyleOptionViewItem &opt, const QModelIndex &index) const override
This pure abstract function must be reimplemented if you want to provide custom rendering.
void setPalette(const QPalette &palette)
void setPalette(const QPalette &palette, const QPalette &parentPalette)
QBrush brushAt(const QModelIndex &index) const
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
Returns the data for the given role and section in the header with the specified orientation.
int columnCount(const QModelIndex &parent=QModelIndex()) const override
Returns the number of columns for the children of the given parent.
int rowCount(const QModelIndex &parent=QModelIndex()) const override
Returns the number of rows under the given parent.
QPalette::ColorRole colorRole() const
quint64 rowMask(const QModelIndex &index) const
QVariant data(const QModelIndex &index, int role) const override
Returns the data stored under the given role for the item referred to by the index.
bool setData(const QModelIndex &index, const QVariant &value, int role) override
Sets the role data for the item at index to value.
Qt::ItemFlags flags(const QModelIndex &index) const override
Returns the item flags for the given index.
void setPalette(const QPalette &palette, const QPalette &parentPalette)
void setLabel(const QString &label)
Combined button and popup list for selecting options.
Auxiliary methods to store/retrieve settings.
static QString paletteFilter()
static bool savePalette(const QString &fileName, const QPalette &pal, QString *errorMessage)
static QString msgCannotReadPalette(const QString &fileName, const QXmlStreamReader &reader)
static QString msgCannotReadPalette(const QString &fileName, const QXmlStreamReader &reader, const QString &why)
static bool loadPalette(const QString &fileName, QPalette *pal, QString *errorMessage)