Issue #173: QLineEdit with clear button. (dismine/valentina)

New issue 173: QLineEdit with clear button. https://bitbucket.org/valentinateam/valentina/issue/173/qlineedit-with-clear-button

Roman Telezhinskyi:

I want to add nice looking QLineEdit with clear button. For this we can use code from Qt creator itself.

Utils::FancyLineEdit

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

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 see validate() function in derived clasess.

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.

Where to get code?
fancylineedit.h
fancylineedit.cpp
completinglineedit.h
completinglineedit.cpp

Because this code under General Public License version 2.1 better to add code into library VPropertyBrowser.

In result we will replace pure QLineEdit everywhere. And even in dialogs. See widget promotion in Qt Designer or ask me. :slight_smile: