Konsole::ScreenWindow

Search for usage in LXR

Konsole::ScreenWindow Class Reference

#include <ScreenWindow.h>

Inheritance diagram for Konsole::ScreenWindow:

Public Types

enum  RelativeScrollMode { ScrollLines , ScrollPages }
 
- Public Types inherited from QObject
typedef  QObjectList
 

Signals

void outputChanged ()
 
void scrolled (int line)
 
void scrollToEnd ()
 
void selectionChanged ()
 

Public Slots

void handleCommandFromKeyboard (KeyboardTranslator::Command command)
 
void notifyOutputChanged ()
 

Public Member Functions

 ScreenWindow (QObject *parent=nullptr)
 
bool atEndOfOutput () const
 
void clearSelection ()
 
int columnCount () const
 
int currentLine () const
 
QPoint cursorPosition () const
 
std::span< CharactergetImage ()
 
QVector< LineProperty > getLineProperties ()
 
void getSelectionEnd (int &column, int &line)
 
void getSelectionStart (int &column, int &line)
 
bool isSelected (int column, int line)
 
int lineCount () const
 
void resetScrollCount ()
 
Screenscreen () const
 
void scrollBy (RelativeScrollMode mode, int amount)
 
int scrollCount () const
 
QRect scrollRegion () const
 
void scrollTo (int line)
 
QString selectedText (bool preserveLineBreaks) const
 
void setScreen (Screen *screen)
 
void setSelectionEnd (int column, int line)
 
void setSelectionStart (int column, int line, bool columnMode)
 
void setTrackOutput (bool trackOutput)
 
void setWindowLines (int lines)
 
bool trackOutput () const
 
int windowColumns () const
 
int windowLines () const
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
QBindable< QStringbindableObjectName ()
 
bool blockSignals (bool block)
 
const QObjectListchildren () const const
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method) const const
 
bool disconnect (const QObject *receiver, const char *method) const const
 
void dumpObjectInfo () const const
 
void dumpObjectTree () const const
 
QList< QByteArraydynamicPropertyNames () const const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
findChild (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (Qt::FindChildOptions options) const const
 
bool inherits (const char *className) const const
 
void installEventFilter (QObject *filterObj)
 
bool isQuickItemType () const const
 
bool isWidgetType () const const
 
bool isWindowType () const const
 
void killTimer (int id)
 
virtual const QMetaObjectmetaObject () const const
 
void moveToThread (QThread *targetThread)
 
QString objectName () const const
 
void objectNameChanged (const QString &objectName)
 
QObjectparent () const const
 
QVariant property (const char *name) const const
 
 Q_CLASSINFO (Name, Value)
 
 Q_EMIT Q_EMIT
 
 Q_ENUM (...)
 
 Q_ENUM_NS (...)
 
 Q_ENUMS (...)
 
 Q_FLAG (...)
 
 Q_FLAG_NS (...)
 
 Q_FLAGS (...)
 
 Q_GADGET Q_GADGET
 
 Q_GADGET_EXPORT (EXPORT_MACRO)
 
 Q_INTERFACES (...)
 
 Q_INVOKABLE Q_INVOKABLE
 
 Q_MOC_INCLUDE Q_MOC_INCLUDE
 
 Q_NAMESPACE Q_NAMESPACE
 
 Q_NAMESPACE_EXPORT (EXPORT_MACRO)
 
 Q_OBJECT Q_OBJECT
 
 Q_PROPERTY (...)
 
 Q_REVISION Q_REVISION
 
 Q_SET_OBJECT_NAME (Object)
 
 Q_SIGNAL Q_SIGNAL
 
 Q_SIGNALS Q_SIGNALS
 
 Q_SLOT Q_SLOT
 
 Q_SLOTS Q_SLOTS
 
qobject_cast (const QObject *object)
 
qobject_cast (QObject *object)
 
 QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
 
void removeEventFilter (QObject *obj)
 
void setObjectName (const QString &name)
 
void setObjectName (QAnyStringView name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool setProperty (const char *name, QVariant &&value)
 
bool signalsBlocked () const const
 
int startTimer (int interval, Qt::TimerType timerType)
 
int startTimer (std::chrono::milliseconds interval, Qt::TimerType timerType)
 
QThreadthread () const const
 

Additional Inherited Members

- Properties inherited from QObject
 objectName
 
- Static Public Member Functions inherited from QObject
QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, Functor functor)
 
bool disconnect (const QMetaObject::Connection &connection)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
bool disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
- Protected Member Functions inherited from QObject
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 
bool isSignalConnected (const QMetaMethod &signal) const const
 
int receivers (const char *signal) const const
 
QObjectsender () const const
 
int senderSignalIndex () const const
 
virtual void timerEvent (QTimerEvent *event)
 

Detailed Description

Provides a window onto a section of a terminal screen.

A terminal widget can then render the contents of the window and use the window to change the terminal screen's selection in response to mouse or keyboard input.

A new ScreenWindow for a terminal session can be created by calling Emulation::createWindow()

Use the scrollTo() method to scroll the window up and down on the screen. Use the getImage() method to retrieve the character image which is currently visible in the window.

setTrackOutput() controls whether the window moves to the bottom of the associated screen when new lines are added to it.

Whenever the output from the underlying screen is changed, the notifyOutputChanged() slot should be called. This in turn will update the window's position and Q_EMIT the outputChanged() signal if necessary.

Definition at line 51 of file ScreenWindow.h.

Member Enumeration Documentation

◆ RelativeScrollMode

Describes the units which scrollBy() moves the window by.

Enumerator
ScrollLines 

Scroll the window down by a given number of lines.

ScrollPages 

Scroll the window down by a given number of pages, where one page is windowLines() lines.

Definition at line 173 of file ScreenWindow.h.

Constructor & Destructor Documentation

◆ ScreenWindow()

ScreenWindow::ScreenWindow ( QObject * parent = nullptr)

Constructs a new screen window with the given parent.

A screen must be specified by calling setScreen() before calling getImage() or getLineProperties().

You should not call this constructor directly, instead use the Emulation::createWindow() method to create a window on the emulation which you wish to view. This allows the emulation to notify the window when the associated screen has changed and synchronize selection updates between all views on a session.

Definition at line 28 of file ScreenWindow.cpp.

Member Function Documentation

◆ atEndOfOutput()

bool ScreenWindow::atEndOfOutput ( ) const

Convenience method.

Returns true if the window is currently at the bottom of the screen.

Definition at line 208 of file ScreenWindow.cpp.

◆ clearSelection()

void ScreenWindow::clearSelection ( )

Clears the current selection.

Definition at line 152 of file ScreenWindow.cpp.

◆ columnCount()

int ScreenWindow::columnCount ( ) const

Returns the total number of columns in the screen.

Definition at line 179 of file ScreenWindow.cpp.

◆ currentLine()

int ScreenWindow::currentLine ( ) const

Returns the index of the line which is currently at the top of this window.

Definition at line 194 of file ScreenWindow.cpp.

◆ cursorPosition()

QPoint ScreenWindow::cursorPosition ( ) const

Returns the position of the cursor within the window.

Definition at line 184 of file ScreenWindow.cpp.

◆ getImage()

std::span< Character > ScreenWindow::getImage ( )

Returns the image of characters which are currently visible through this window onto the screen.

The returned buffer is managed by the ScreenWindow instance and does not need to be deleted by the caller.

Definition at line 53 of file ScreenWindow.cpp.

◆ getLineProperties()

QVector< LineProperty > ScreenWindow::getLineProperties ( )

Returns the line attributes associated with the lines of characters which are currently visible through this window.

Definition at line 106 of file ScreenWindow.cpp.

◆ getSelectionEnd()

void ScreenWindow::getSelectionEnd ( int & column,
int & line )

Retrieves the end of the selection within the window.

Definition at line 126 of file ScreenWindow.cpp.

◆ getSelectionStart()

void ScreenWindow::getSelectionStart ( int & column,
int & line )

Retrieves the start of the selection within the window.

Definition at line 121 of file ScreenWindow.cpp.

◆ handleCommandFromKeyboard

void ScreenWindow::handleCommandFromKeyboard ( KeyboardTranslator::Command command)
slot

Definition at line 285 of file ScreenWindow.cpp.

◆ isSelected()

bool ScreenWindow::isSelected ( int column,
int line )

Returns true if the character at line , column is part of the selection.

Definition at line 147 of file ScreenWindow.cpp.

◆ lineCount()

int ScreenWindow::lineCount ( ) const

Returns the total number of lines in the screen.

Definition at line 174 of file ScreenWindow.cpp.

◆ notifyOutputChanged

void ScreenWindow::notifyOutputChanged ( )
slot

Notifies the window that the contents of the associated terminal screen have changed.

This moves the window to the bottom of the screen if trackOutput() is true and causes the outputChanged() signal to be emitted.

Definition at line 260 of file ScreenWindow.cpp.

◆ outputChanged

void Konsole::ScreenWindow::outputChanged ( )
signal

Emitted when the contents of the associated terminal screen (see screen()) changes.

◆ resetScrollCount()

void ScreenWindow::resetScrollCount ( )

Resets the count of scrolled lines returned by scrollCount()

Definition at line 245 of file ScreenWindow.cpp.

◆ screen()

Screen * ScreenWindow::screen ( ) const

Returns the screen which this window looks onto.

Definition at line 48 of file ScreenWindow.cpp.

◆ scrollBy()

void ScreenWindow::scrollBy ( RelativeScrollMode mode,
int amount )

Scrolls the window relative to its current position on the screen.

Parameters
modeSpecifies whether amount refers to the number of lines or the number of pages to scroll.
amountThe number of lines or pages ( depending on mode ) to scroll by. If this number is positive, the view is scrolled down. If this number is negative, the view is scrolled up.

Definition at line 199 of file ScreenWindow.cpp.

◆ scrollCount()

int ScreenWindow::scrollCount ( ) const

Returns the number of lines which the region of the window specified by scrollRegion() has been scrolled by since the last call to resetScrollCount().

scrollRegion() is in most cases the whole window, but will be a smaller area in, for example, applications which provide split-screen facilities.

This is not guaranteed to be accurate, but allows views to optimize rendering by reducing the amount of costly text rendering that needs to be done when the output is scrolled.

Definition at line 240 of file ScreenWindow.cpp.

◆ scrolled

void Konsole::ScreenWindow::scrolled ( int line)
signal

Emitted when the screen window is scrolled to a different position.

Parameters
lineThe line which is now at the top of the window.

◆ scrollRegion()

QRect ScreenWindow::scrollRegion ( ) const

Returns the area of the window which was last scrolled, this is usually the whole window area.

Like scrollCount(), this is not guaranteed to be accurate, but allows views to optimize rendering.

Definition at line 250 of file ScreenWindow.cpp.

◆ scrollTo()

void ScreenWindow::scrollTo ( int line)

Scrolls the window so that line is at the top of the window.

Definition at line 213 of file ScreenWindow.cpp.

◆ selectedText()

QString ScreenWindow::selectedText ( bool preserveLineBreaks) const

Returns the text which is currently selected.

Parameters
preserveLineBreaksSee Screen::selectedText()

Definition at line 116 of file ScreenWindow.cpp.

◆ selectionChanged

void Konsole::ScreenWindow::selectionChanged ( )
signal

Emitted when the selection is changed.

◆ setScreen()

void ScreenWindow::setScreen ( Screen * screen)

Sets the screen which this window looks onto.

Definition at line 41 of file ScreenWindow.cpp.

◆ setSelectionEnd()

void ScreenWindow::setSelectionEnd ( int column,
int line )

Sets the end of the selection to the given line and column within the window.

Definition at line 139 of file ScreenWindow.cpp.

◆ setSelectionStart()

void ScreenWindow::setSelectionStart ( int column,
int line,
bool columnMode )

Sets the start of the selection to the given line and column within the window.

Definition at line 131 of file ScreenWindow.cpp.

◆ setTrackOutput()

void ScreenWindow::setTrackOutput ( bool trackOutput)

Specifies whether the window should automatically move to the bottom of the screen when new output is added.

If this is set to true, the window will be moved to the bottom of the associated screen ( see screen() ) when the notifyOutputChanged() method is called.

Definition at line 230 of file ScreenWindow.cpp.

◆ setWindowLines()

void ScreenWindow::setWindowLines ( int lines)

Sets the number of lines in the window.

Definition at line 159 of file ScreenWindow.cpp.

◆ trackOutput()

bool ScreenWindow::trackOutput ( ) const

Returns whether the window automatically moves to the bottom of the screen as new output is added.

See setTrackOutput()

Definition at line 235 of file ScreenWindow.cpp.

◆ windowColumns()

int ScreenWindow::windowColumns ( ) const

Returns the number of columns in the window.

Definition at line 169 of file ScreenWindow.cpp.

◆ windowLines()

int ScreenWindow::windowLines ( ) const

Returns the number of lines in the window.

Definition at line 164 of file ScreenWindow.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 20 2024 11:55:13 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.