on xenial help sign in
Easier way of deleting all but the last item
commit4a029dc3f192e7c41ef730b9ab1d9e323cb3ecc2 authorAlbert Astals Cid <albert.astals@canonical.com> dateFri 23 Dec 2016, 15:32 (10 years ago) parent99f24d8
1 file changed+2−6
plugins/Wizard/PageList.cpp+2−6
plugins/Wizard/PageList.cpp+2−6
@@ -71,12 +71,8 @@ PageList::PageList(QObject *parent)
7171 // If there was a system update installed, skip until the last page to just greet the user
7272 QSettings settings;
7373 if (settings.value(QStringLiteral("Wizard/SkipUntilFinishedPage")).toBool()) {
74− const QString lastPage = m_pages.lastKey();
75− for (auto it = m_pages.begin(); it != m_pages.end(); ++it) {
76− const QString page = it.key();
77− if (Q_UNLIKELY(page != lastPage)) {
78− m_pages.remove(page);
79− }
74+ while (m_pages.count() > 1) {
75+ m_pages.erase(m_pages.begin());
8076 }
8177
8278 // ... and reset it again for the next run