Get rid of FancyLineEdit::validate

Use aggregation instead of inheritance for customization of validation.
Gets rid of a few additional classes.

Change-Id: Iaf8f12026c40a55bfde98b3786100f8ac431d750
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
This commit is contained in:
Eike Ziller
2015-04-28 14:49:56 +02:00
parent e8862cd21f
commit 3fc7222062
24 changed files with 148 additions and 373 deletions

View File

@@ -54,21 +54,6 @@ using namespace Utils;
namespace Core {
namespace Internal {
class KeySequenceValidator : public FancyLineEdit
{
public:
KeySequenceValidator(QWidget *parent, CommandMappings *mappings)
: FancyLineEdit(parent), m_mappings(mappings)
{}
bool validate(const QString &, QString *) const
{
return !m_mappings->hasConflicts();
}
CommandMappings *m_mappings;
};
class CommandMappingsPrivate
{
public:
@@ -106,11 +91,14 @@ public:
targetEditGroup = new QGroupBox(CommandMappings::tr("Target Identifier"), m_widget);
targetEdit = new KeySequenceValidator(targetEditGroup, q);
targetEdit = new FancyLineEdit(targetEditGroup);
targetEdit->setAutoHideButton(FancyLineEdit::Right, true);
targetEdit->setPlaceholderText(QString());
targetEdit->installEventFilter(q);
targetEdit->setFiltering(true);
targetEdit->setValidationFunction([this](FancyLineEdit *, QString *) {
return !q->hasConflicts();
});
resetButton = new QPushButton(targetEditGroup);
resetButton->setToolTip(CommandMappings::tr("Reset to default."));