47 #include <QtGui/qboxlayout.h> 48 #include <QtGui/qtextobject.h> 49 #include <QtCore/qdebug.h> 77 d->editor->setReadOnly(
true);
78 d->editor->setBackgroundVisible(
false);
95 return d->editor->toPlainText();
101 d->editor->setPlainText(text);
107 return d->editor->currentLineNumber();
113 d->editor->gotoLine(lineNumber);
121 if (options & 0x100) {
123 if (
cursor.hasSelection()) {
124 int len =
cursor.selectedText().length();
132 if (ed->
find(exp, QTextDocument::FindFlags(options))) {
138 if (ed->
find(exp, QTextDocument::FindFlags(options)))
149 d->editor->setExecutionLineNumber(lineNumber, error);
155 d->editor->setExecutableLineNumbers(lineNumbers);
161 return d->editor->baseLineNumber();
167 d->editor->setBaseLineNumber(lineNumber);
173 d->editor->setBreakpoint(lineNumber);
179 d->editor->deleteBreakpoint(lineNumber);
185 d->editor->setBreakpointEnabled(lineNumber, enable);
190 static bool isIdentChar(
const QChar &ch)
193 return ch.
isLetter() || (ch == underscore);
205 if (
d->editor->executionLineNumber() == -1)
209 pt.
rx() -=
d->editor->extraAreaWidth();
217 if (linePosition < 0)
222 int pos = linePosition;
223 if ((pos > 0) && contents.
at(pos-1).
isNumber()) {
228 while ((pos > 0) && isIdentChar(contents.
at(pos-1)))
235 int pos2 = linePosition - 1;
236 while ((pos2+1 < contents.
size()) && isIdentChar(contents.
at(pos2+1)))
238 QString ident = contents.
mid(pos, pos2 - pos + 1);
242 while ((pos > 0) && (contents.
at(pos-1) ==
QLatin1Char(
'.'))) {
245 while ((pos > 0) && isIdentChar(contents.
at(pos-1)))
251 int lineNumber = cursor.
blockNumber() +
d->editor->baseLineNumber();
260 #include "moc_qscriptdebuggercodeview_p.cpp"
bool find(const QString &exp, QTextDocument::FindFlags options=0)
Finds the next occurrence of the string, exp, using the given options.
void setBreakpoint(int lineNumber)
QString text() const
Returns the block's contents as plain text.
int cursorLineNumber() const
bool isLetter() const
Returns true if the character is a letter (Letter_* categories); otherwise returns false...
#define QT_END_NAMESPACE
This macro expands to.
void gotoLine(int lineNumber)
const QChar at(int i) const
Returns the character at the given index position in the string.
bool event(QEvent *e)
Reimplemented Function
~QScriptDebuggerCodeViewPrivate()
void setBreakpointEnabled(int lineNumber, bool enable)
QScriptDebuggerCodeViewPrivate()
int & ry()
Returns a reference to the y coordinate of this point.
QTextCursor textCursor() const
Returns a copy of the QTextCursor that represents the currently visible cursor.
void setBaseLineNumber(int lineNumber)
The QString class provides a Unicode character string.
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 QChar class provides a 16-bit Unicode character.
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
int position() const
Returns the index of the block's first character within the document.
void append(const T &t)
Inserts value at the end of the list.
#define QT_BEGIN_NAMESPACE
This macro expands to.
void setExecutableLineNumbers(const QSet< int > &lineNumbers)
int blockNumber() const
Returns the number of the block the cursor is in, or 0 if the cursor is invalid.
int size() const
Returns the number of characters in this 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...
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
The QTextCursor class offers an API to access and modify QTextDocuments.
void prepend(const T &t)
Inserts value at the beginning of the list.
The QStringList class provides a list of strings.
int & rx()
Returns a reference to the x coordinate of this point.
The QTextBlock class provides a container for text fragments in a QTextDocument.
~QScriptDebuggerCodeView()
The QPlainTextEdit class provides a widget that is used to edit and display plain text...
int position() const
Returns the absolute position of the cursor within the document.
int baseLineNumber() const
void setExecutionLineNumber(int lineNumber, bool error)
QTextBlock block() const
Returns the block that contains the cursor.
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 breakpointToggleRequest(int lineNumber, bool on)
The QPoint class defines a point in the plane using integer precision.
QScriptDebuggerCodeView(QWidget *parent=0)
const QPoint & globalPos() const
Returns the mouse cursor position when the event was generated in global coordinates.
int find(const QString &exp, int options=0)
bool movePosition(MoveOperation op, MoveMode=MoveAnchor, int n=1)
Moves the cursor by performing the given operation n times, using the specified mode, and returns true if all operations were completed successfully; otherwise returns false.
void setTextCursor(const QTextCursor &cursor)
Sets the visible cursor.
void toolTipRequest(const QPoint &pos, int lineNumber, const QStringList &path)
void setText(const QString &text)
The QVBoxLayout class lines up widgets vertically.
void breakpointEnableRequest(int lineNumber, bool enable)
The QEvent class is the base class of all event classes.
Type type() const
Returns the event type.
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
bool isNumber() const
Returns true if the character is a number (Number_* categories, not just 0-9); otherwise returns fals...
void deleteBreakpoint(int lineNumber)
The QHelpEvent class provides an event that is used to request helpful information about a particular...
const QPoint & pos() const
Returns the mouse cursor position when the event was generated, relative to the widget to which the e...