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

jenkinsmain
Last change on this file since c0cec9d was fedf2a2, checked in by Vadim Troshchinskiy Shmelev <vtroshchinskiy@…>, 18 months ago

Update Qtermwidget to Qt6 version
Remove build files

  • Property mode set to 100644
File size: 12.1 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* getForegroundProcessId : int
86* getTerminalFont : QFont
87* historyLinesCount : int
88* icon : const QString
89* keyBindings : QString
90* screenColumnsCount : int
91* selectedText(bool _preserveLineBreaks_ = true) : QString
92* sizeHint : const QSize
93* terminalSizeHint : bool
94* title : const QString
95* workingDirectory : QString
96
97### Public Functions
98Type | Function
99| ---: | :---
100| | QTermWidget(int _startnow_ = 1, QWidget *_parent_ = 0)
101virtual | ~QTermWidget()
102void | changeDir(const QString _&dir_)
103void | getSelectionEnd(int &_row_, int &_column_)
104void | getSelectionStart(int &_row_, int &_column_)
105void | scrollToEnd()
106void | sendText(QString &_text_)
107void | setArgs(QStringList &_args_)
108void | setAutoClose(bool _enabled_)
109void | setColorScheme(const QString &_name_)
110void | setEnvironment(const QStringList &_environment_)
111void | setFlowControlEnabled(bool _enabled_)
112void | setFlowControlWarningEnabled(bool _enabled_)
113void | setHistorySize(int _lines_)
114void | setKeyboardCursorShape(QTermWidget::KeyboardCursorShape _shape_)
115void | setMonitorActivity(bool _enabled_)
116void | setMonitorSilence(bool _enabled_)
117void | setMotionAfterPasting(int _action_)
118void | setScrollBarPosition(QTermWidget::ScrollBarPosition _pos_)
119void | setSelectionEnd(int _row_, int _column_)
120void | setSelectionStart(int _row_, int _column_)
121void | setShellProgram(const QString &_program_)
122void | setSilenceTimeout(int _seconds_)
123void | setTerminalFont(QFont &_font_)
124void | setTerminalOpacity(qreal _level_)
125void | setTerminalSizeHint(bool _enabled_)
126void | setTextCodec(QTextCodec *_codec_)
127void | setWorkingDirectory(const QString &_dir_)
128void | startShellProgram()
129void | startTerminalTeletype()
130QStringList | availableColorSchemes()
131
132### Public Slots
133Type | Function
134| ---: | :---
135void | copyClipboard()
136void | pasteClipboard()
137void | pasteSelection()
138void | zoomIn()
139void | zoomOut()
140void | setSize(_const QSize &_)
141void | setKeyBindings(const QString &_kb_)
142void | clear()
143void | toggleShowSearchBar()
144
145### Signals
146Type | Function
147| ---: | :---
148void | activity()
149void | bell(const QString &_message_)
150void | copyAvailable(bool)
151void | finished()
152void | profileChanged(const QString &_profile_)
153void | receivedData(const QString &_text_)
154void | sendData(const char*, int)
155void | silence()
156void | termGetFocus()
157void | termKeyPressed(QKeyEvent*)
158void | termLostFocus()
159void | titleChanged()
160void | urlActivated(const QUrl &, bool _fromContextMenu_)
161
162### Static Public Members
163Type | Function
164| ---: | :---
165static QStringList | availableColorSchemes()
166static QStringList | availableKeyBindings()
167static void | addCustomColorSchemeDir(const QString &*custom_dir*)
168
169### Protected Functions
170Type | Function
171| ---: | :---
172virtual void | resizeEvent(_QResizeEvent_*)
173
174### Protected Slots
175Type | Function
176| ---: | :---
177void | sessionFinished()
178void | selectionChanged(bool _textSelected_)
179
180### Member Type Documentation
181**enum QTermWidget::ScrollBarPosition**\
182This enum describes the location where the scroll bar is positioned in the display widget when calling QTermWidget::setScrollBarPosition().
183
184Constant | Value | Description
185| --- | :---: | --- |
186QTermWidget::NoScrollBar | 0x0 | Do not show the scroll bar.
187QTermWidget::ScrollBarLeft | 0x1 | Show the scroll bar on the left side of the display.
188QTermWidget::ScrollBarRight | 0x2 | Show the scroll bar on the right side of the display.
189
190\
191**enum QTermWidget::KeyboardCursorShape**\
192This enum describes the available shapes for the keyboard cursor when calling QTermWidget::setKeyboardCursorShape().
193
194Constant | Value | Description
195| --- | :---: | --- |
196QTermWidget::BlockCursor | 0x0 | A rectangular block which covers the entire area of the cursor character.
197QTermWidget::UnderlineCursor | 0x1 | A single flat line which occupies the space at the bottom of the cursor character's area.
198QTermWidget::IBeamCursor | 0x2 | A cursor shaped like the capital letter 'I', similar to the IBeam cursor used in Qt/KDE text editors.
199
200### Property Documentation
201**flowControlEnabled : bool**\
202Returns whether flow control is enabled.
203
204**getPtySlaveFd : const int**\
205Returns a pty slave file descriptor. This can be used for display and control a remote terminal.
206
207<!--**getShellPID : int**\-->
208**getForegroundProcessId : int**\
209Returns the PID of the foreground process. This is initially the same as processId() but can change
210as the user starts other programs inside the terminal. If there is a problem reading the foreground
211process id, 0 will be returned.
212
213<!--**getTerminalFont : QFont**\-->
214
215**historyLinesCount : int**\
216Returns the number of lines in the history buffer.
217
218<!--**icon : const QString**\-->
219
220**keyBindings : QString**\
221Returns current key bindings.
222
223<!--**screenColumnsCount : int**\-->
224
225**selectedText(bool _preserveLineBreaks_ = true) : QString**\
226Returns the currently selected text.
227
228<!--**sizeHint : const QSize**\-->
229<!--**terminalSizeHint : bool**\-->
230<!--**title : const QString**\-->
231<!--**workingDirectory : QString**\-->
232
233### Member Function Documentation
234<!--__void activity()__\-->
235<!--__void bell(const QString &_message_)__\-->
236
237__void changeDir(const QString _&dir_)__\
238Attempt to change shell directory (Linux only).
239
240__void clear()__\
241Clear the terminal content and move to home position.
242
243<!--__void copyAvailable(bool)__\-->
244
245__void copyClipboard()__\
246Copy selection to clipboard.
247
248<!--__void finished()__\-->
249<!--__void getSelectionEnd(int &_row_, int &_column_)__\-->
250<!--__void getSelectionStart(int &_row_, int &_column_)__\-->
251
252__void pasteClipboard()__\
253Paste clipboard to terminal.
254
255__void pasteSelection()__\
256Paste selection to terminal.
257
258<!--__void profileChanged(const QString &_profile_)__\-->
259
260__void receivedData(const QString &_text_)__\
261Signals that we received new data from the process running in the terminal emulator.
262
263__void scrollToEnd()__\
264Wrapped, scroll to end of text.
265
266__void sendData(const char*, int)__\
267Emitted when emulator send data to the terminal process (redirected for external recipient). It can be used for control and display the remote terminal.
268
269__void sendText(QString &_text_)__\
270Send text to terminal.
271
272__void setArgs(QStringList &_args_)__\
273Sets the shell program arguments, default is none.
274
275__void setAutoClose(bool _enabled_)__\
276Automatically close the terminal session after the shell process exits or keep it running.
277
278__void setColorScheme(const QString &_name_)__\
279Sets the color scheme, default is white on black.
280
281__void setEnvironment(const QStringList &_environment_)__\
282Sets environment variables.
283
284__void setFlowControlEnabled(bool _enabled_)__\
285Sets whether flow control is enabled.
286
287__void setFlowControlWarningEnabled(bool _enabled_)__\
288Sets whether the flow control warning box should be shown when the flow control stop key (Ctrl+S) is pressed.
289
290__void setHistorySize(int _lines_)__\
291History size for scrolling.
292
293__void setKeyBindings(const QString &_kb_)__\
294Set named key binding for given widget.
295
296__void setKeyboardCursorShape(QTermWidget::KeyboardCursorShape _shape_)__\
297Sets the shape of the keyboard cursor.  This is the cursor drawn at the position in the terminal where keyboard input will appear.
298
299<!--__void setMonitorActivity(bool _enabled_)__\-->
300<!--__void setMonitorSilence(bool _enabled_)__\-->
301<!--__void setMotionAfterPasting(int _action_)__\-->
302
303__void setScrollBarPosition(QTermWidget::ScrollBarPosition _pos_)__\
304Sets presence and position of scrollbar.
305
306<!--__void setSelectionEnd(int _row_, int _column_)__\-->
307<!--__void setSelectionStart(int _row_, int _column_)__\-->
308
309__void setShellProgram(const QString &_program_)__\
310Sets the shell program, default is /bin/bash.
311
312<!--__void setSilenceTimeout(int _seconds_)__\-->
313<!--__void setSize(_const QSize &_)__\-->
314
315__void setTerminalFont(QFont &_font_)__\
316Sets 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.
317
318<!--__void setTerminalOpacity(qreal _level_)__\-->
319
320__void setTerminalSizeHint(bool _enabled_)__\
321Exposes TerminalDisplay::TerminalSizeHint.
322
323__void setTextCodec(QTextCodec *_codec_)__\
324Sets text codec, default is UTF-8.
325
326<!--__void setWorkingDirectory(const QString &_dir_)__\-->
327<!--__void silence()__\-->
328
329__void startShellProgram()__\
330Starts shell program if it was not started in constructor.
331
332__void startTerminalTeletype()__\
333Starts terminal teletype as is and redirect data for external recipient. It can be used for display and control a remote terminal.
334
335<!--__void termGetFocus()__\-->
336<!--__void termKeyPressed(QKeyEvent*)__\-->
337<!--__void termLostFocus()__\-->
338<!--__void titleChanged()__\-->
339<!--__void toggleShowSearchBar()__\-->
340<!--__void urlActivated(const QUrl &, bool _fromContextMenu_)__\-->
341
342__void zoomIn()__\
343Zooms in on the text.
344
345__void zoomOut()__\
346Zooms out in on the text.
Note: See TracBrowser for help on using the repository browser.