mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-11-29 19:06:55 -05:00
Replace remaining instances of Q_FOREACH with C++11 range-based for loops
This commit is contained in:
parent
2872f1706c
commit
cb51ec61f7
6 changed files with 72 additions and 44 deletions
|
|
@ -21,6 +21,7 @@
|
|||
#include "KMessageWidget.h"
|
||||
|
||||
#include "core/FilePath.h"
|
||||
#include "core/Global.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QEvent>
|
||||
|
|
@ -117,7 +118,8 @@ void KMessageWidgetPrivate::createLayout()
|
|||
qDeleteAll(buttons);
|
||||
buttons.clear();
|
||||
|
||||
Q_FOREACH (QAction *action, q->actions()) {
|
||||
const auto actions = q->actions();
|
||||
for (QAction *action: actions) {
|
||||
QToolButton *button = new QToolButton(content);
|
||||
button->setDefaultAction(action);
|
||||
button->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
|
||||
|
|
@ -137,7 +139,7 @@ void KMessageWidgetPrivate::createLayout()
|
|||
|
||||
QHBoxLayout *buttonLayout = new QHBoxLayout;
|
||||
buttonLayout->addStretch();
|
||||
Q_FOREACH (QToolButton *button, buttons) {
|
||||
for (QToolButton* button: asConst(buttons)) {
|
||||
// For some reason, calling show() is necessary if wordwrap is true,
|
||||
// otherwise the buttons do not show up. It is not needed if
|
||||
// wordwrap is false.
|
||||
|
|
@ -151,7 +153,7 @@ void KMessageWidgetPrivate::createLayout()
|
|||
layout->addWidget(iconLabel);
|
||||
layout->addWidget(textLabel);
|
||||
|
||||
Q_FOREACH (QToolButton *button, buttons) {
|
||||
for (QToolButton* button: asConst(buttons)) {
|
||||
layout->addWidget(button);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
#include "core/Config.h"
|
||||
#include "core/Translator.h"
|
||||
#include "core/FilePath.h"
|
||||
#include "core/Global.h"
|
||||
|
||||
class SettingsWidget::ExtraPage
|
||||
{
|
||||
|
|
@ -144,8 +145,9 @@ void SettingsWidget::loadSettings()
|
|||
m_secUi->passwordRepeatCheckBox->setChecked(config()->get("security/passwordsrepeat").toBool());
|
||||
|
||||
|
||||
Q_FOREACH (const ExtraPage& page, m_extraPages)
|
||||
for (const ExtraPage& page: asConst(m_extraPages)) {
|
||||
page.loadSettings();
|
||||
}
|
||||
|
||||
setCurrentPage(0);
|
||||
}
|
||||
|
|
@ -190,8 +192,9 @@ void SettingsWidget::saveSettings()
|
|||
config()->set("security/passwordscleartext", m_secUi->passwordCleartextCheckBox->isChecked());
|
||||
config()->set("security/passwordsrepeat", m_secUi->passwordRepeatCheckBox->isChecked());
|
||||
|
||||
Q_FOREACH (const ExtraPage& page, m_extraPages)
|
||||
for (const ExtraPage& page: asConst(m_extraPages)) {
|
||||
page.saveSettings();
|
||||
}
|
||||
|
||||
Q_EMIT editFinished(true);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue