47 #include <QtCore/qdebug.h> 48 #include <QtGui/qaction.h> 49 #include <QtGui/qcompleter.h> 50 #include <QtGui/qheaderview.h> 51 #include <QtGui/qlineedit.h> 52 #include <QtGui/qmessagebox.h> 53 #include <QtGui/qtoolbar.h> 54 #include <QtGui/qtoolbutton.h> 55 #include <QtGui/qtreeview.h> 56 #include <QtGui/qboxlayout.h> 57 #include <QtGui/qstyleditemdelegate.h> 58 #include <QtGui/qevent.h> 59 #include <QtScript/qscriptengine.h> 151 void _q_newBreakpoint();
152 void _q_deleteBreakpoint();
154 void _q_onNewBreakpointRequest(
const QString &
fileName,
int lineNumber);
178 newBreakpointWidget->show();
187 int id = q->breakpointsModel()->breakpointIdAt(index.
row());
188 q->breakpointsModel()->deleteBreakpoint(
id);
194 deleteBreakpointAction->setEnabled(index.
isValid());
200 q_func()->breakpointsModel()->setBreakpoint(data);
215 if (index.
column() == 2) {
228 if (
QLineEdit *le = qobject_cast<QLineEdit*>(editor)) {
245 if (index.
column() == 2) {
267 col =
QColor(255, 240, 192);
269 col =
QColor(255, 102, 102);
284 d->view->setRootIsDecorated(
false);
292 d->newBreakpointWidget->hide();
294 this,
SLOT(_q_onNewBreakpointRequest(
QString,
int)));
296 QIcon newBreakpointIcon;
298 QAction *newBreakpointAction =
new QAction(newBreakpointIcon,
tr(
"New"),
this);
300 this,
SLOT(_q_newBreakpoint()));
302 QIcon deleteBreakpointIcon;
304 d->deleteBreakpointAction =
new QAction(deleteBreakpointIcon,
tr(
"Delete"),
this);
305 d->deleteBreakpointAction->setEnabled(
false);
307 this,
SLOT(_q_deleteBreakpoint()));
309 #ifndef QT_NO_TOOLBAR 312 toolBar->
addAction(
d->deleteBreakpointAction);
317 #ifndef QT_NO_TOOLBAR 343 d->view->setModel(model);
344 d->view->header()->resizeSection(0, 50);
355 return d->scriptsModel;
364 d->scriptsModel = model;
367 d->newBreakpointWidget->setCompleter(completer);
387 #include "qscriptbreakpointswidget.moc" 389 #include "moc_qscriptbreakpointswidget_p.cpp"
The QColor class provides colors based on RGB, HSV or CMYK values.
The QRegExpValidator class is used to check a string against a regular expression.
The QKeyEvent class describes a key event.
void addPixmap(const QPixmap &pixmap, Mode mode=Normal, State state=Off)
Adds pixmap to the icon, as a specialization for mode and state.
#define QT_END_NAMESPACE
This macro expands to.
int breakpointIdAt(int row) const
Returns the id of the breakpoint at the given row.
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...
The QRegExp class provides pattern matching using regular expressions.
void deleteBreakpoint(int id)
Deletes the breakpoint with the given id.
int length() const
Returns the number of characters in this string.
void setCompleter(QCompleter *completer)
Sets this line edit to provide auto completions from the completer, c.
The QCompleter class provides completions based on an item model.
static QString tr(const char *sourceText, const char *comment=0, int n=-1)
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
The QString class provides a Unicode character string.
T * qobject_cast(QObject *object)
The QObject class is the base class of all Qt objects.
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...
QObject * sender() const
Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; othe...
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.
#define QT_BEGIN_NAMESPACE
This macro expands to.
QString left(int n) const Q_REQUIRED_RESULT
Returns a substring that contains the n leftmost characters of the string.
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.
static int toInt(const QByteArray &str)
static QString fromUtf8(const char *, int size=-1)
Returns a QString initialized with the first size bytes of the UTF-8 string str.
void setValidator(const QValidator *)
Sets this line edit to only accept input that the validator, v, will accept.
The QScriptSyntaxCheckResult class provides the result of a script syntax check.
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...
The QScriptBreakpointData class contains data associated with a breakpoint.
QScriptBreakpointsItemDelegate(QObject *parent=0)
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.
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...
#define Q_DECLARE_PUBLIC(Class)
void clear()
Clears the contents of the line edit.
int lastIndexOf(QChar c, int from=-1, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
static QString fromLatin1(const char *, int size=-1)
Returns a QString initialized with the first size characters of the Latin-1 string str...
void setSpacing(int spacing)
Reimplements QLayout::setSpacing().
QObject * parent() const
Returns a pointer to the parent object.
static QTestResult::TestLocation location
The QModelIndex class is used to locate data in a data model.
The QHBoxLayout class lines up widgets horizontally.
The QLineEdit widget is a one-line text editor.
The QPixmap class is an off-screen image representation that can be used as a paint device...
static QScriptSyntaxCheckResult checkSyntax(const QString &program)
Checks the syntax of the given program.
void validateInput(const QString &text)
QWidget * createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
Returns the widget used to edit the item specified by index for editing.
bool eventFilter(QObject *editor, QEvent *event)
Returns true if the given editor is a valid QWidget and the given event is handled; otherwise returns...
void setCompletionRole(int role)
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...
The QEvent class is the base class of all event classes.
Type type() const
Returns the event type.
static QString fileName(const QString &fileUrl)
bool hasAcceptableInput() const
bool eventFilter(QObject *object, QEvent *event)
Returns true if the given editor is a valid QWidget and the given event is handled; otherwise returns...
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
The QAction class provides an abstract user interface action that can be inserted into widgets...
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.
The QIcon class provides scalable icons in different modes and states.