- Extending Qt Creator Manual
- QtCreator
- FancyLineEdit
- Extending Qt Creator Manual 18.0.0-rc1

# Utils::FancyLineEdit Class

class Utils::FancyLineEdit

The FancyLineEdit class is an enhanced line edit with several opt-in features. More...

Header: | `#include <FancyLineEdit>`
Inherits: | Utils::CompletingLineEdit
Inherited By: | Utils::ClassNameValidatingLineEdit and Utils::FileNameValidatingLineEdit

- List of all members, including inherited members

## Public Functions

void | setValidationFunction(const Utils::FancyLineEdit::ValidationFunction &fn)

## Static Public Members

Utils::FancyLineEdit::ValidationFunction | defaultValidationFunction()

## Detailed Description

A FancyLineEdit instance can have:

- An embedded pixmap on one side that is connected to a menu.
- A grayed hintText (like "Type Here to") when not focused and empty. When connecting to the changed signals and querying text, one has to be aware that the text is set to that hint text if isShowingHintText() returns true (that is, does not contain valid user input).
- A history completer.
- The ability to validate the contents of the text field by setting the validationFunction.

When invalid, the text color will turn red and a tooltip will contain the error message. This approach is less intrusive than a QValidator which will prevent the user from entering certain characters.

A visible hint text results validation to be in state 'DisplayingInitialText', which is not valid, but is not marked red.

## Member Function Documentation

### `[static]` Utils::FancyLineEdit::ValidationFunction FancyLineEdit::defaultValidationFunction()

Returns the default validation function, which synchonously executes the line edit's validator.

See also setValidationFunction().

### void FancyLineEdit::setValidationFunction(const Utils::FancyLineEdit::ValidationFunction &fn)

Set a synchronous or asynchronous validation function fn. Asynchronous validation functions can continue to run after destruction of the FancyLineEdit instance. During shutdown asynchronous validation functions can continue to run until before the plugin instances are deleted (at that point the plugin manager waits for them to finish before continuing).

See also defaultValidationFunction().