diff --git a/plugins/filetemplates/templateoptionspage.cpp b/plugins/filetemplates/templateoptionspage.cpp --- a/plugins/filetemplates/templateoptionspage.cpp +++ b/plugins/filetemplates/templateoptionspage.cpp @@ -41,6 +41,7 @@ QList entries; QHash controls; QHash typeProperties; + QList groupBoxes; }; TemplateOptionsPage::TemplateOptionsPage(QWidget* parent, Qt::WindowFlags f) @@ -59,15 +60,26 @@ void TemplateOptionsPage::load(const SourceFileTemplate& fileTemplate, TemplateRenderer* renderer) { + // TODO: keep any old changed values, as it comes by surprise to have them lost + // when going back and forward + + // clear anything as there is on reentering the page d->entries.clear(); + d->controls.clear(); + // clear any old option group boxes & the base layout + qDeleteAll(d->groupBoxes); + d->groupBoxes.clear(); + delete layout(); QVBoxLayout* layout = new QVBoxLayout(); QHash > options = fileTemplate.customOptions(renderer); QHash >::const_iterator it; for (it = options.constBegin(); it != options.constEnd(); ++it) { QGroupBox* box = new QGroupBox(this); + d->groupBoxes.append(box); + box->setTitle(it.key()); QFormLayout* formLayout = new QFormLayout;