1 /**************************************************************************
3 ** This file is part of Qt Creator
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
7 ** Contact: Nokia Corporation (qt-info@nokia.com)
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
16 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
25 ** In addition, as a special exception, Nokia gives you certain additional
26 ** rights. These rights are described in the Nokia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
29 ** If you have questions regarding the use of this file, please contact
30 ** Nokia at qt-info@nokia.com.
32 **************************************************************************/
34 #ifndef WATCHDELEGATEEDITS_H
35 #define WATCHDELEGATEEDITS_H
37 #include <QtGui/QLineEdit>
38 #include <QtGui/QComboBox>
39 #include <QtCore/QVariant>
43 class IntegerValidator;
45 /* Watch edit widgets. The logic is based on the QVariant 'modelData' property,
46 * which is accessed by the WatchDelegate. */
48 /* WatchLineEdit: Base class for Watch delegate line edits with
49 * ready-made accessors for the model's QVariants for QString-text use. */
50 class WatchLineEdit : public QLineEdit
53 Q_PROPERTY(QString text READ text WRITE setText USER false)
54 Q_PROPERTY(QVariant modelData READ modelData WRITE setModelData DESIGNABLE false USER true)
56 explicit WatchLineEdit(QWidget *parent = 0);
58 // Ready-made accessors for item views passing QVariants around
59 virtual QVariant modelData() const;
60 virtual void setModelData(const QVariant &);
62 static WatchLineEdit *create(QVariant::Type t, QWidget *parent = 0);
65 /* Watch delegate line edit for integer numbers based on quint64/qint64.
66 * Does validation using the given number base (10, 16, 8, 2) and signedness.
67 * isBigInt() indicates that no checking for number conversion is to be performed
68 * (that is, value cannot be handled as quint64/qint64, for 128bit registers, etc). */
69 class IntegerWatchLineEdit : public WatchLineEdit
72 Q_PROPERTY(int base READ base WRITE setBase DESIGNABLE true)
73 Q_PROPERTY(bool Signed READ isSigned WRITE setSigned DESIGNABLE true)
74 Q_PROPERTY(bool bigInt READ isBigInt WRITE setBigInt DESIGNABLE true)
76 explicit IntegerWatchLineEdit(QWidget *parent = 0);
78 // Ready-made accessors for item views passing QVariants around
79 virtual QVariant modelData() const;
80 virtual void setModelData(const QVariant &);
84 bool isSigned() const;
85 void setSigned(bool s);
86 bool isBigInt() const;
87 void setBigInt(bool b);
89 static bool isUnsignedHexNumber(const QString &v);
92 void setNumberText(const QString &);
93 inline QVariant modelDataI() const;
94 IntegerValidator *m_validator;
98 class FloatWatchLineEdit : public WatchLineEdit
101 explicit FloatWatchLineEdit(QWidget *parent = 0);
103 virtual QVariant modelData() const;
104 virtual void setModelData(const QVariant &);
107 /* Combo box for booleans */
108 class BooleanComboBox : public QComboBox
111 Q_PROPERTY(QVariant modelData READ modelData WRITE setModelData DESIGNABLE false USER true)
113 explicit BooleanComboBox(QWidget *parent = 0);
115 virtual QVariant modelData() const;
116 virtual void setModelData(const QVariant &);
119 } // namespace Internal
120 } // namespace Debugger
122 #endif // WATCHDELEGATEEDITS_H