summaryrefslogtreecommitdiffstats
path: root/src/designer/src/lib/shared/qdesigner_command.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/designer/src/lib/shared/qdesigner_command.cpp')
-rw-r--r--src/designer/src/lib/shared/qdesigner_command.cpp27
1 files changed, 12 insertions, 15 deletions
diff --git a/src/designer/src/lib/shared/qdesigner_command.cpp b/src/designer/src/lib/shared/qdesigner_command.cpp
index 7346b98f3..04cbfeff3 100644
--- a/src/designer/src/lib/shared/qdesigner_command.cpp
+++ b/src/designer/src/lib/shared/qdesigner_command.cpp
@@ -232,18 +232,15 @@ void InsertWidgetCommand::undo()
void InsertWidgetCommand::refreshBuddyLabels()
{
- using LabelList = QList<QLabel *>;
-
- const LabelList label_list = formWindow()->findChildren<QLabel*>();
- if (label_list.empty())
+ const auto label_list = formWindow()->findChildren<QLabel*>();
+ if (label_list.isEmpty())
return;
const QString buddyProperty = QStringLiteral("buddy");
const QByteArray objectNameU8 = m_widget->objectName().toUtf8();
// Re-set the buddy (The sheet locates the object by name and sets it)
- const LabelList::const_iterator cend = label_list.constEnd();
- for (LabelList::const_iterator it = label_list.constBegin(); it != cend; ++it ) {
- if (QDesignerPropertySheetExtension* sheet = propertySheet(*it)) {
+ for (QLabel *label : label_list) {
+ if (QDesignerPropertySheetExtension* sheet = propertySheet(label)) {
const int idx = sheet->indexOf(buddyProperty);
if (idx != -1) {
const QVariant value = sheet->property(idx);
@@ -350,7 +347,7 @@ void ManageWidgetCommandHelper::init(const QDesignerFormWindowInterface *fw, QWi
m_managedChildren.clear();
const QWidgetList children = m_widget->findChildren<QWidget *>();
- if (children.empty())
+ if (children.isEmpty())
return;
m_managedChildren.reserve(children.size());
@@ -370,7 +367,7 @@ void ManageWidgetCommandHelper::manage(QDesignerFormWindowInterface *fw)
{
// Manage the managed children after parent
fw->manageWidget(m_widget);
- if (!m_managedChildren.empty()) {
+ if (!m_managedChildren.isEmpty()) {
const WidgetVector::const_iterator lcend = m_managedChildren.constEnd();
for (WidgetVector::const_iterator it = m_managedChildren.constBegin(); it != lcend; ++it)
fw->manageWidget(*it);
@@ -380,7 +377,7 @@ void ManageWidgetCommandHelper::manage(QDesignerFormWindowInterface *fw)
void ManageWidgetCommandHelper::unmanage(QDesignerFormWindowInterface *fw)
{
// Unmanage the managed children first
- if (!m_managedChildren.empty()) {
+ if (!m_managedChildren.isEmpty()) {
const WidgetVector::const_iterator lcend = m_managedChildren.constEnd();
for (WidgetVector::const_iterator it = m_managedChildren.constBegin(); it != lcend; ++it)
fw->unmanageWidget(*it);
@@ -665,7 +662,7 @@ DemoteFromCustomWidgetCommand::DemoteFromCustomWidgetCommand
void DemoteFromCustomWidgetCommand::init(const WidgetList &promoted)
{
- m_promote_cmd.init(promoted, promotedCustomClassName(core(), promoted.front()));
+ m_promote_cmd.init(promoted, promotedCustomClassName(core(), promoted.constFirst()));
}
void DemoteFromCustomWidgetCommand::redo()
@@ -695,7 +692,7 @@ void CursorSelectionState::save(const QDesignerFormWindowInterface *formWindow)
void CursorSelectionState::restore(QDesignerFormWindowInterface *formWindow) const
{
- if (m_selection.empty()) {
+ if (m_selection.isEmpty()) {
formWindow->clearSelection(true);
} else {
// Select current as last
@@ -2656,7 +2653,7 @@ static RemoveActionCommand::ActionData findActionIn(QAction *action)
const QWidgetList &associatedWidgets = action->associatedWidgets();
for (QWidget *widget : associatedWidgets) {
if (qobject_cast<const QMenu *>(widget) || qobject_cast<const QToolBar *>(widget)) {
- const QList<QAction*> actionList = widget->actions();
+ const auto actionList = widget->actions();
const int size = actionList.size();
for (int i = 0; i < size; ++i) {
if (actionList.at(i) == action) {
@@ -2692,7 +2689,7 @@ void RemoveActionCommand::redo()
core()->actionEditor()->setFormWindow(fw);
core()->actionEditor()->unmanageAction(m_action);
- if (!m_actionData.empty())
+ if (!m_actionData.isEmpty())
core()->objectInspector()->setFormWindow(fw);
}
@@ -2702,7 +2699,7 @@ void RemoveActionCommand::undo()
core()->actionEditor()->manageAction(m_action);
for (const ActionDataItem &item : qAsConst(m_actionData))
item.widget->insertAction(item.before, m_action);
- if (!m_actionData.empty())
+ if (!m_actionData.isEmpty())
core()->objectInspector()->setFormWindow(formWindow());
}