From c63139f7e752b247bdcdb977863f86173618ecb4 Mon Sep 17 00:00:00 2001 From: blank X Date: Sat, 16 Oct 2021 16:55:38 +0700 Subject: [PATCH] Add InstantReplaces::Custom --- ui/widgets/input_fields.cpp | 11 +++++++++++ ui/widgets/input_fields.h | 1 + 2 files changed, 12 insertions(+) diff --git a/ui/widgets/input_fields.cpp b/ui/widgets/input_fields.cpp index 067c6bc..7a15595 100644 --- a/ui/widgets/input_fields.cpp +++ b/ui/widgets/input_fields.cpp @@ -959,6 +959,17 @@ const InstantReplaces &InstantReplaces::TextOnly() { return result; } +const InstantReplaces &InstantReplaces::Custom() { + static const auto result = [] { + auto result = InstantReplaces(); + for (auto i = customReplacesMap.constBegin(), e = customReplacesMap.constEnd(); i != e; ++i) { + result.add(i.key(), i.value()); + } + return result; + }(); + return result; +} + FlatInput::FlatInput( QWidget *parent, const style::FlatInput &st, diff --git a/ui/widgets/input_fields.h b/ui/widgets/input_fields.h index 3617e65..8544550 100644 --- a/ui/widgets/input_fields.h +++ b/ui/widgets/input_fields.h @@ -43,6 +43,7 @@ struct InstantReplaces { static const InstantReplaces &Default(); static const InstantReplaces &TextOnly(); + static const InstantReplaces &Custom(); int maxLength = 0; Node reverseMap;