45 #include <QtGui/qpainter.h> 46 #include <QtGui/qicon.h> 47 #include <QtGui/qboxlayout.h> 48 #include <QtGui/qlabel.h> 49 #include <QtGui/qlineedit.h> 50 #include <QtGui/qmenu.h> 51 #include <QtGui/qaction.h> 52 #include <QtGui/qwidgetaction.h> 53 #include <QtCore/qdebug.h> 89 if (
editor()->extraAreaEvent(event))
120 #ifndef QT_NO_SYNTAXHIGHLIGHTER 161 #if 0 // ### enable me once we have information about the script again 251 extraSelections.
append(selection);
265 extraSelections.
append(selection);
316 painter.
drawLine(rect.
x() + extraAreaWidth-1, rect.
top(), rect.
x() + extraAreaWidth-1, rect.
bottom());
342 QRect r(rect.
x(), (int)top, radius, radius);
350 QRect r(rect.
x(), (int)top, radius, radius);
360 painter.
drawText(rect.
x() + markWidth, (int)top, rect.
x() + extraAreaWidth - markWidth - 4,
364 block = block.
next();
380 bool hand = (e->
pos().
x() <= markWidth);
393 if ((e->
pos().
x() <= markWidth) && executable)
430 if (ret == toggleAct) {
432 }
else if (ret == disableAct) {
434 }
else if (ret == enableAct) {
void breakpointToggleRequest(int lineNumber, bool on)
static QString number(int, int base=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
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.
void blockCountChanged(int newBlockCount)
This signal is emitted whenever the block count changes.
void setExtraSelections(const QList< QTextEdit::ExtraSelection > &selections)
This function allows temporarily marking certain regions in the document with a given color...
QRectF blockBoundingGeometry(const QTextBlock &block) const
Returns the bounding rectangle of the text block in content coordinates.
void extraAreaPaintEvent(QPaintEvent *e)
int width(const QString &, int len=-1) const
Returns the width in pixels of the first len characters of text.
The QFontMetrics class provides font metrics information.
void setColorAt(qreal pos, const QColor &color)
Creates a stop point at the given position with the given color.
#define QT_END_NAMESPACE
This macro expands to.
bool extraAreaEvent(QEvent *e)
void extraAreaMouseEvent(QMouseEvent *e)
void centerCursor()
Scrolls the document in order to center the cursor vertically.
void setProperty(int propertyId, const QVariant &value)
Sets the property specified by the propertyId to the given value.
int m_executionLineNumber
QTextDocument * document() const
Returns a pointer to the underlying document.
The QPointF class defines a point in the plane using floating point precision.
void cursorPositionChanged()
This signal is emitted whenever the position of the cursor changed.
int currentLineNumber() const
int left() const
Returns the x-coordinate of the rectangle's left edge.
int width() const
Returns the width of the rectangle.
static QString tr(const char *sourceText, const char *comment=0, int n=-1)
bool isExecutableLine(int lineNumber) const
QRect intersected(const QRect &other) const
Returns the intersection of this rectangle and the given rectangle.
QTextCursor textCursor() const
Returns a copy of the QTextCursor that represents the currently visible cursor.
void breakpointEnableRequest(int lineNumber, bool enable)
void drawLine(const QLineF &line)
Draws a line defined by line.
void setBackground(const QBrush &brush)
Sets the brush use to paint the document's background to the brush specified.
int height() const
Returns the height of the rectangle.
int bottom() const
Returns the y-coordinate of the rectangle's bottom edge.
The QString class provides a Unicode character string.
T * qobject_cast(QObject *object)
int extraAreaWidth() const
const QColor & color(ColorGroup cg, ColorRole cr) const
Returns the color in the specified color group, used for the given color role.
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 QPen class defines how a QPainter should draw lines and outlines of shapes.
void setExecutionLineNumber(int lineNumber, bool error)
virtual void paintEvent(QPaintEvent *e)
Reimplemented Function
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
const QPoint & pos() const
Returns the position of the mouse cursor, relative to the widget that received the event...
QTextBlock next() const
Returns the text block in the document after this block, or an empty text block if this is the last o...
void updateRequest(const QRect &rect, int dy)
This signal is emitted when the text document needs an update of the specified rect.
int position() const
Returns the index of the block's first character within the document.
QTextCursor cursorForPosition(const QPoint &pos) const
returns a QTextCursor at position pos (in viewport coordinates).
void setCurrentColorGroup(ColorGroup cg)
Set the palette's current color group to cg.
void drawText(const QPointF &p, const QString &s)
Draws the given text with the currently defined text direction, beginning at the given position...
void append(const T &t)
Inserts value at the end of the list.
void setRenderHint(RenderHint hint, bool on=true)
Sets the given render hint on the painter if on is true; otherwise clears the render hint...
bool isVisible() const
Returns true if the block is visible; otherwise returns false.
#define QT_BEGIN_NAMESPACE
This macro expands to.
int blockNumber() const
Returns the number of the block the cursor is in, or 0 if the cursor is invalid.
bool contains(const T &value) const
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 QTextCursor class offers an API to access and modify QTextDocuments.
qreal height() const
Returns the height of the rectangle.
QHash< int, BreakpointData > m_breakpoints
The QResizeEvent class contains event parameters for resize events.
QRectF blockBoundingRect(const QTextBlock &block) const
Returns the bounding rectangle of the text block in the block's own coordinates.
The QTextBlock class provides a container for text fragments in a QTextDocument.
The QPlainTextEdit class provides a widget that is used to edit and display plain text...
QScriptEditExtraArea * m_extraArea
int m_extraAreaToggleBlockNumber
QScriptEdit(QWidget *parent=0)
Qt::MouseButton button() const
Returns the button that caused the event.
QTextBlock findBlockByNumber(int blockNumber) const
Returns the text block with the specified blockNumber.
bool contains(const QPoint &p, bool proper=false) const
Returns true if the given point is inside or on the edge of the rectangle, otherwise returns false...
QTextBlock block() const
Returns the block that contains the cursor.
void clearSelection()
Clears the current selection by setting the anchor to the cursor position.
void resizeEvent(QResizeEvent *e)
Reimplemented Function
void deleteBreakpoint(int lineNumber)
void paintEvent(QPaintEvent *e)
Reimplemented Function
The QMouseEvent class contains parameters that describe a mouse event.
int executionLineNumber() const
QPointF contentOffset() const
Returns the content's origin in viewport coordinates.
void highlightCurrentLine()
int top() const
Returns the y-coordinate of the rectangle's top edge.
void updateExtraAreaWidth()
Qt::MouseButtons buttons() const
Returns the button state when the event was generated.
The QLinearGradient class is used in combination with QBrush to specify a linear gradient brush...
int y() const
Returns the y-coordinate of the rectangle's top edge.
static QString fromLatin1(const char *, int size=-1)
Returns a QString initialized with the first size characters of the Latin-1 string str...
void setBreakpointEnabled(int lineNumber, bool enable)
int x() const
Returns the x-coordinate of the rectangle's left edge.
QObject * parent() const
Returns a pointer to the parent object.
int baseLineNumber() const
The QPoint class defines a point in the plane using integer precision.
void setPen(const QColor &color)
Sets the painter's pen to have style Qt::SolidLine, width 0 and the specified color.
The QRect class defines a rectangle in the plane using integer precision.
QList< QTextEdit::ExtraSelection > extraSelections() const
Returns previously set extra selections.
The QLabel widget provides a text or image display.
virtual void resizeEvent(QResizeEvent *e)
Reimplemented Function
The QHBoxLayout class lines up widgets horizontally.
void updateExtraSelections()
int y() const
Returns the y coordinate of this point.
friend class QScriptEditExtraArea
The QLineEdit widget is a one-line text editor.
int lineSpacing() const
Returns the distance from one base line to the next.
void setTextCursor(const QTextCursor &cursor)
Sets the visible cursor.
void setPosition(int pos, MoveMode mode=MoveAnchor)
Moves the cursor to the absolute position in the document specified by pos using a MoveMode specified...
void setExecutableLineNumbers(const QSet< int > &lineNumbers)
bool isValid() const
Returns true if this text block is valid; otherwise returns false.
qreal top() const
Returns the y-coordinate of the rectangle's top edge.
The QSize class defines the size of a two-dimensional object using integer point precision.
void setBreakpoint(int lineNumber)
int x() const
Returns the x coordinate of this point.
QSet< int > m_executableLineNumbers
void updateExtraArea(const QRect &, int)
bool m_executionLineNumberHasError
QRectF translated(qreal dx, qreal dy) const
Returns a copy of the rectangle that is translated dx along the x axis and dy along the y axis...
const QRect & rect() const
Returns the rectangle that needs to be updated.
int height() const
Returns the height of the font.
QColor lighter(int f=150) const
Returns a lighter (or darker) color, but does not change this object.
The QPaintEvent class contains event parameters for paint events.
void gotoLine(int lineNumber)
The QEvent class is the base class of all event classes.
Type type() const
Returns the event type.
const QPoint & globalPos() const
Returns the global position of the mouse cursor at the time of the event.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
void deleteLater()
Schedules this object for deletion.
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 blockNumber() const
Returns the number of this block, or -1 if the block is invalid.
void fillRect(const QRectF &, const QBrush &)
Fills the given rectangle with the brush specified.
The QList class is a template class that provides lists.
void setBaseLineNumber(int base)
void paint(QPainter *painter, const QRect &rect, Qt::Alignment alignment=Qt::AlignCenter, Mode mode=Normal, State state=Off) const
Uses the painter to paint the icon with specified alignment, required mode, and state into the rectan...
Qt::CursorShape shape() const
Returns the cursor shape identifier.
QTextBlock firstVisibleBlock() const
Returns the first visible block.
The QPalette class contains color groups for each widget state.
The QIcon class provides scalable icons in different modes and states.