File indexing completed on 2024-05-12 04:35:10
0001 /**************************************************************************** 0002 ** 0003 ** Copyright (C) 2016 The Qt Company Ltd. 0004 ** Contact: https://www.qt.io/licensing/ 0005 ** 0006 ** This file is part of the tools applications of the Qt Toolkit. 0007 ** 0008 ** $QT_BEGIN_LICENSE:LGPL$ 0009 ** Commercial License Usage 0010 ** Licensees holding valid commercial Qt licenses may use this file in 0011 ** accordance with the commercial license agreement provided with the 0012 ** Software or, alternatively, in accordance with the terms contained in 0013 ** a written agreement between you and The Qt Company. For licensing terms 0014 ** and conditions see https://www.qt.io/terms-conditions. For further 0015 ** information use the contact form at https://www.qt.io/contact-us. 0016 ** 0017 ** GNU Lesser General Public License Usage 0018 ** Alternatively, this file may be used under the terms of the GNU Lesser 0019 ** General Public License version 3 as published by the Free Software 0020 ** Foundation and appearing in the file LICENSE.LGPL3 included in the 0021 ** packaging of this file. Please review the following information to 0022 ** ensure the GNU Lesser General Public License version 3 requirements 0023 ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. 0024 ** 0025 ** GNU General Public License Usage 0026 ** Alternatively, this file may be used under the terms of the GNU 0027 ** General Public License version 2.0 or (at your option) the GNU General 0028 ** Public license version 3 or any later version approved by the KDE Free 0029 ** Qt Foundation. The licenses are as published by the Free Software 0030 ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 0031 ** included in the packaging of this file. Please review the following 0032 ** information to ensure the GNU General Public License requirements will 0033 ** be met: https://www.gnu.org/licenses/gpl-2.0.html and 0034 ** https://www.gnu.org/licenses/gpl-3.0.html. 0035 ** 0036 ** $QT_END_LICENSE$ 0037 ** 0038 ****************************************************************************/ 0039 0040 // 0041 // W A R N I N G 0042 // ------------- 0043 // 0044 // This file is not part of the Qt API. It exists for the convenience 0045 // of Qt Designer. This header 0046 // file may change from version to version without notice, or even be removed. 0047 // 0048 // We mean it. 0049 // 0050 0051 #ifndef QTPROPERTYBROWSERUTILS_H 0052 #define QTPROPERTYBROWSERUTILS_H 0053 0054 #include <QtCore/QMap> 0055 #include <QtGui/QIcon> 0056 #include <QtWidgets/QWidget> 0057 #include <QtCore/QStringList> 0058 0059 QT_BEGIN_NAMESPACE 0060 0061 class QMouseEvent; 0062 class QCheckBox; 0063 class QLineEdit; 0064 0065 class QtCursorDatabase 0066 { 0067 public: 0068 QtCursorDatabase(); 0069 void clear(); 0070 0071 QStringList cursorShapeNames() const; 0072 QMap<int, QIcon> cursorShapeIcons() const; 0073 QString cursorToShapeName(const QCursor &cursor) const; 0074 QIcon cursorToShapeIcon(const QCursor &cursor) const; 0075 int cursorToValue(const QCursor &cursor) const; 0076 #ifndef QT_NO_CURSOR 0077 QCursor valueToCursor(int value) const; 0078 #endif 0079 private: 0080 void appendCursor(Qt::CursorShape shape, const QString &name, const QIcon &icon); 0081 QStringList m_cursorNames; 0082 QMap<int, QIcon> m_cursorIcons; 0083 QMap<int, Qt::CursorShape> m_valueToCursorShape; 0084 QMap<Qt::CursorShape, int> m_cursorShapeToValue; 0085 }; 0086 0087 class QtPropertyBrowserUtils 0088 { 0089 public: 0090 static QPixmap brushValuePixmap(const QBrush &b); 0091 static QIcon brushValueIcon(const QBrush &b); 0092 static QString colorValueText(const QColor &c); 0093 static QPixmap fontValuePixmap(const QFont &f); 0094 static QIcon fontValueIcon(const QFont &f); 0095 static QString fontValueText(const QFont &f); 0096 static QString dateFormat(); 0097 static QString timeFormat(); 0098 static QString dateTimeFormat(); 0099 }; 0100 0101 class QtBoolEdit : public QWidget { 0102 Q_OBJECT 0103 public: 0104 QtBoolEdit(QWidget *parent = 0); 0105 0106 bool textVisible() const { return m_textVisible; } 0107 void setTextVisible(bool textVisible); 0108 0109 Qt::CheckState checkState() const; 0110 void setCheckState(Qt::CheckState state); 0111 0112 bool isChecked() const; 0113 void setChecked(bool c); 0114 0115 bool blockCheckBoxSignals(bool block); 0116 0117 Q_SIGNALS: 0118 void toggled(bool); 0119 0120 protected: 0121 void mousePressEvent(QMouseEvent * event); 0122 0123 private: 0124 QCheckBox *m_checkBox; 0125 bool m_textVisible; 0126 }; 0127 0128 QT_END_NAMESPACE 0129 0130 #endif