| 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 | |
| 4 | // |
| 5 | // W A R N I N G |
| 6 | // ------------- |
| 7 | // |
| 8 | // This file is not part of the Qt API. It exists for the convenience |
| 9 | // of Qt Designer. This header |
| 10 | // file may change from version to version without notice, or even be removed. |
| 11 | // |
| 12 | // We mean it. |
| 13 | // |
| 14 | |
| 15 | #ifndef QTPROPERTYBROWSERUTILS_H |
| 16 | #define QTPROPERTYBROWSERUTILS_H |
| 17 | |
| 18 | #include <QtCore/QMap> |
| 19 | #include <QtGui/QIcon> |
| 20 | #include <QtWidgets/QWidget> |
| 21 | #include <QtCore/QStringList> |
| 22 | |
| 23 | QT_BEGIN_NAMESPACE |
| 24 | |
| 25 | class QMouseEvent; |
| 26 | class QCheckBox; |
| 27 | class QLineEdit; |
| 28 | |
| 29 | class QtCursorDatabase |
| 30 | { |
| 31 | public: |
| 32 | QtCursorDatabase(); |
| 33 | void clear(); |
| 34 | |
| 35 | QStringList cursorShapeNames() const; |
| 36 | QMap<int, QIcon> cursorShapeIcons() const; |
| 37 | QString cursorToShapeName(const QCursor &cursor) const; |
| 38 | QIcon cursorToShapeIcon(const QCursor &cursor) const; |
| 39 | int cursorToValue(const QCursor &cursor) const; |
| 40 | #ifndef QT_NO_CURSOR |
| 41 | QCursor valueToCursor(int value) const; |
| 42 | #endif |
| 43 | |
| 44 | static QtCursorDatabase *instance(); |
| 45 | |
| 46 | private: |
| 47 | void appendCursor(Qt::CursorShape shape, const QString &name, const QIcon &icon); |
| 48 | QStringList m_cursorNames; |
| 49 | QMap<int, QIcon> m_cursorIcons; |
| 50 | QMap<int, Qt::CursorShape> m_valueToCursorShape; |
| 51 | QMap<Qt::CursorShape, int> m_cursorShapeToValue; |
| 52 | }; |
| 53 | |
| 54 | class QtPropertyBrowserUtils |
| 55 | { |
| 56 | public: |
| 57 | static QPixmap brushValuePixmap(const QBrush &b); |
| 58 | static QIcon brushValueIcon(const QBrush &b); |
| 59 | static QString colorValueText(QColor c); |
| 60 | static QPixmap fontValuePixmap(const QFont &f); |
| 61 | static QIcon fontValueIcon(const QFont &f); |
| 62 | static QString fontValueText(const QFont &f); |
| 63 | static QString dateFormat(); |
| 64 | static QString timeFormat(); |
| 65 | static QString dateTimeFormat(); |
| 66 | }; |
| 67 | |
| 68 | class QtBoolEdit : public QWidget { |
| 69 | Q_OBJECT |
| 70 | public: |
| 71 | QtBoolEdit(QWidget *parent = 0); |
| 72 | |
| 73 | bool textVisible() const { return m_textVisible; } |
| 74 | void setTextVisible(bool textVisible); |
| 75 | |
| 76 | Qt::CheckState checkState() const; |
| 77 | void setCheckState(Qt::CheckState state); |
| 78 | |
| 79 | bool isChecked() const; |
| 80 | void setChecked(bool c); |
| 81 | |
| 82 | bool blockCheckBoxSignals(bool block); |
| 83 | |
| 84 | Q_SIGNALS: |
| 85 | void toggled(bool); |
| 86 | |
| 87 | protected: |
| 88 | void mousePressEvent(QMouseEvent * event) override; |
| 89 | |
| 90 | private: |
| 91 | QCheckBox *m_checkBox; |
| 92 | bool m_textVisible; |
| 93 | }; |
| 94 | |
| 95 | QT_END_NAMESPACE |
| 96 | |
| 97 | #endif |
| 98 |
