OGS
ColorPickerPushButton.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) OpenGeoSys Community (opengeosys.org)
2// SPDX-License-Identifier: BSD-3-Clause
3
4#pragma once
5
6// ** INCLUDES **
7#include <QPushButton>
8
9class QColor;
10class QMouseEvent;
11
17class ColorPickerPushButton : public QPushButton
18{
19 Q_OBJECT
20
21public:
22 explicit ColorPickerPushButton(QWidget* parent = nullptr);
23
24public slots:
26 void mouseReleaseEvent(QMouseEvent* e) override;
27
29 void setColor(QColor color);
30 void setColor(double* color);
31
32private:
33 QString colorToCss(QColor color);
34 QString colorToString(QColor color);
35
36 QColor _color;
37
38signals:
40 void colorPicked(QColor);
41};
void mouseReleaseEvent(QMouseEvent *e) override
Calls the QColorDialog.
void colorPicked(QColor)
Is emitted when a color was picked from the dialog.
ColorPickerPushButton(QWidget *parent=nullptr)
void setColor(QColor color)
Sets the color.
QString colorToString(QColor color)
QString colorToCss(QColor color)