From 0df7362829436926d839b1e80efabf95dd62183b Mon Sep 17 00:00:00 2001 From: Juraj Oravec Date: Sun, 29 Sep 2019 17:32:55 +0200 Subject: [PATCH] filetemplates: load and show tooltip for custom options Signed-off-by: Juraj Oravec --- kdevplatform/language/codegen/sourcefiletemplate.cpp | 12 ++++++++++-- plugins/filetemplates/templateoptionspage.cpp | 4 ++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/kdevplatform/language/codegen/sourcefiletemplate.cpp b/kdevplatform/language/codegen/sourcefiletemplate.cpp index e262a619e3..45e41f6bd2 100644 --- a/kdevplatform/language/codegen/sourcefiletemplate.cpp +++ b/kdevplatform/language/codegen/sourcefiletemplate.cpp @@ -63,9 +63,17 @@ ConfigOption SourceFileTemplatePrivate::readEntry(const QDomElement& element, if (tag == QLatin1String("label")) { entry.label = e.text(); } else if (tag == QLatin1String("tooltip")) { - entry.label = e.text(); + if (entry.label.isEmpty()) { + entry.label = e.text(); + } + entry.context = e.text(); } else if (tag == QLatin1String("whatsthis")) { - entry.label = e.text(); + if (entry.label.isEmpty()) { + entry.label = e.text(); + } + if (entry.context.isEmpty()) { + entry.context = e.text(); + } } else if (tag == QLatin1String("min")) { entry.minValue = e.text(); } else if (tag == QLatin1String("max")) { diff --git a/plugins/filetemplates/templateoptionspage.cpp b/plugins/filetemplates/templateoptionspage.cpp index 383d665914..565952db47 100644 --- a/plugins/filetemplates/templateoptionspage.cpp +++ b/plugins/filetemplates/templateoptionspage.cpp @@ -136,6 +136,10 @@ void TemplateOptionsPage::load(const SourceFileTemplate& fileTemplate, TemplateR { const QString entryLabelText = i18n("%1:", entry.label); QLabel* label = new QLabel(entryLabelText, box); + if (!entry.context.isEmpty()) { + label->setToolTip(entry.context); + control->setToolTip(entry.context); + } formLayout->addRow(label, control); d->controls.insert(entry.name, control); if (d->firstEditWidget == nullptr) { -- GitLab