source: trunk/tools/shared/qtpropertybrowser/qtpropertybrowserutils_p.h@ 1168

Last change on this file since 1168 was 846, checked in by Dmitry A. Kuminov, 14 years ago

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

File size: 4.8 KB
Line 
1/****************************************************************************
2**
3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
4** All rights reserved.
5** Contact: Nokia Corporation ([email protected])
6**
7** This file is part of the tools applications of the Qt Toolkit.
8**
9** $QT_BEGIN_LICENSE:LGPL$
10** Commercial Usage
11** Licensees holding valid Qt Commercial licenses may use this file in
12** accordance with the Qt Commercial License Agreement provided with the
13** Software or, alternatively, in accordance with the terms contained in
14** a written agreement between you and Nokia.
15**
16** GNU Lesser General Public License Usage
17** Alternatively, this file may be used under the terms of the GNU Lesser
18** General Public License version 2.1 as published by the Free Software
19** Foundation and appearing in the file LICENSE.LGPL included in the
20** packaging of this file. Please review the following information to
21** ensure the GNU Lesser General Public License version 2.1 requirements
22** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
23**
24** In addition, as a special exception, Nokia gives you certain additional
25** rights. These rights are described in the Nokia Qt LGPL Exception
26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
27**
28** GNU General Public License Usage
29** Alternatively, this file may be used under the terms of the GNU
30** General Public License version 3.0 as published by the Free Software
31** Foundation and appearing in the file LICENSE.GPL included in the
32** packaging of this file. Please review the following information to
33** ensure the GNU General Public License version 3.0 requirements will be
34** met: http://www.gnu.org/copyleft/gpl.html.
35**
36** If you have questions regarding the use of this file, please contact
37** Nokia at [email protected].
38** $QT_END_LICENSE$
39**
40****************************************************************************/
41
42//
43// W A R N I N G
44// -------------
45//
46// This file is not part of the Qt API. It exists for the convenience
47// of Qt Designer. This header
48// file may change from version to version without notice, or even be removed.
49//
50// We mean it.
51//
52
53#ifndef QTPROPERTYBROWSERUTILS_H
54#define QTPROPERTYBROWSERUTILS_H
55
56#include <QtCore/QMap>
57#include <QtGui/QIcon>
58#include <QtGui/QWidget>
59#include <QtCore/QStringList>
60
61QT_BEGIN_NAMESPACE
62
63class QMouseEvent;
64class QCheckBox;
65class QLineEdit;
66
67class QtCursorDatabase
68{
69public:
70 QtCursorDatabase();
71 void clear();
72
73 QStringList cursorShapeNames() const;
74 QMap<int, QIcon> cursorShapeIcons() const;
75 QString cursorToShapeName(const QCursor &cursor) const;
76 QIcon cursorToShapeIcon(const QCursor &cursor) const;
77 int cursorToValue(const QCursor &cursor) const;
78#ifndef QT_NO_CURSOR
79 QCursor valueToCursor(int value) const;
80#endif
81private:
82 void appendCursor(Qt::CursorShape shape, const QString &name, const QIcon &icon);
83 QStringList m_cursorNames;
84 QMap<int, QIcon> m_cursorIcons;
85 QMap<int, Qt::CursorShape> m_valueToCursorShape;
86 QMap<Qt::CursorShape, int> m_cursorShapeToValue;
87};
88
89class QtPropertyBrowserUtils
90{
91public:
92 static QPixmap brushValuePixmap(const QBrush &b);
93 static QIcon brushValueIcon(const QBrush &b);
94 static QString colorValueText(const QColor &c);
95 static QPixmap fontValuePixmap(const QFont &f);
96 static QIcon fontValueIcon(const QFont &f);
97 static QString fontValueText(const QFont &f);
98 static QString dateFormat();
99 static QString timeFormat();
100 static QString dateTimeFormat();
101};
102
103class QtBoolEdit : public QWidget {
104 Q_OBJECT
105public:
106 QtBoolEdit(QWidget *parent = 0);
107
108 bool textVisible() const { return m_textVisible; }
109 void setTextVisible(bool textVisible);
110
111 Qt::CheckState checkState() const;
112 void setCheckState(Qt::CheckState state);
113
114 bool isChecked() const;
115 void setChecked(bool c);
116
117 bool blockCheckBoxSignals(bool block);
118
119Q_SIGNALS:
120 void toggled(bool);
121
122protected:
123 void mousePressEvent(QMouseEvent * event);
124
125private:
126 QCheckBox *m_checkBox;
127 bool m_textVisible;
128};
129
130class QtKeySequenceEdit : public QWidget
131{
132 Q_OBJECT
133public:
134 QtKeySequenceEdit(QWidget *parent = 0);
135
136 QKeySequence keySequence() const;
137 bool eventFilter(QObject *o, QEvent *e);
138public Q_SLOTS:
139 void setKeySequence(const QKeySequence &sequence);
140Q_SIGNALS:
141 void keySequenceChanged(const QKeySequence &sequence);
142protected:
143 void focusInEvent(QFocusEvent *e);
144 void focusOutEvent(QFocusEvent *e);
145 void keyPressEvent(QKeyEvent *e);
146 void keyReleaseEvent(QKeyEvent *e);
147 bool event(QEvent *e);
148private slots:
149 void slotClearShortcut();
150private:
151 void handleKeyEvent(QKeyEvent *e);
152 int translateModifiers(Qt::KeyboardModifiers state, const QString &text) const;
153
154 int m_num;
155 QKeySequence m_keySequence;
156 QLineEdit *m_lineEdit;
157};
158
159QT_END_NAMESPACE
160
161#endif
Note: See TracBrowser for help on using the repository browser.