QCA::ConsolePrompt Class Reference
QCA user API

`#include <QtCrypto>`

Collaboration diagram for QCA::ConsolePrompt:
[legend]

## Signals

void | finished ()

## Public Member Functions

| ConsolePrompt (QObject *parent=nullptr)
void | getChar ()
void | getHidden (const QString &promptStr)
SecureArray | result () const
QChar | resultChar () const
void | waitForFinished ()

## Friends

class | Private

## Detailed Description

Console prompt handler.

This class provides a convenient way to get user input in a secure way, as shown below:

QCA::ConsolePrompt prompt;
prompt.getHidden("Passphrase");
prompt.waitForFinished();
QCA:SecureArray pass = prompt.result();
QCA::ConsolePrompt
Console prompt handler.
Definition qca_support.h:864
QCA::ConsolePrompt::waitForFinished
void waitForFinished()
Block waiting for user input.
QCA::ConsolePrompt::getHidden
void getHidden(const QString &promptStr)
Allow the user to enter data without it being echo'd to the terminal.
QCA::ConsolePrompt::result
SecureArray result() const
Obtain the result of the user input.
QCA::SecureArray
Secure array of bytes.
Definition qca_tools.h:317
QCA
QCA - the Qt Cryptographic Architecture.
Definition qca_basic.h:41

Note
  It is not necessary to use waitForFinished(), because you can just connect the finished() signal to a suitable method, however command line (console) applications often require waitForFinished().

Examples
  keyloader.cpp.

## Constructor & Destructor Documentation

## ConsolePrompt()

QCA::ConsolePrompt::ConsolePrompt | ( | QObject * | parent = nullptr | ) |

Standard constructor.

Parameters

  parent | the parent object for this object

References ConsolePrompt().

Referenced by ConsolePrompt(), and finished().

## Member Function Documentation

## getHidden()

void QCA::ConsolePrompt::getHidden | ( | const QString & | promptStr | ) |

Allow the user to enter data without it being echo'd to the terminal.

This is particularly useful for entry of passwords, passphrases and PINs.

Parameters

  promptStr | the prompt to display to the user

See also
  result() for how to get the input back.

Examples
  keyloader.cpp, and saslclient.cpp.

## getChar()

void QCA::ConsolePrompt::getChar | ( |  | ) |

Obtain one character from the user.

See also
  resultChar() for how to get the input back.

## waitForFinished()

void QCA::ConsolePrompt::waitForFinished | ( |  | ) |

Block waiting for user input.

You may wish to use the finished() signal to avoid blocking.

Examples
  keyloader.cpp, and saslclient.cpp.

## result()

SecureArray QCA::ConsolePrompt::result | ( |  | ) | const

Obtain the result of the user input.

This method is usually called to obtain data from the user that was requested by the getHidden() call.

Examples
  keyloader.cpp, and saslclient.cpp.

## resultChar()

QChar QCA::ConsolePrompt::resultChar | ( |  | ) | const

Obtain the result of the user input.

This method is usually called to obtain data from the user that was requested by the getChar() call.

## finished

void QCA::ConsolePrompt::finished | ( |  | ) |

signal

Emitted when the user input activity has been completed.

This corresponds to the provision of a string for getHidden() or a single character for getChar().

See also
  waitForFinished

References ConsolePrompt().

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

- qca_support.h