author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Fri, 19 Feb 2010 23:40:16 +0200 | |
branch | RCL_3 |
changeset 4 | 3b1da2848fc7 |
parent 0 | 1918ee327afb |
permissions | -rw-r--r-- |
0 | 1 |
/**************************************************************************** |
2 |
** |
|
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3 |
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
0 | 4 |
** All rights reserved. |
5 |
** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 |
** |
|
7 |
** This file is part of the QtGui module of the Qt Toolkit. |
|
8 |
** |
|
9 |
** $QT_BEGIN_LICENSE:LGPL$ |
|
10 |
** No Commercial Usage |
|
11 |
** This file contains pre-release code and may not be distributed. |
|
12 |
** You may use this file in accordance with the terms and conditions |
|
13 |
** contained in the Technology Preview License Agreement accompanying |
|
14 |
** this package. |
|
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 |
** If you have questions regarding the use of this file, please contact |
|
29 |
** Nokia at qt-info@nokia.com. |
|
30 |
** |
|
31 |
** |
|
32 |
** |
|
33 |
** |
|
34 |
** |
|
35 |
** |
|
36 |
** |
|
37 |
** |
|
38 |
** $QT_END_LICENSE$ |
|
39 |
** |
|
40 |
****************************************************************************/ |
|
41 |
||
42 |
#ifndef QINPUTDIALOG_H |
|
43 |
#define QINPUTDIALOG_H |
|
44 |
||
45 |
#include <QtGui/qdialog.h> |
|
46 |
#include <QtCore/qstring.h> |
|
47 |
#include <QtGui/qlineedit.h> |
|
48 |
||
49 |
QT_BEGIN_HEADER |
|
50 |
||
51 |
QT_BEGIN_NAMESPACE |
|
52 |
||
53 |
QT_MODULE(Gui) |
|
54 |
||
55 |
#ifndef QT_NO_INPUTDIALOG |
|
56 |
||
57 |
class QInputDialogPrivate; |
|
58 |
||
59 |
class Q_GUI_EXPORT QInputDialog : public QDialog |
|
60 |
{ |
|
61 |
Q_OBJECT |
|
62 |
Q_DECLARE_PRIVATE(QInputDialog) |
|
63 |
// Q_ENUMS(InputMode InputDialogOption) |
|
64 |
QDOC_PROPERTY(InputMode inputMode READ inputMode WRITE setInputMode) |
|
65 |
QDOC_PROPERTY(QString labelText READ labelText WRITE setLabelText) |
|
66 |
QDOC_PROPERTY(InputDialogOptions options READ options WRITE setOptions) |
|
67 |
QDOC_PROPERTY(QString textValue READ textValue WRITE setTextValue NOTIFY textValueChanged) |
|
68 |
QDOC_PROPERTY(int intValue READ intValue WRITE setIntValue NOTIFY intValueChanged) |
|
69 |
QDOC_PROPERTY(int doubleValue READ doubleValue WRITE setDoubleValue NOTIFY doubleValueChanged) |
|
70 |
QDOC_PROPERTY(QLineEdit::EchoMode textEchoMode READ textEchoMode WRITE setTextEchoMode) |
|
71 |
QDOC_PROPERTY(bool comboBoxEditable READ isComboBoxEditable WRITE setComboBoxEditable) |
|
72 |
QDOC_PROPERTY(QStringList comboBoxItems READ comboBoxItems WRITE setComboBoxItems) |
|
73 |
QDOC_PROPERTY(int intMinimum READ intMinimum WRITE setIntMinimum) |
|
74 |
QDOC_PROPERTY(int intMaximum READ intMaximum WRITE setIntMaximum) |
|
75 |
QDOC_PROPERTY(int intStep READ intStep WRITE setIntStep) |
|
76 |
QDOC_PROPERTY(double doubleMinimum READ doubleMinimum WRITE setDoubleMinimum) |
|
77 |
QDOC_PROPERTY(double doubleMaximum READ doubleMaximum WRITE setDoubleMaximum) |
|
78 |
QDOC_PROPERTY(int doubleDecimals READ doubleDecimals WRITE setDoubleDecimals) |
|
79 |
QDOC_PROPERTY(QString okButtonText READ okButtonText WRITE setOkButtonText) |
|
80 |
QDOC_PROPERTY(QString cancelButtonText READ cancelButtonText WRITE setCancelButtonText) |
|
81 |
||
82 |
public: |
|
83 |
enum InputDialogOption { |
|
84 |
NoButtons = 0x00000001, |
|
85 |
UseListViewForComboBoxItems = 0x00000002 |
|
86 |
}; |
|
87 |
||
88 |
Q_DECLARE_FLAGS(InputDialogOptions, InputDialogOption) |
|
89 |
||
90 |
enum InputMode { |
|
91 |
TextInput, |
|
92 |
IntInput, |
|
93 |
DoubleInput |
|
94 |
}; |
|
95 |
||
96 |
QInputDialog(QWidget *parent = 0, Qt::WindowFlags flags = 0); |
|
97 |
~QInputDialog(); |
|
98 |
||
99 |
void setInputMode(InputMode mode); |
|
100 |
InputMode inputMode() const; |
|
101 |
||
102 |
void setLabelText(const QString &text); |
|
103 |
QString labelText() const; |
|
104 |
||
105 |
void setOption(InputDialogOption option, bool on = true); |
|
106 |
bool testOption(InputDialogOption option) const; |
|
107 |
void setOptions(InputDialogOptions options); |
|
108 |
InputDialogOptions options() const; |
|
109 |
||
110 |
void setTextValue(const QString &text); |
|
111 |
QString textValue() const; |
|
112 |
||
113 |
void setTextEchoMode(QLineEdit::EchoMode mode); |
|
114 |
QLineEdit::EchoMode textEchoMode() const; |
|
115 |
||
116 |
void setComboBoxEditable(bool editable); |
|
117 |
bool isComboBoxEditable() const; |
|
118 |
||
119 |
void setComboBoxItems(const QStringList &items); |
|
120 |
QStringList comboBoxItems() const; |
|
121 |
||
122 |
void setIntValue(int value); |
|
123 |
int intValue() const; |
|
124 |
||
125 |
void setIntMinimum(int min); |
|
126 |
int intMinimum() const; |
|
127 |
||
128 |
void setIntMaximum(int max); |
|
129 |
int intMaximum() const; |
|
130 |
||
131 |
void setIntRange(int min, int max); |
|
132 |
||
133 |
void setIntStep(int step); |
|
134 |
int intStep() const; |
|
135 |
||
136 |
void setDoubleValue(double value); |
|
137 |
double doubleValue() const; |
|
138 |
||
139 |
void setDoubleMinimum(double min); |
|
140 |
double doubleMinimum() const; |
|
141 |
||
142 |
void setDoubleMaximum(double max); |
|
143 |
double doubleMaximum() const; |
|
144 |
||
145 |
void setDoubleRange(double min, double max); |
|
146 |
||
147 |
void setDoubleDecimals(int decimals); |
|
148 |
int doubleDecimals() const; |
|
149 |
||
150 |
void setOkButtonText(const QString &text); |
|
151 |
QString okButtonText() const; |
|
152 |
||
153 |
void setCancelButtonText(const QString &text); |
|
154 |
QString cancelButtonText() const; |
|
155 |
||
156 |
#ifdef Q_NO_USING_KEYWORD |
|
157 |
#ifndef Q_QDOC |
|
158 |
void open() { QDialog::open(); } |
|
159 |
#endif |
|
160 |
#else |
|
161 |
using QDialog::open; |
|
162 |
#endif |
|
163 |
void open(QObject *receiver, const char *member); |
|
164 |
||
165 |
QSize minimumSizeHint() const; |
|
166 |
QSize sizeHint() const; |
|
167 |
||
168 |
void setVisible(bool visible); |
|
169 |
||
170 |
static QString getText(QWidget *parent, const QString &title, const QString &label, |
|
171 |
QLineEdit::EchoMode echo = QLineEdit::Normal, |
|
172 |
const QString &text = QString(), bool *ok = 0, Qt::WindowFlags flags = 0); |
|
173 |
static int getInt(QWidget *parent, const QString &title, const QString &label, int value = 0, |
|
174 |
int minValue = -2147483647, int maxValue = 2147483647, |
|
175 |
int step = 1, bool *ok = 0, Qt::WindowFlags flags = 0); |
|
176 |
static double getDouble(QWidget *parent, const QString &title, const QString &label, double value = 0, |
|
177 |
double minValue = -2147483647, double maxValue = 2147483647, |
|
178 |
int decimals = 1, bool *ok = 0, Qt::WindowFlags flags = 0); |
|
179 |
static QString getItem(QWidget *parent, const QString &title, const QString &label, |
|
180 |
const QStringList &items, int current = 0, bool editable = true, |
|
181 |
bool *ok = 0, Qt::WindowFlags flags = 0); |
|
182 |
||
183 |
// obsolete |
|
184 |
static int getInteger(QWidget *parent, const QString &title, const QString &label, int value = 0, |
|
185 |
int minValue = -2147483647, int maxValue = 2147483647, |
|
186 |
int step = 1, bool *ok = 0, Qt::WindowFlags flags = 0); |
|
187 |
||
188 |
#ifdef QT3_SUPPORT |
|
189 |
inline static QT3_SUPPORT QString getText(const QString &title, const QString &label, |
|
190 |
QLineEdit::EchoMode echo = QLineEdit::Normal, |
|
191 |
const QString &text = QString(), bool *ok = 0, |
|
192 |
QWidget *parent = 0, const char * = 0, Qt::WindowFlags flags = 0) |
|
193 |
{ return getText(parent, title, label, echo, text, ok, flags); } |
|
194 |
inline static QT3_SUPPORT int getInteger(const QString &title, const QString &label, int value = 0, |
|
195 |
int minValue = -2147483647, int maxValue = 2147483647, |
|
196 |
int step = 1, bool *ok = 0, |
|
197 |
QWidget *parent = 0, const char * = 0, Qt::WindowFlags flags = 0) |
|
198 |
{ return getInteger(parent, title, label, value, minValue, maxValue, step, ok, flags); } |
|
199 |
inline static QT3_SUPPORT double getDouble(const QString &title, const QString &label, double value = 0, |
|
200 |
double minValue = -2147483647, double maxValue = 2147483647, |
|
201 |
int decimals = 1, bool *ok = 0, |
|
202 |
QWidget *parent = 0, const char * = 0, Qt::WindowFlags flags = 0) |
|
203 |
{ return getDouble(parent, title, label, value, minValue, maxValue, decimals, ok, flags); } |
|
204 |
inline static QT3_SUPPORT QString getItem(const QString &title, const QString &label, const QStringList &list, |
|
205 |
int current = 0, bool editable = true, bool *ok = 0, |
|
206 |
QWidget *parent = 0, const char * = 0, Qt::WindowFlags flags = 0) |
|
207 |
{ return getItem(parent, title, label, list, current, editable, ok, flags); } |
|
208 |
#endif |
|
209 |
||
210 |
Q_SIGNALS: |
|
211 |
// ### emit signals! |
|
212 |
void textValueChanged(const QString &text); |
|
213 |
void textValueSelected(const QString &text); |
|
214 |
void intValueChanged(int value); |
|
215 |
void intValueSelected(int value); |
|
216 |
void doubleValueChanged(double value); |
|
217 |
void doubleValueSelected(double value); |
|
218 |
||
219 |
||
220 |
public: |
|
221 |
void done(int result); // ### Qt 5: Make protected. |
|
222 |
||
223 |
private: |
|
224 |
Q_DISABLE_COPY(QInputDialog) |
|
225 |
Q_PRIVATE_SLOT(d_func(), void _q_textChanged(const QString&)) |
|
226 |
Q_PRIVATE_SLOT(d_func(), void _q_currentRowChanged(const QModelIndex&, const QModelIndex&)) |
|
227 |
}; |
|
228 |
||
229 |
Q_DECLARE_OPERATORS_FOR_FLAGS(QInputDialog::InputDialogOptions) |
|
230 |
||
231 |
#endif // QT_NO_INPUTDIALOG |
|
232 |
||
233 |
QT_END_NAMESPACE |
|
234 |
||
235 |
QT_END_HEADER |
|
236 |
||
237 |
#endif // QINPUTDIALOG_H |