Computer Assisted Medical Intervention Tool Kit  version 5.2
 
Loading...
Searching...
No Matches
qtpropertybrowserutils_p.h
Go to the documentation of this file.
1/****************************************************************************
2**
3** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
4** All rights reserved.
5**
6** Contact: Nokia Corporation (qt-info@nokia.com)
7**
8** This file is part of a Qt Solutions component.
9**
10** You may use this file under the terms of the BSD license as follows:
11**
12** "Redistribution and use in source and binary forms, with or without
13** modification, are permitted provided that the following conditions are
14** met:
15** * Redistributions of source code must retain the above copyright
16** notice, this list of conditions and the following disclaimer.
17** * Redistributions in binary form must reproduce the above copyright
18** notice, this list of conditions and the following disclaimer in
19** the documentation and/or other materials provided with the
20** distribution.
21** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
22** the names of its contributors may be used to endorse or promote
23** products derived from this software without specific prior written
24** permission.
25**
26** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
27** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
28** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
29** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
30** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
31** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
32** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
33** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
34** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
35** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
36** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
37**
38****************************************************************************/
39
40
41//
42// W A R N I N G
43// -------------
44//
45// This file is not part of the Qt API. It exists for the convenience
46// of Qt Designer. This header
47// file may change from version to version without notice, or even be removed.
48//
49// We mean it.
50//
51
52#ifndef QTPROPERTYBROWSERUTILS_H
53#define QTPROPERTYBROWSERUTILS_H
54
55#include <QMap>
56#include <QIcon>
57#include <QWidget>
58#include <QStringList>
59
60#if QT_VERSION >= 0x040400
61QT_BEGIN_NAMESPACE
62#endif
63
64class QMouseEvent;
65class QCheckBox;
66class QLineEdit;
67
76public:
78
79 QStringList cursorShapeNames() const;
80 QMap<int, QIcon> cursorShapeIcons() const;
81 QString cursorToShapeName(const QCursor& cursor) const;
82 QIcon cursorToShapeIcon(const QCursor& cursor) const;
83 int cursorToValue(const QCursor& cursor) const;
84#ifndef QT_NO_CURSOR
85 QCursor valueToCursor(int value) const;
86#endif
87private:
88 void appendCursor(Qt::CursorShape shape, const QString& name, const QIcon& icon);
89 QStringList m_cursorNames;
90 QMap<int, QIcon> m_cursorIcons;
91 QMap<int, Qt::CursorShape> m_valueToCursorShape;
92 QMap<Qt::CursorShape, int> m_cursorShapeToValue;
93};
94
96public:
97 static QPixmap brushValuePixmap(const QBrush& b);
98 static QIcon brushValueIcon(const QBrush& b);
99 static QString colorValueText(const QColor& c);
100 static QPixmap fontValuePixmap(const QFont& f);
101 static QIcon fontValueIcon(const QFont& f);
102 static QString fontValueText(const QFont& f);
103};
104
105class QtBoolEdit : public QWidget {
106 Q_OBJECT
107public:
108 QtBoolEdit(QWidget* parent = nullptr);
109
110 bool textVisible() const {
111 return m_textVisible;
112 }
113 void setTextVisible(bool textVisible);
114
115 Qt::CheckState checkState() const;
116 void setCheckState(Qt::CheckState state);
117
118 bool isChecked() const;
119 void setChecked(bool c);
120
121 bool blockCheckBoxSignals(bool block);
122
123Q_SIGNALS:
124 void toggled(bool);
125
126protected:
127 void mousePressEvent(QMouseEvent* event) override;
128 void paintEvent(QPaintEvent*) override;
129
130private:
131 QCheckBox* m_checkBox;
132 bool m_textVisible{true};
133};
134
135class QtKeySequenceEdit : public QWidget {
136 Q_OBJECT
137public:
138 QtKeySequenceEdit(QWidget* parent = nullptr);
139
140 QKeySequence keySequence() const;
141 bool eventFilter(QObject* o, QEvent* e) override;
142public Q_SLOTS:
143 void setKeySequence(const QKeySequence& sequence);
144Q_SIGNALS:
145 void keySequenceChanged(const QKeySequence& sequence);
146protected:
147 void focusInEvent(QFocusEvent* e) override;
148 void focusOutEvent(QFocusEvent* e) override;
149 void keyPressEvent(QKeyEvent* e) override;
150 void keyReleaseEvent(QKeyEvent* e) override;
151 void paintEvent(QPaintEvent*) override;
152 bool event(QEvent* e) override;
153private slots:
154 void slotClearShortcut();
155private:
156 void handleKeyEvent(QKeyEvent* e);
157 int translateModifiers(Qt::KeyboardModifiers state, const QString& text) const;
158
159 int m_num{0};
160 QKeySequence m_keySequence;
161 QLineEdit* m_lineEdit;
162};
163
164#if QT_VERSION >= 0x040400
165QT_END_NAMESPACE
166#endif
167
168#endif
Definition qtpropertybrowserutils_p.h:105
void toggled(bool)
bool textVisible() const
Definition qtpropertybrowserutils_p.h:110
void mousePressEvent(QMouseEvent *event) override
Definition qtpropertybrowserutils.cpp:240
Qt::CheckState checkState() const
Definition qtpropertybrowserutils.cpp:216
void setTextVisible(bool textVisible)
Definition qtpropertybrowserutils.cpp:202
bool blockCheckBoxSignals(bool block)
Definition qtpropertybrowserutils.cpp:236
bool isChecked() const
Definition qtpropertybrowserutils.cpp:224
void setCheckState(Qt::CheckState state)
Definition qtpropertybrowserutils.cpp:220
void setChecked(bool c)
Definition qtpropertybrowserutils.cpp:228
void paintEvent(QPaintEvent *) override
Definition qtpropertybrowserutils.cpp:250
The description of this class will come soon !
Definition qtpropertybrowserutils_p.h:75
QCursor valueToCursor(int value) const
Definition qtpropertybrowserutils.cpp:120
QStringList cursorShapeNames() const
Definition qtpropertybrowserutils.cpp:88
int cursorToValue(const QCursor &cursor) const
Definition qtpropertybrowserutils.cpp:109
QString cursorToShapeName(const QCursor &cursor) const
Definition qtpropertybrowserutils.cpp:96
QtCursorDatabase()
Definition qtpropertybrowserutils.cpp:55
QIcon cursorToShapeIcon(const QCursor &cursor) const
Definition qtpropertybrowserutils.cpp:104
QMap< int, QIcon > cursorShapeIcons() const
Definition qtpropertybrowserutils.cpp:92
Definition qtpropertybrowserutils_p.h:135
void paintEvent(QPaintEvent *) override
Definition qtpropertybrowserutils.cpp:409
void keySequenceChanged(const QKeySequence &sequence)
void setKeySequence(const QKeySequence &sequence)
Definition qtpropertybrowserutils.cpp:358
bool event(QEvent *e) override
Definition qtpropertybrowserutils.cpp:416
void focusOutEvent(QFocusEvent *e) override
Definition qtpropertybrowserutils.cpp:394
void keyReleaseEvent(QKeyEvent *e) override
Definition qtpropertybrowserutils.cpp:405
void focusInEvent(QFocusEvent *e) override
Definition qtpropertybrowserutils.cpp:388
void keyPressEvent(QKeyEvent *e) override
Definition qtpropertybrowserutils.cpp:400
QKeySequence keySequence() const
Definition qtpropertybrowserutils.cpp:367
bool eventFilter(QObject *o, QEvent *e) override
Definition qtpropertybrowserutils.cpp:271
Definition qtpropertybrowserutils_p.h:95
static QPixmap brushValuePixmap(const QBrush &b)
Definition qtpropertybrowserutils.cpp:128
static QPixmap fontValuePixmap(const QFont &f)
Definition qtpropertybrowserutils.cpp:159
static QIcon brushValueIcon(const QBrush &b)
Definition qtpropertybrowserutils.cpp:147
static QString colorValueText(const QColor &c)
Definition qtpropertybrowserutils.cpp:151
static QIcon fontValueIcon(const QFont &f)
Definition qtpropertybrowserutils.cpp:174
static QString fontValueText(const QFont &f)
Definition qtpropertybrowserutils.cpp:178