source: ogBrowser-Git/qtermwidget/README.md @ ffbf8ac

jenkinsmain
Last change on this file since ffbf8ac was 64efc22, checked in by Vadim Troshchinskiy <vtroshchinskiy@…>, 19 months ago

Update qtermwidget to modern version

  • Property mode set to 100644
File size: 11.8 KB
Line 
1# QTermWidget
2
3## Overview
4
5A terminal emulator widget for Qt 5.
6
7QTermWidget is an open-source project originally based on the KDE4 Konsole application, but it took its own direction later on.
8The main goal of this project is to provide a Unicode-enabled, embeddable Qt widget for using as a built-in console (or terminal emulation widget).
9
10It is compatible with BSD, Linux and OS X.
11
12This project is licensed under the terms of the [GPLv2](https://www.gnu.org/licenses/gpl-2.0.en.html) or any later version. See the LICENSE file for the full text of the license. Some files are published under compatible licenses:
13```
14Files: example/main.cpp
15       lib/TerminalCharacterDecoder.cpp
16       lib/TerminalCharacterDecoder.h
17       lib/kprocess.cpp
18       lib/kprocess.h
19       lib/kpty.cpp
20       lib/kpty.h
21       lib/kpty_p.h
22       lib/kptydevice.cpp
23       lib/kptydevice.h
24       lib/kptyprocess.cpp
25       lib/kptyprocess.h
26       lib/qtermwidget.cpp
27       lib/qtermwidget.h
28       lib/qtermwidget_interface.h
29Copyright: Author Adriaan de Groot <groot@kde.org>
30           2010, KDE e.V <kde-ev-board@kde.org>
31           2002-2007, Oswald Buddenhagen <ossi@kde.org>
32           2006-2008, Robert Knight <robertknight@gmail.com>
33           2002, Waldo Bastian <bastian@kde.org>
34           2008, e_k <e_k@users.sourceforge.net>
35           2022, Francesc Martinez <info@francescmm.com>
36License: LGPL-2+
37
38Files: cmake/FindUtf8Proc.cmake
39Copyright: 2009-2011, Kitware, Inc
40           2009-2011, Philip Lowman <philip@yhbt.com>
41License: BSD-3-clause
42```
43
44## Installation
45
46### Compiling sources
47
48The only runtime dependency is qtbase ≥ 5.12.0.
49Build dependencies are as follows:
50- CMake ≥ 3.1.0 serves as the build system and therefore needs to be present to compile.
51- The latest [lxqt-build-tools](https://github.com/lxqt/lxqt-build-tools/) is also needed for compilation.
52- Git is needed to optionally pull latest VCS checkouts.
53
54Code configuration is handled by CMake. CMake variable `CMAKE_INSTALL_PREFIX` will normally have to be set to `/usr`, depending on the way library paths are dealt with on 64bit systems. Variables like `CMAKE_INSTALL_LIBDIR` may have to be set as well.
55
56To build, run `make`. To install, run `make install` which accepts variable `DESTDIR` as usual.
57
58To build PyQt bindings, build this library first, and then invoke `sip-wheel` in pyqt/ directory. Environment variables `CXXFLAGS` and `LDFLAGS` can be used to specify non-installed or non-standard directories for headers and shared libraries, and the built Python wheel can be installed by standard tools like `pip`. See [the CI script](.ci/build.sh) for a complete example.
59
60### Binary packages
61
62The library is provided by all major Linux distributions. This includes Arch Linux, Debian, Fedora, openSUSE and all of their children, given they use the same package repositories.
63Just use the distributions' package managers to search for string `qtermwidget`.
64
65
66### Translation
67
68Translations can be done in [LXQt-Weblate](https://translate.lxqt-project.org/projects/lxqt-desktop/qtermwidget/)
69
70<a href="https://translate.lxqt-project.org/projects/lxqt-desktop/qtermwidget/">
71<img src="https://translate.lxqt-project.org/widgets/lxqt-desktop/-/qtermwidget/multi-auto.svg" alt="Translation status" />
72</a>
73
74## API
75### Public Types
76Type | Variable
77| ---: | :---
78enum | ScrollBarPosition { NoScrollBar, ScrollBarLeft, ScrollBarRight }
79enum | KeyboardCursorShape { BlockCursor, UnderlineCursor, IBeamCursor }
80
81### Properties
82* flowControlEnabled : bool
83* getPtySlaveFd : const int
84* getShellPID : int
85* getTerminalFont : QFont
86* historyLinesCount : int
87* icon : const QString
88* keyBindings : QString
89* screenColumnsCount : int
90* selectedText(bool _preserveLineBreaks_ = true) : QString
91* sizeHint : const QSize
92* terminalSizeHint : bool
93* title : const QString
94* workingDirectory : QString
95
96### Public Functions
97Type | Function
98| ---: | :---
99| | QTermWidget(int _startnow_ = 1, QWidget *_parent_ = 0)
100virtual | ~QTermWidget()
101void | changeDir(const QString _&dir_)
102void | getSelectionEnd(int &_row_, int &_column_)
103void | getSelectionStart(int &_row_, int &_column_)
104void | scrollToEnd()
105void | sendText(QString &_text_)
106void | setArgs(QStringList &_args_)
107void | setAutoClose(bool _enabled_)
108void | setColorScheme(const QString &_name_)
109void | setEnvironment(const QStringList &_environment_)
110void | setFlowControlEnabled(bool _enabled_)
111void | setFlowControlWarningEnabled(bool _enabled_)
112void | setHistorySize(int _lines_)
113void | setKeyboardCursorShape(QTermWidget::KeyboardCursorShape _shape_)
114void | setMonitorActivity(bool _enabled_)
115void | setMonitorSilence(bool _enabled_)
116void | setMotionAfterPasting(int _action_)
117void | setScrollBarPosition(QTermWidget::ScrollBarPosition _pos_)
118void | setSelectionEnd(int _row_, int _column_)
119void | setSelectionStart(int _row_, int _column_)
120void | setShellProgram(const QString &_program_)
121void | setSilenceTimeout(int _seconds_)
122void | setTerminalFont(QFont &_font_)
123void | setTerminalOpacity(qreal _level_)
124void | setTerminalSizeHint(bool _enabled_)
125void | setTextCodec(QTextCodec *_codec_)
126void | setWorkingDirectory(const QString &_dir_)
127void | startShellProgram()
128void | startTerminalTeletype()
129QStringList | availableColorSchemes()
130
131### Public Slots
132Type | Function
133| ---: | :---
134void | copyClipboard()
135void | pasteClipboard()
136void | pasteSelection()
137void | zoomIn()
138void | zoomOut()
139void | setSize(_const QSize &_)
140void | setKeyBindings(const QString &_kb_)
141void | clear()
142void | toggleShowSearchBar()
143
144### Signals
145Type | Function
146| ---: | :---
147void | activity()
148void | bell(const QString &_message_)
149void | copyAvailable(bool)
150void | finished()
151void | profileChanged(const QString &_profile_)
152void | receivedData(const QString &_text_)
153void | sendData(const char*, int)
154void | silence()
155void | termGetFocus()
156void | termKeyPressed(QKeyEvent*)
157void | termLostFocus()
158void | titleChanged()
159void | urlActivated(const QUrl &, bool _fromContextMenu_)
160
161### Static Public Members
162Type | Function
163| ---: | :---
164static QStringList | availableColorSchemes()
165static QStringList | availableKeyBindings()
166static void | addCustomColorSchemeDir(const QString &*custom_dir*)
167
168### Protected Functions
169Type | Function
170| ---: | :---
171virtual void | resizeEvent(_QResizeEvent_*)
172
173### Protected Slots
174Type | Function
175| ---: | :---
176void | sessionFinished()
177void | selectionChanged(bool _textSelected_)
178
179### Member Type Documentation
180**enum QTermWidget::ScrollBarPosition**\
181This enum describes the location where the scroll bar is positioned in the display widget when calling QTermWidget::setScrollBarPosition().
182
183Constant | Value | Description
184| --- | :---: | --- |
185QTermWidget::NoScrollBar | 0x0 | Do not show the scroll bar.
186QTermWidget::ScrollBarLeft | 0x1 | Show the scroll bar on the left side of the display.
187QTermWidget::ScrollBarRight | 0x2 | Show the scroll bar on the right side of the display.
188
189\
190**enum QTermWidget::KeyboardCursorShape**\
191This enum describes the available shapes for the keyboard cursor when calling QTermWidget::setKeyboardCursorShape().
192
193Constant | Value | Description
194| --- | :---: | --- |
195QTermWidget::BlockCursor | 0x0 | A rectangular block which covers the entire area of the cursor character.
196QTermWidget::UnderlineCursor | 0x1 | A single flat line which occupies the space at the bottom of the cursor character's area.
197QTermWidget::IBeamCursor | 0x2 | A cursor shaped like the capital letter 'I', similar to the IBeam cursor used in Qt/KDE text editors.
198
199### Property Documentation
200**flowControlEnabled : bool**\
201Returns whether flow control is enabled.
202
203**getPtySlaveFd : const int**\
204Returns a pty slave file descriptor. This can be used for display and control a remote terminal.
205
206<!--**getShellPID : int**\-->
207<!--**getTerminalFont : QFont**\-->
208
209**historyLinesCount : int**\
210Returns the number of lines in the history buffer.
211
212<!--**icon : const QString**\-->
213
214**keyBindings : QString**\
215Returns current key bindings.
216
217<!--**screenColumnsCount : int**\-->
218
219**selectedText(bool _preserveLineBreaks_ = true) : QString**\
220Returns the currently selected text.
221
222<!--**sizeHint : const QSize**\-->
223<!--**terminalSizeHint : bool**\-->
224<!--**title : const QString**\-->
225<!--**workingDirectory : QString**\-->
226
227### Member Function Documentation
228<!--__void activity()__\-->
229<!--__void bell(const QString &_message_)__\-->
230
231__void changeDir(const QString _&dir_)__\
232Attempt to change shell directory (Linux only).
233
234__void clear()__\
235Clear the terminal content and move to home position.
236
237<!--__void copyAvailable(bool)__\-->
238
239__void copyClipboard()__\
240Copy selection to clipboard.
241
242<!--__void finished()__\-->
243<!--__void getSelectionEnd(int &_row_, int &_column_)__\-->
244<!--__void getSelectionStart(int &_row_, int &_column_)__\-->
245
246__void pasteClipboard()__\
247Paste clipboard to terminal.
248
249__void pasteSelection()__\
250Paste selection to terminal.
251
252<!--__void profileChanged(const QString &_profile_)__\-->
253
254__void receivedData(const QString &_text_)__\
255Signals that we received new data from the process running in the terminal emulator.
256
257__void scrollToEnd()__\
258Wrapped, scroll to end of text.
259
260__void sendData(const char*, int)__\
261Emitted when emulator send data to the terminal process (redirected for external recipient). It can be used for control and display the remote terminal.
262
263__void sendText(QString &_text_)__\
264Send text to terminal.
265
266__void setArgs(QStringList &_args_)__\
267Sets the shell program arguments, default is none.
268
269__void setAutoClose(bool _enabled_)__\
270Automatically close the terminal session after the shell process exits or keep it running.
271
272__void setColorScheme(const QString &_name_)__\
273Sets the color scheme, default is white on black.
274
275__void setEnvironment(const QStringList &_environment_)__\
276Sets environment variables.
277
278__void setFlowControlEnabled(bool _enabled_)__\
279Sets whether flow control is enabled.
280
281__void setFlowControlWarningEnabled(bool _enabled_)__\
282Sets whether the flow control warning box should be shown when the flow control stop key (Ctrl+S) is pressed.
283
284__void setHistorySize(int _lines_)__\
285History size for scrolling.
286
287__void setKeyBindings(const QString &_kb_)__\
288Set named key binding for given widget.
289
290__void setKeyboardCursorShape(QTermWidget::KeyboardCursorShape _shape_)__\
291Sets the shape of the keyboard cursor.  This is the cursor drawn at the position in the terminal where keyboard input will appear.
292
293<!--__void setMonitorActivity(bool _enabled_)__\-->
294<!--__void setMonitorSilence(bool _enabled_)__\-->
295<!--__void setMotionAfterPasting(int _action_)__\-->
296
297__void setScrollBarPosition(QTermWidget::ScrollBarPosition _pos_)__\
298Sets presence and position of scrollbar.
299
300<!--__void setSelectionEnd(int _row_, int _column_)__\-->
301<!--__void setSelectionStart(int _row_, int _column_)__\-->
302
303__void setShellProgram(const QString &_program_)__\
304Sets the shell program, default is /bin/bash.
305
306<!--__void setSilenceTimeout(int _seconds_)__\-->
307<!--__void setSize(_const QSize &_)__\-->
308
309__void setTerminalFont(QFont &_font_)__\
310Sets terminal font. Default is application font with family Monospace, size 10. Beware of a performance penalty and display/alignment issues when using a proportional font.
311
312<!--__void setTerminalOpacity(qreal _level_)__\-->
313
314__void setTerminalSizeHint(bool _enabled_)__\
315Exposes TerminalDisplay::TerminalSizeHint.
316
317__void setTextCodec(QTextCodec *_codec_)__\
318Sets text codec, default is UTF-8.
319
320<!--__void setWorkingDirectory(const QString &_dir_)__\-->
321<!--__void silence()__\-->
322
323__void startShellProgram()__\
324Starts shell program if it was not started in constructor.
325
326__void startTerminalTeletype()__\
327Starts terminal teletype as is and redirect data for external recipient. It can be used for display and control a remote terminal.
328
329<!--__void termGetFocus()__\-->
330<!--__void termKeyPressed(QKeyEvent*)__\-->
331<!--__void termLostFocus()__\-->
332<!--__void titleChanged()__\-->
333<!--__void toggleShowSearchBar()__\-->
334<!--__void urlActivated(const QUrl &, bool _fromContextMenu_)__\-->
335
336__void zoomIn()__\
337Zooms in on the text.
338
339__void zoomOut()__\
340Zooms out in on the text.
Note: See TracBrowser for help on using the repository browser.