48 #include <QtCore/qdebug.h> 49 #include <QtGui/qheaderview.h> 50 #include <QtGui/qcompleter.h> 51 #include <QtGui/qstringlistmodel.h> 52 #include <QtGui/qtreeview.h> 53 #include <QtGui/qboxlayout.h> 54 #include <QtGui/qsortfilterproxymodel.h> 55 #include <QtGui/qlineedit.h> 56 #include <QtGui/qstyleditemdelegate.h> 57 #include <QtGui/qevent.h> 58 #include <QtGui/qmessagebox.h> 59 #include <QtScript/qscriptengine.h> 68 CustomProxyModel(
QObject *parent = 0)
95 void _q_onCompletionTaskFinished();
107 completingEditor = 0;
121 task = completionProvider->createCompletionTask(
123 q->localsModel()->frameIndex(), 0);
125 q,
SLOT(_q_onCompletionTaskFinished()));
126 completingEditor = le;
135 if (!completingEditor) {
144 QString tmp = completingEditor->text();
147 completingEditor->setText(tmp);
148 completingEditor = 0;
155 completer->setWrapAround(
false);
162 completer->setModel(model);
169 completer->setCompletionPrefix(prefix);
170 completingEditor->setCompleter(completer);
173 completer->complete();
181 QString tmp = completingEditor->text();
182 tmp.
insert(completingEditor->cursorPosition(), text.
mid(completer->completionPrefix().length()));
183 completingEditor->setText(tmp);
184 completingEditor = 0;
189 if (view->model() == index.
model())
190 view->expand(proxy->mapFromSource(index));
219 col =
QColor(255, 240, 192);
221 col =
QColor(255, 102, 102);
247 if (index.
column() == 1) {
296 if (index.
column() == 1) {
332 static const int i = 9;
362 d->view->setAlternatingRowColors(
true);
364 d->view->setSortingEnabled(
true);
403 d->proxy =
new CustomProxyModel(
this);
406 d->proxy->setSourceModel(model);
407 d->view->setModel(
d->proxy);
416 d->view->expand(index);
422 #include "qscriptdebuggerlocalswidget.moc" 424 #include "moc_qscriptdebuggerlocalswidget_p.cpp" T qobject_cast(QObject *object)
The QPainter class performs low-level painting on widgets and other paint devices.
The QColor class provides colors based on RGB, HSV or CMYK values.
The QKeyEvent class describes a key event.
#define QT_END_NAMESPACE
This macro expands to.
QModelIndex mapToSource(const QModelIndex &proxyIndex) const
Returns the source model index corresponding to the given proxyIndex from the sorting filter model...
void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
Gets data from the editor widget and stores it in the specified model at the item index...
QVariant data(int role=Qt::DisplayRole) const
Returns the data for the given role for the item referred to by the index.
QStyle::State state
the style flags that are used when drawing the control
QString resultAt(int index) const
QString toString() const
Returns the variant as a QString if the variant has type() String , Bool , ByteArray ...
int left() const
Returns the x-coordinate of the rectangle's left edge.
int width() const
Returns the width of the rectangle.
The QCompleter class provides completions based on an item model.
virtual void drawItemText(QPainter *painter, const QRect &rect, int flags, const QPalette &pal, bool enabled, const QString &text, QPalette::ColorRole textRole=QPalette::NoRole) const
Draws the given text in the specified rectangle using the provided painter and palette.
bool isExpanded(const QModelIndex &index) const
Returns true if the model item index is expanded; otherwise returns false.
int height() const
Returns the height of the rectangle.
The QString class provides a Unicode character string.
QFontMetrics fontMetrics
the font metrics that should be used when drawing text in the control
T * qobject_cast(QObject *object)
The QStringListModel class provides a model that supplies strings to views.
The QObject class is the base class of all Qt objects.
virtual bool event(QEvent *)
This virtual function receives events to an object and should return true if the event e was recogniz...
void addWidget(QWidget *, int stretch=0, Qt::Alignment alignment=0)
Adds widget to the end of this box layout, with a stretch factor of stretch and alignment alignment...
The QStyledItemDelegate class provides display and editing facilities for data items from a model...
static QObjectPrivate * get(QObject *o)
QModelIndex parent() const
Returns the parent of the model index, or QModelIndex() if it has no parent.
int key() const
Returns the code of the key that was pressed or released.
QWidget * createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
Returns the widget used to edit the item specified by index for editing.
void append(const T &t)
Inserts value at the end of the list.
bool eventFilter(QObject *watched, QEvent *event)
Returns true if the given editor is a valid QWidget and the given event is handled; otherwise returns...
#define QT_BEGIN_NAMESPACE
This macro expands to.
The QStyleOptionViewItemV3 class is used to describe the parameters necessary for drawing a frame in ...
bool hasChildren(const QModelIndex &parent=QModelIndex()) const
Reimplemented Function
void setStringList(const QStringList &strings)
Sets the model's internal string list to strings.
The QStyleOption class stores the parameters used by QStyle functions.
virtual bool hasChildren(const QModelIndex &parent=QModelIndex()) const
Returns true if parent has any children; otherwise returns false.
QAbstractItemModel * sourceModel() const
Returns the model that contains the data that is available through the proxy model.
static bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
Creates a connection of the given type from the signal in the sender object to the method in the rece...
The QTreeView class provides a default model/view implementation of a tree view.
QString text
the line edit's text
int row() const
Returns the row this model index refers to.
const QAbstractItemModel * model() const
Returns a pointer to the model containing the item that this index refers to.
The QStringList class provides a list of strings.
virtual void drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p, const QWidget *w=0) const =0
Draws the given primitive element with the provided painter using the style options specified by opti...
The QScriptSyntaxCheckResult class provides the result of a script syntax check.
bool isValid() const
Returns true if this model index is valid; otherwise returns false.
The QAbstractItemModel class provides the abstract interface for item model classes.
QPalette palette
the palette that should be used when painting the control
static bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *member)
Disconnects signal in object sender from method in object receiver.
QString mid(int position, int n=-1) const Q_REQUIRED_RESULT
Returns a string that contains n characters of this string, starting at the specified position index...
static const QWidget * widget(const QStyleOptionViewItem &option)
The QSortFilterProxyModel class provides support for sorting and filtering data passed between anothe...
int top() const
Returns the y-coordinate of the rectangle's top edge.
void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
Gets data from the editor widget and stores it in the specified model at the item index...
#define Q_DECLARE_PUBLIC(Class)
QString & append(QChar c)
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
Renders the delegate using the given painter and style option for the item specified by index...
QObject * parent() const
Returns a pointer to the parent object.
The QModelIndex class is used to locate data in a data model.
virtual void drawControl(ControlElement element, const QStyleOption *opt, QPainter *p, const QWidget *w=0) const =0
Draws the given element with the provided painter with the style options specified by option...
void validateInput(const QString &text)
The QStyle class is an abstract base class that encapsulates the look and feel of a GUI...
The QRect class defines a rectangle in the plane using integer precision.
QWidget * createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
Returns the widget used to edit the item specified by index for editing.
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
Renders the delegate using the given painter and style option for the item specified by index...
The QLineEdit widget is a one-line text editor.
static QScriptSyntaxCheckResult checkSyntax(const QString &program)
Checks the syntax of the given program.
QScriptDebuggerLocalsItemDelegate(QObject *parent=0)
The QVBoxLayout class lines up widgets vertically.
The QStyleOptionViewItem class is used to describe the parameters used to draw an item in a view widg...
QString & remove(int i, int len)
Removes n characters from the string, starting at the given position index, and returns a reference t...
static QString elidedText(const QFontMetrics &fontMetrics, int width, Qt::TextElideMode mode, const QString &text)
Use QFontMetrics::elidedText() instead.
The QEvent class is the base class of all event classes.
Type type() const
Returns the event type.
QString & insert(int i, QChar c)
bool eventFilter(QObject *object, QEvent *event)
Returns true if the given editor is a valid QWidget and the given event is handled; otherwise returns...
void deleteLater()
Schedules this object for deletion.
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
QRect rect
the area that should be used for various calculations and painting
int cursorPosition
the current cursor position for this line edit
int column() const
Returns the column this model index refers to.
State state() const
Returns the state of this QScriptSyntaxCheckResult.
The QPalette class contains color groups for each widget state.