Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
SourceCodeView Class Reference

#include <sourcecodeview.h>

+ Inheritance diagram for SourceCodeView:
+ Collaboration diagram for SourceCodeView:

Public Slots

void setActivated (bool activated)
 
- Public Slots inherited from QPlainTextEdit
void setPlainText (const QString &text)
 Changes the text of the text edit to the string text.
 
void cut ()
 Copies the selected text to the clipboard and deletes it from the text edit.
 
void copy ()
 Copies any selected text to the clipboard.
 
void paste ()
 Pastes the text from the clipboard into the text edit at the current cursor position.
 
void undo ()
 Undoes the last operation.
 
void redo ()
 Redoes the last operation.
 
void clear ()
 Deletes all the text in the text edit.
 
void selectAll ()
 Selects all text.
 
void insertPlainText (const QString &text)
 Convenience slot that inserts text at the current cursor position.
 
void appendPlainText (const QString &text)
 Appends a new paragraph with text to the end of the text edit.
 
void appendHtml (const QString &html)
 Appends a new paragraph with html to the end of the text edit.
 
void centerCursor ()
 Scrolls the document in order to center the cursor vertically.
 
void zoomIn (int range=1)
 \reimp
 
void zoomOut (int range=1)
 Zooms out on the text by making the base font size range points smaller and recalculating all font sizes to be the new size.
 

Public Member Functions

 SourceCodeView (QWidget *parent=0)
 
void setSourceContext (const QString &fileName, const int lineNum)
 
- Public Member Functions inherited from QPlainTextEdit
 QPlainTextEdit (QWidget *parent=nullptr)
 Constructs an empty QPlainTextEdit with parent parent.
 
 QPlainTextEdit (const QString &text, QWidget *parent=nullptr)
 Constructs a QPlainTextEdit with parent parent.
 
virtual ~QPlainTextEdit ()
 Destructor.
 
void setDocument (QTextDocument *document)
 Makes document the new document of the text editor.
 
QTextDocumentdocument () const
 Returns a pointer to the underlying document.
 
void setPlaceholderText (const QString &placeholderText)
 
QString placeholderText () const
 
void setTextCursor (const QTextCursor &cursor)
 Sets the visible cursor.
 
QTextCursor textCursor () const
 Returns a copy of the QTextCursor that represents the currently visible cursor.
 
bool isReadOnly () const
 
void setReadOnly (bool ro)
 
void setTextInteractionFlags (Qt::TextInteractionFlags flags)
 
Qt::TextInteractionFlags textInteractionFlags () const
 
void mergeCurrentCharFormat (const QTextCharFormat &modifier)
 Merges the properties specified in modifier into the current character format by calling QTextCursor::mergeCharFormat on the editor's cursor.
 
void setCurrentCharFormat (const QTextCharFormat &format)
 Sets the char format that is be used when inserting new text to format by calling QTextCursor::setCharFormat() on the editor's cursor.
 
QTextCharFormat currentCharFormat () const
 Returns the char format that is used when inserting new text.
 
bool tabChangesFocus () const
 
void setTabChangesFocus (bool b)
 
void setDocumentTitle (const QString &title)
 
QString documentTitle () const
 
bool isUndoRedoEnabled () const
 
void setUndoRedoEnabled (bool enable)
 
void setMaximumBlockCount (int maximum)
 
int maximumBlockCount () const
 
LineWrapMode lineWrapMode () const
 
void setLineWrapMode (LineWrapMode mode)
 
QTextOption::WrapMode wordWrapMode () const
 the mode QPlainTextEdit will use when wrapping text by words
 
void setWordWrapMode (QTextOption::WrapMode policy)
 
void setBackgroundVisible (bool visible)
 
bool backgroundVisible () const
 
void setCenterOnScroll (bool enabled)
 
bool centerOnScroll () const
 
bool find (const QString &exp, QTextDocument::FindFlags options=QTextDocument::FindFlags())
 Finds the next occurrence of the string, exp, using the given options.
 
QString toPlainText () const
 Returns the text of the text edit as plain text.
 
void ensureCursorVisible ()
 Ensures that the cursor is visible by scrolling the text edit if necessary.
 
virtual QVariant loadResource (int type, const QUrl &name)
 Loads the resource specified by the given type and name.
 
QMenucreateStandardContextMenu ()
 This function creates the standard context menu which is shown when the user clicks on the text edit with the right mouse button.
 
QMenucreateStandardContextMenu (const QPoint &position)
 
QTextCursor cursorForPosition (const QPoint &pos) const
 returns a QTextCursor at position pos (in viewport coordinates).
 
QRect cursorRect (const QTextCursor &cursor) const
 returns a rectangle (in viewport coordinates) that includes the cursor.
 
QRect cursorRect () const
 returns a rectangle (in viewport coordinates) that includes the cursor of the text edit.
 
QString anchorAt (const QPoint &pos) const
 Returns the reference of the anchor at position pos, or an empty string if no anchor exists at that point.
 
bool overwriteMode () const
 
void setOverwriteMode (bool overwrite)
 
qreal tabStopDistance () const
 
void setTabStopDistance (qreal distance)
 
int cursorWidth () const
 
void setCursorWidth (int width)
 
void setExtraSelections (const QList< QTextEdit::ExtraSelection > &selections)
 This function allows temporarily marking certain regions in the document with a given color, specified as selections.
 
QList< QTextEdit::ExtraSelectionextraSelections () const
 Returns previously set extra selections.
 
void moveCursor (QTextCursor::MoveOperation operation, QTextCursor::MoveMode mode=QTextCursor::MoveAnchor)
 Moves the cursor by performing the given operation.
 
bool canPaste () const
 Returns whether text can be pasted from the clipboard into the textedit.
 
void print (QPagedPaintDevice *printer) const
 Convenience function to print the text edit's document to the given printer.
 
int blockCount () const
 
QVariant inputMethodQuery (Qt::InputMethodQuery property) const override
 \reimp
 
Q_INVOKABLE QVariant inputMethodQuery (Qt::InputMethodQuery query, QVariant argument) const
 

Additional Inherited Members

- Public Types inherited from QPlainTextEdit
enum  LineWrapMode { NoWrap , WidgetWidth }
 \value NoWrap \value WidgetWidth More...
 
- Signals inherited from QPlainTextEdit
void textChanged ()
 This signal is emitted whenever the document's content changes; for example, when text is inserted or deleted, or when formatting is applied.
 
void undoAvailable (bool b)
 This signal is emitted whenever undo operations become available (available is true) or unavailable (available is false).
 
void redoAvailable (bool b)
 This signal is emitted whenever redo operations become available (available is true) or unavailable (available is false).
 
void copyAvailable (bool b)
 This signal is emitted when text is selected or de-selected in the text edit.
 
void selectionChanged ()
 This signal is emitted whenever the selection changes.
 
void cursorPositionChanged ()
 This signal is emitted whenever the position of the cursor changed.
 
void updateRequest (const QRect &rect, int dy)
 This signal is emitted when the text document needs an update of the specified rect.
 
void blockCountChanged (int newBlockCount)
 This signal is emitted whenever the block count changes.
 
void modificationChanged (bool)
 This signal is emitted whenever the content of the document changes in a way that affects the modification state.
 
- Protected Member Functions inherited from QPlainTextEdit
virtual bool event (QEvent *e) override
 
virtual void timerEvent (QTimerEvent *e) override
 
virtual void keyPressEvent (QKeyEvent *e) override
 \reimp
 
virtual void keyReleaseEvent (QKeyEvent *e) override
 \reimp
 
virtual void resizeEvent (QResizeEvent *e) override
 \reimp
 
virtual void paintEvent (QPaintEvent *e) override
 \reimp
 
virtual void mousePressEvent (QMouseEvent *e) override
 \reimp
 
virtual void mouseMoveEvent (QMouseEvent *e) override
 \reimp
 
virtual void mouseReleaseEvent (QMouseEvent *e) override
 \reimp
 
virtual void mouseDoubleClickEvent (QMouseEvent *e) override
 \reimp
 
virtual bool focusNextPrevChild (bool next) override
 \reimp
 
virtual void contextMenuEvent (QContextMenuEvent *e) override
 Shows the standard context menu created with createStandardContextMenu().
 
virtual void focusInEvent (QFocusEvent *e) override
 \reimp
 
virtual void focusOutEvent (QFocusEvent *e) override
 \reimp
 
virtual void showEvent (QShowEvent *) override
 \reimp
 
virtual void changeEvent (QEvent *e) override
 \reimp
 
virtual QMimeDatacreateMimeDataFromSelection () const
 This function returns a new MIME data object to represent the contents of the text edit's current selection.
 
virtual bool canInsertFromMimeData (const QMimeData *source) const
 This function returns true if the contents of the MIME data object, specified by source, can be decoded and inserted into the document.
 
virtual void insertFromMimeData (const QMimeData *source)
 This function inserts the contents of the MIME data object, specified by source, into the text edit at the current cursor position.
 
virtual void inputMethodEvent (QInputMethodEvent *) override
 \reimp
 
 QPlainTextEdit (QPlainTextEditPrivate &dd, QWidget *parent)
 
virtual void scrollContentsBy (int dx, int dy) override
 \reimp
 
virtual void doSetTextCursor (const QTextCursor &cursor)
 
QTextBlock firstVisibleBlock () const
 Returns the first visible block.
 
QPointF contentOffset () const
 Returns the content's origin in viewport coordinates.
 
QRectF blockBoundingRect (const QTextBlock &block) const
 Returns the bounding rectangle of the text block in the block's own coordinates.
 
QRectF blockBoundingGeometry (const QTextBlock &block) const
 Returns the bounding rectangle of the text block in content coordinates.
 
QAbstractTextDocumentLayout::PaintContext getPaintContext () const
 Returns the paint context for the viewport(), useful only when reimplementing paintEvent().
 
void zoomInF (float range)
 
- Properties inherited from QPlainTextEdit
bool tabChangesFocus
 whether \uicontrol Tab changes focus or is accepted as input
 
QString documentTitle
 the title of the document parsed from the text.
 
bool undoRedoEnabled
 whether undo and redo are enabled
 
LineWrapMode lineWrapMode
 the line wrap mode
 
bool readOnly
 whether the text edit is read-only
 
QString plainText
 This property gets and sets the plain text editor's contents.
 
bool overwriteMode
 whether text entered by the user will overwrite existing text
 
qreal tabStopDistance
 the tab stop distance in pixels
 
int cursorWidth
 This property specifies the width of the cursor in pixels.
 
Qt::TextInteractionFlags textInteractionFlags
 Specifies how the label should interact with user input if it displays text.
 
int blockCount
 the number of text blocks in the document.
 
int maximumBlockCount
 the limit for blocks in the document.
 
bool backgroundVisible
 whether the palette background is visible outside the document area
 
bool centerOnScroll
 whether the cursor should be centered on screen
 
QString placeholderText
 the editor placeholder text
 

Detailed Description

Definition at line 13 of file sourcecodeview.h.

Constructor & Destructor Documentation

◆ SourceCodeView()

QT_BEGIN_NAMESPACE SourceCodeView::SourceCodeView ( QWidget * parent = 0)

Definition at line 16 of file sourcecodeview.cpp.

References QObjectData::parent.

Member Function Documentation

◆ setActivated

void SourceCodeView::setActivated ( bool activated)
slot

Definition at line 44 of file sourcecodeview.cpp.

◆ setSourceContext()

void SourceCodeView::setSourceContext ( const QString & fileName,
const int lineNum )

Definition at line 24 of file sourcecodeview.cpp.


The documentation for this class was generated from the following files: