Fix issue with deleting old labels in wizard conclusion

This commit is contained in:
Gary Talent 2017-05-04 01:23:06 -05:00
parent 9b46116a83
commit eec9a9d730
2 changed files with 10 additions and 3 deletions

View File

@ -74,6 +74,7 @@ void WizardSelect::itemSelected(int row) {
WizardConclusionPage::WizardConclusionPage(QString msg, QVector<QString> fields) { WizardConclusionPage::WizardConclusionPage(QString msg, QVector<QString> fields) {
m_baseMsg = msg; m_baseMsg = msg;
m_fields = fields; m_fields = fields;
setLayout(new QVBoxLayout(this));
} }
WizardConclusionPage::~WizardConclusionPage() { WizardConclusionPage::~WizardConclusionPage() {
@ -84,10 +85,15 @@ void WizardConclusionPage::initializePage() {
for (auto field : m_fields) { for (auto field : m_fields) {
msg = msg.arg(this->field(field).toString()); msg = msg.arg(this->field(field).toString());
} }
auto text = new QLabel(msg, this); auto text = new QLabel(msg, this);
auto layout = new QVBoxLayout(this); if (m_text) {
layout->addWidget(text); layout()->replaceWidget(m_text, text);
setLayout(layout); delete m_text;
} else {
layout()->addWidget(text);
}
m_text = text;
} }

View File

@ -81,6 +81,7 @@ class WizardConclusionPage: public QWizardPage {
Q_OBJECT Q_OBJECT
private: private:
QString m_baseMsg = ""; QString m_baseMsg = "";
QLabel *m_text = nullptr;
QVector<QString> m_fields; QVector<QString> m_fields;
public: public: