summaryrefslogtreecommitdiffstats
path: root/examples/charts/gallery/pccpentool.h
blob: 14a48c8987996b0d5c1bd0bbfc73c3e3b9fea105 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only

#ifndef PCCPENTOOL_H
#define PCCPENTOOL_H

#include <QPen>
#include <QWidget>

QT_FORWARD_DECLARE_CLASS(QComboBox);
QT_FORWARD_DECLARE_CLASS(QDoubleSpinBox);
QT_FORWARD_DECLARE_CLASS(QPushButton);

class PccPenTool : public QWidget
{
    Q_OBJECT
public:
    explicit PccPenTool(const QString &title, QWidget *parent = nullptr);
    void setPen(const QPen &pen);
    QPen pen() const;
    QString name() const;
    static QString name(const QPen &pen);

signals:
    void changed();

public slots:
    void showColorDialog();
    void updateWidth(double width);
    void updateStyle(int style);
    void updateCapStyle(int index);
    void updateJoinStyle(int index);

private:
    QPen m_pen;
    QPushButton *m_colorButton;
    QDoubleSpinBox *m_widthSpinBox;
    QComboBox *m_styleCombo;
    QComboBox *m_capStyleCombo;
    QComboBox *m_joinStyleCombo;
};

#endif