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

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 overriding virtual validate() function in derived clases.

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.