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 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.

© 2023 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.