|
| KPtyDevice (QObject *parent=nullptr) |
| Constructor.
|
|
| ~KPtyDevice () override |
| Destructor:
|
|
bool | atEnd () const override |
|
qint64 | bytesAvailable () const override |
|
qint64 | bytesToWrite () const override |
|
bool | canReadLine () const override |
|
void | close () override |
| Close the pty master/slave pair.
|
|
bool | isSequential () const override |
|
bool | isSuspended () const |
| Returns true if the KPtyDevice is not monitoring the pty for incoming data.
|
|
bool | open (int fd, OpenMode mode=ReadWrite|Unbuffered) |
| Open using an existing pty master.
|
|
bool | open (OpenMode mode=ReadWrite|Unbuffered) override |
| Create a pty master/slave pair.
|
|
void | setSuspended (bool suspended) |
| Sets whether the KPtyDevice monitors the pty for incoming data.
|
|
bool | waitForBytesWritten (int msecs=-1) override |
|
bool | waitForReadyRead (int msecs=-1) override |
|
| KPty () |
| Constructor.
|
|
| KPty (const KPty &)=delete |
|
| ~KPty () |
| Destructor:
|
|
void | close () |
| Close the pty master/slave pair.
|
|
void | closeSlave () |
| Close the pty slave descriptor.
|
|
void | login (const char *user=nullptr, const char *remotehost=nullptr) |
| Creates an utmp entry for the tty.
|
|
void | logout () |
| Removes the utmp entry for this tty.
|
|
int | masterFd () const |
|
bool | open () |
| Create a pty master/slave pair.
|
|
bool | open (int fd) |
| Open using an existing pty master.
|
|
bool | openSlave () |
| Open the pty slave descriptor.
|
|
KPty & | operator= (const KPty &)=delete |
|
void | setCTty () |
| Creates a new session and process group and makes this pty the controlling tty.
|
|
void | setCTtyEnabled (bool enable) |
| Whether this will be a controlling terminal.
|
|
bool | setEcho (bool echo) |
| Set whether the pty should echo input.
|
|
bool | setWinSize (int lines, int columns) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Change the logical (screen) size of the pty.
|
|
bool | setWinSize (int lines, int columns, int height, int width) |
| Change the logical (screen) size of the pty.
|
|
int | slaveFd () const |
|
bool | tcGetAttr (struct ::termios *ttmode) const |
| Wrapper around tcgetattr(3).
|
|
bool | tcSetAttr (struct ::termios *ttmode) |
| Wrapper around tcsetattr(3) with mode TCSANOW.
|
|
const char * | ttyName () const |
|
Encapsulates KPty into a QIODevice, so it can be used with Q*Stream, etc.
bool KPtyDevice::open |
( |
int |
fd, |
|
|
OpenMode |
mode = ReadWrite|Unbuffered |
|
) |
| |
Open using an existing pty master.
The ownership of the fd remains with the caller, i.e., close() will not close the fd.
This is useful if you wish to attach a secondary "controller" to an existing pty device such as a terminal widget. Note that you will need to use setSuspended() on both devices to control which one gets the incoming data from the pty.
- Parameters
-
fd | an open pty master file descriptor. |
mode | the device mode to open the pty with. |
- Returns
- true if a pty pair was successfully opened
void KPtyDevice::setSuspended |
( |
bool |
suspended | ) |
|
Sets whether the KPtyDevice monitors the pty for incoming data.
When the KPtyDevice is suspended, it will no longer attempt to buffer data that becomes available from the pty and it will not emit any signals.
Do not use on closed ptys. After a call to open(), the pty is not suspended. If you need to ensure that no data is read, call this function before the main loop is entered again (i.e., immediately after opening the pty).