summaryrefslogtreecommitdiff
path: root/src/designer/src/components
diff options
context:
space:
mode:
Diffstat (limited to 'src/designer/src/components')
-rw-r--r--src/designer/src/components/buddyeditor/buddyeditor.cpp4
-rw-r--r--src/designer/src/components/formeditor/embeddedoptionspage.cpp2
-rw-r--r--src/designer/src/components/formeditor/formwindow.cpp18
-rw-r--r--src/designer/src/components/formeditor/formwindow_widgetstack.cpp2
-rw-r--r--src/designer/src/components/formeditor/formwindowmanager.cpp6
-rw-r--r--src/designer/src/components/formeditor/formwindowsettings.cpp2
-rw-r--r--src/designer/src/components/formeditor/layout_propertysheet.cpp2
-rw-r--r--src/designer/src/components/formeditor/previewactiongroup.cpp2
-rw-r--r--src/designer/src/components/formeditor/qdesigner_resource.cpp26
-rw-r--r--src/designer/src/components/formeditor/qmdiarea_container.cpp2
-rw-r--r--src/designer/src/components/formeditor/qwizard_container.cpp7
-rw-r--r--src/designer/src/components/formeditor/templateoptionspage.cpp10
-rw-r--r--src/designer/src/components/objectinspector/objectinspector.cpp28
-rw-r--r--src/designer/src/components/objectinspector/objectinspectormodel.cpp12
-rw-r--r--src/designer/src/components/propertyeditor/designerpropertymanager.cpp6
-rw-r--r--src/designer/src/components/propertyeditor/fontpropertymanager.cpp6
-rw-r--r--src/designer/src/components/propertyeditor/propertyeditor.cpp18
-rw-r--r--src/designer/src/components/signalsloteditor/connectdialog.cpp12
-rw-r--r--src/designer/src/components/signalsloteditor/signalslot_utils.cpp6
-rw-r--r--src/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp4
-rw-r--r--src/designer/src/components/taskmenu/button_taskmenu.cpp12
-rw-r--r--src/designer/src/components/widgetbox/widgetbox_dnditem.cpp2
-rw-r--r--src/designer/src/components/widgetbox/widgetboxtreewidget.cpp7
23 files changed, 97 insertions, 99 deletions
diff --git a/src/designer/src/components/buddyeditor/buddyeditor.cpp b/src/designer/src/components/buddyeditor/buddyeditor.cpp
index 7593326db..93e143c2a 100644
--- a/src/designer/src/components/buddyeditor/buddyeditor.cpp
+++ b/src/designer/src/components/buddyeditor/buddyeditor.cpp
@@ -329,7 +329,7 @@ void BuddyEditor::autoBuddy()
{
// Any labels?
LabelList labelList = background()->findChildren<QLabel*>();
- if (labelList.empty())
+ if (labelList.isEmpty())
return;
// Find already used buddies
QWidgetList usedBuddies;
@@ -355,7 +355,7 @@ void BuddyEditor::autoBuddy()
}
}
// Add the list in one go.
- if (labelList.empty())
+ if (labelList.isEmpty())
return;
const int count = labelList.size();
Q_ASSERT(count == buddies.size());
diff --git a/src/designer/src/components/formeditor/embeddedoptionspage.cpp b/src/designer/src/components/formeditor/embeddedoptionspage.cpp
index 96a6c7c4a..91474c6aa 100644
--- a/src/designer/src/components/formeditor/embeddedoptionspage.cpp
+++ b/src/designer/src/components/formeditor/embeddedoptionspage.cpp
@@ -265,7 +265,7 @@ void EmbeddedOptionsControlPrivate::sortAndPopulateProfileCombo()
// Clear items until only "None" is left
for (int i = m_profileCombo->count() - 1; i > 0; i--)
m_profileCombo->removeItem(i);
- if (!m_sortedProfiles.empty()) {
+ if (!m_sortedProfiles.isEmpty()) {
std::sort(m_sortedProfiles.begin(), m_sortedProfiles.end(), deviceProfileLessThan);
m_profileCombo->addItems(existingProfileNames());
}
diff --git a/src/designer/src/components/formeditor/formwindow.cpp b/src/designer/src/components/formeditor/formwindow.cpp
index cc0f78e38..91896f06a 100644
--- a/src/designer/src/components/formeditor/formwindow.cpp
+++ b/src/designer/src/components/formeditor/formwindow.cpp
@@ -178,7 +178,7 @@ FormWindow::Selection::~Selection()
void FormWindow::Selection::clear()
{
- if (!m_usedSelections.empty()) {
+ if (!m_usedSelections.isEmpty()) {
for (auto it = m_usedSelections.begin(), mend = m_usedSelections.end(); it != mend; ++it)
it.value()->setWidget(nullptr);
m_usedSelections.clear();
@@ -741,7 +741,7 @@ bool FormWindow::handleMouseMoveEvent(QWidget *, QWidget *, QMouseEvent *e)
blockSelectionChanged(blocked);
- if (!sel.empty()) // reshow selection?
+ if (!sel.isEmpty()) // reshow selection?
if (QDesignerMimeData::execDrag(item_list, core()->topLevel()) == Qt::IgnoreAction && dropType == QDesignerDnDItemInterface::MoveDrop)
for (QWidget *widget : qAsConst(sel))
m_selection->show(widget);
@@ -946,7 +946,7 @@ bool FormWindow::isMainContainer(const QWidget *w) const
void FormWindow::updateChildSelections(QWidget *w)
{
const QWidgetList l = w->findChildren<QWidget*>();
- if (!l.empty()) {
+ if (!l.isEmpty()) {
const QWidgetList::const_iterator lcend = l.constEnd();
for (QWidgetList::const_iterator it = l.constBegin(); it != lcend; ++it) {
QWidget *w = *it;
@@ -1156,19 +1156,19 @@ bool FormWindow::unify(QObject *w, QString &s, bool changeIt)
const QDesignerMetaDataBaseInterface *metaDataBase = core()->metaDataBase();
const QWidgetList widgetChildren = main->findChildren<QWidget*>();
- if (!widgetChildren.empty())
+ if (!widgetChildren.isEmpty())
insertNames(metaDataBase, widgetChildren.constBegin(), widgetChildren.constEnd(), w, existingNames);
const QList<QLayout *> layoutChildren = main->findChildren<QLayout*>();
- if (!layoutChildren.empty())
+ if (!layoutChildren.isEmpty())
insertNames(metaDataBase, layoutChildren.constBegin(), layoutChildren.constEnd(), w, existingNames);
const QList<QAction *> actionChildren = main->findChildren<QAction*>();
- if (!actionChildren.empty())
+ if (!actionChildren.isEmpty())
insertNames(metaDataBase, actionChildren.constBegin(), actionChildren.constEnd(), w, existingNames);
const QList<QButtonGroup *> buttonGroupChildren = main->findChildren<QButtonGroup*>();
- if (!buttonGroupChildren.empty())
+ if (!buttonGroupChildren.isEmpty())
insertNames(metaDataBase, buttonGroupChildren.constBegin(), buttonGroupChildren.constEnd(), w, existingNames);
const StringSet::const_iterator enEnd = existingNames.constEnd();
@@ -1701,7 +1701,7 @@ QWidget *FormWindow::containerForPaste() const
// Try to find a close parent, for example a non-laid-out
// QFrame/QGroupBox when a widget within it is selected.
QWidgetList selection = selectedWidgets();
- if (selection.empty())
+ if (selection.isEmpty())
break;
simplifySelection(&selection);
@@ -2258,7 +2258,7 @@ QAction *FormWindow::createSelectAncestorSubMenu(QWidget *w)
for (QWidget *p = w->parentWidget(); p && p != mc; p = p->parentWidget())
if (isManaged(p) && !isWidgetSelected(p))
parents.push_back(p);
- if (parents.empty())
+ if (parents.isEmpty())
return nullptr;
// Create a submenu listing the managed, unselected parents
QMenu *menu = new QMenu;
diff --git a/src/designer/src/components/formeditor/formwindow_widgetstack.cpp b/src/designer/src/components/formeditor/formwindow_widgetstack.cpp
index 18126c145..4c93c7674 100644
--- a/src/designer/src/components/formeditor/formwindow_widgetstack.cpp
+++ b/src/designer/src/components/formeditor/formwindow_widgetstack.cpp
@@ -165,7 +165,7 @@ void FormWindowWidgetStack::addTool(QDesignerFormWindowToolInterface *tool)
m_layout->addWidget(w);
} else {
// The form editor might not have a tool initially, use dummy. Assert on anything else
- Q_ASSERT(m_tools.empty());
+ Q_ASSERT(m_tools.isEmpty());
m_layout->addWidget(m_formContainer);
}
diff --git a/src/designer/src/components/formeditor/formwindowmanager.cpp b/src/designer/src/components/formeditor/formwindowmanager.cpp
index 73b315889..692b20c54 100644
--- a/src/designer/src/components/formeditor/formwindowmanager.cpp
+++ b/src/designer/src/components/formeditor/formwindowmanager.cpp
@@ -566,7 +566,7 @@ static inline QWidget *findLayoutContainer(const FormWindow *fw)
{
QWidgetList l(fw->selectedWidgets());
fw->simplifySelection(&l);
- return l.empty() ? fw->mainContainer() : l.front();
+ return l.isEmpty() ? fw->mainContainer() : l.constFirst();
}
void FormWindowManager::createLayout()
@@ -616,7 +616,7 @@ void FormWindowManager::slotActionSimplifyLayoutActivated()
if (selectedWidgets.size() != 1)
return;
SimplifyLayoutCommand *cmd = new SimplifyLayoutCommand(m_activeFormWindow);
- if (cmd->init(selectedWidgets.front())) {
+ if (cmd->init(selectedWidgets.constFirst())) {
m_activeFormWindow->commandHistory()->push(cmd);
} else {
delete cmd;
@@ -753,7 +753,7 @@ QSet<QWidget *> FormWindowManager::getUnsortedLayoutsToBeBroken(bool firstOnly)
for (QWidget *selectedWidget : qAsConst(selection)) {
// find all layouts
const QWidgetList &list = layoutsToBeBroken(selectedWidget);
- if (!list.empty()) {
+ if (!list.isEmpty()) {
for (QWidget *widget : list)
layouts.insert(widget);
if (firstOnly)
diff --git a/src/designer/src/components/formeditor/formwindowsettings.cpp b/src/designer/src/components/formeditor/formwindowsettings.cpp
index 4ccd7210b..de03c6792 100644
--- a/src/designer/src/components/formeditor/formwindowsettings.cpp
+++ b/src/designer/src/components/formeditor/formwindowsettings.cpp
@@ -244,7 +244,7 @@ void FormWindowSettings::setData(const FormWindowData &data)
m_ui->authorLineEdit->setText(data.author);
- if (data.includeHints.empty()) {
+ if (data.includeHints.isEmpty()) {
m_ui->includeHintsTextEdit->clear();
} else {
m_ui->includeHintsTextEdit->setText(data.includeHints.join(QLatin1Char('\n')));
diff --git a/src/designer/src/components/formeditor/layout_propertysheet.cpp b/src/designer/src/components/formeditor/layout_propertysheet.cpp
index e0e456d32..0bb3ecb2f 100644
--- a/src/designer/src/components/formeditor/layout_propertysheet.cpp
+++ b/src/designer/src/components/formeditor/layout_propertysheet.cpp
@@ -103,7 +103,7 @@ static bool isIntegerList(const QString &s)
static LayoutPropertyType layoutPropertyType(const QString &name)
{
static QHash<QString, LayoutPropertyType> namePropertyMap;
- if (namePropertyMap.empty()) {
+ if (namePropertyMap.isEmpty()) {
namePropertyMap.insert(QLatin1String(leftMargin), LayoutPropertyLeftMargin);
namePropertyMap.insert(QLatin1String(topMargin), LayoutPropertyTopMargin);
namePropertyMap.insert(QLatin1String(rightMargin), LayoutPropertyRightMargin);
diff --git a/src/designer/src/components/formeditor/previewactiongroup.cpp b/src/designer/src/components/formeditor/previewactiongroup.cpp
index 89c3a0ae7..e0f3b7db1 100644
--- a/src/designer/src/components/formeditor/previewactiongroup.cpp
+++ b/src/designer/src/components/formeditor/previewactiongroup.cpp
@@ -98,7 +98,7 @@ void PreviewActionGroup::updateDeviceProfiles()
const DeviceProfileList profiles = settings.deviceProfiles();
const ActionList al = actions();
// Separator?
- const bool hasProfiles = !profiles.empty();
+ const bool hasProfiles = !profiles.isEmpty();
al.at(MaxDeviceActions)->setVisible(hasProfiles);
int index = 0;
if (hasProfiles) {
diff --git a/src/designer/src/components/formeditor/qdesigner_resource.cpp b/src/designer/src/components/formeditor/qdesigner_resource.cpp
index dd1144d7c..ff4a42744 100644
--- a/src/designer/src/components/formeditor/qdesigner_resource.cpp
+++ b/src/designer/src/components/formeditor/qdesigner_resource.cpp
@@ -516,14 +516,14 @@ void QDesignerResource::saveDom(DomUI *ui, QWidget *widget)
ui->setAttributeConnectslotsbyname(false);
const QVariantMap designerFormData = m_formWindow->formData();
- if (!designerFormData.empty()) {
+ if (!designerFormData.isEmpty()) {
DomPropertyList domPropertyList;
const QVariantMap::const_iterator cend = designerFormData.constEnd();
for (QVariantMap::const_iterator it = designerFormData.constBegin(); it != cend; ++it) {
if (DomProperty *prop = variantToDomProperty(this, widget->metaObject(), it.key(), it.value()))
domPropertyList += prop;
}
- if (!domPropertyList.empty()) {
+ if (!domPropertyList.isEmpty()) {
DomDesignerData* domDesignerFormData = new DomDesignerData;
domDesignerFormData->setElementProperty(domPropertyList);
ui->setElementDesignerdata(domDesignerFormData);
@@ -590,7 +590,7 @@ void QDesignerResource::saveDom(DomUI *ui, QWidget *widget)
const MetaDataBaseItem *item = metaDataBase->metaDataBaseItem(m_formWindow->mainContainer());
const QStringList fakeSlots = item->fakeSlots();
const QStringList fakeSignals =item->fakeSignals();
- if (!fakeSlots.empty() || !fakeSignals.empty()) {
+ if (!fakeSlots.isEmpty() || !fakeSignals.isEmpty()) {
DomSlots *domSlots = new DomSlots();
domSlots->setElementSlot(fakeSlots);
domSlots->setElementSignal(fakeSignals);
@@ -708,7 +708,7 @@ QWidget *QDesignerResource::create(DomUI *ui, QWidget *parentWidget)
// Register all button groups the form builder adds as children of the main container for them to be found
// in the signal slot editor
const QObjectList mchildren = mainWidget->children();
- if (!mchildren.empty()) {
+ if (!mchildren.isEmpty()) {
QDesignerMetaDataBaseInterface *mdb = core()->metaDataBase();
const QObjectList::const_iterator cend = mchildren.constEnd();
for (QObjectList::const_iterator it = mchildren.constBegin(); it != cend; ++it)
@@ -740,7 +740,7 @@ QWidget *QDesignerResource::create(DomUI *ui, QWidget *parentWidget)
// Initialize the mainwindow geometry. Has it been explicitly specified?
bool hasExplicitGeometry = false;
const auto &properties = ui->elementWidget()->elementProperty();
- if (!properties.empty()) {
+ if (!properties.isEmpty()) {
const QString geometry = QStringLiteral("geometry");
for (const DomProperty *p : properties) {
if (p->attributeName() == geometry) {
@@ -941,7 +941,7 @@ static bool readDomEnumerationValue(const DomProperty *p,
void QDesignerResource::applyProperties(QObject *o, const QList<DomProperty*> &properties)
{
- if (properties.empty())
+ if (properties.isEmpty())
return;
QDesignerPropertySheetExtension *sheet = qt_extension<QDesignerPropertySheetExtension*>(core()->extensionManager(), o);
@@ -1692,7 +1692,7 @@ DomUI *QDesignerResource::copy(const FormBuilderClipboard &selection)
ui_widget->setAttributeName(QLatin1String(clipboardObjectName));
bool hasItems = false;
// Widgets
- if (!selection.m_widgets.empty()) {
+ if (!selection.m_widgets.isEmpty()) {
QVector<DomWidget *> ui_widget_list;
const int size = selection.m_widgets.size();
for (int i=0; i< size; ++i) {
@@ -1703,19 +1703,19 @@ DomUI *QDesignerResource::copy(const FormBuilderClipboard &selection)
if (ui_child)
ui_widget_list.append(ui_child);
}
- if (!ui_widget_list.empty()) {
+ if (!ui_widget_list.isEmpty()) {
ui_widget->setElementWidget(ui_widget_list);
hasItems = true;
}
}
// actions
- if (!selection.m_actions.empty()) {
+ if (!selection.m_actions.isEmpty()) {
QVector<DomAction *> domActions;
for (QAction* action : qAsConst(selection.m_actions)) {
if (DomAction *domAction = createDom(action))
domActions += domAction;
}
- if (!domActions.empty()) {
+ if (!domActions.isEmpty()) {
ui_widget-> setElementAction(domActions);
hasItems = true;
}
@@ -1750,7 +1750,7 @@ FormBuilderClipboard QDesignerResource::paste(DomUI *ui, QWidget *widgetParent,
const DomWidget *topLevel = ui->elementWidget();
initialize(ui);
const auto &domWidgets = topLevel->elementWidget();
- if (!domWidgets.empty()) {
+ if (!domWidgets.isEmpty()) {
const QPoint offset = m_formWindow->grid();
for (DomWidget* domWidget : domWidgets) {
if (QWidget *w = create(domWidget, widgetParent)) {
@@ -1857,7 +1857,7 @@ DomCustomWidgets *QDesignerResource::saveCustomWidgets()
WidgetDataBaseItem *internalItem = static_cast<WidgetDataBaseItem *>(item);
const QStringList fakeSlots = internalItem->fakeSlots();
const QStringList fakeSignals = internalItem->fakeSignals();
- if (!fakeSlots.empty() || !fakeSignals.empty()) {
+ if (!fakeSlots.isEmpty() || !fakeSignals.isEmpty()) {
DomSlots *domSlots = new DomSlots();
domSlots->setElementSlot(fakeSlots);
domSlots->setElementSignal(fakeSignals);
@@ -2212,7 +2212,7 @@ QActionGroup *QDesignerResource::createActionGroup(QObject *parent, const QStrin
void QDesignerResource::applyAttributesToPropertySheet(const DomWidget *ui_widget, QWidget *widget)
{
const DomPropertyList attributes = ui_widget->elementAttribute();
- if (attributes.empty())
+ if (attributes.isEmpty())
return;
QDesignerPropertySheetExtension *sheet = qt_extension<QDesignerPropertySheetExtension*>(m_formWindow->core()->extensionManager(), widget);
const DomPropertyList::const_iterator acend = attributes.constEnd();
diff --git a/src/designer/src/components/formeditor/qmdiarea_container.cpp b/src/designer/src/components/formeditor/qmdiarea_container.cpp
index e33c99367..e1930501f 100644
--- a/src/designer/src/components/formeditor/qmdiarea_container.cpp
+++ b/src/designer/src/components/formeditor/qmdiarea_container.cpp
@@ -144,7 +144,7 @@ QMdiAreaPropertySheet::MdiAreaProperty QMdiAreaPropertySheet::mdiAreaProperty(co
{
using MdiAreaPropertyHash = QHash<QString, MdiAreaProperty>;
static MdiAreaPropertyHash mdiAreaPropertyHash;
- if (mdiAreaPropertyHash.empty()) {
+ if (mdiAreaPropertyHash.isEmpty()) {
mdiAreaPropertyHash.insert(QLatin1String(subWindowNameC), MdiAreaSubWindowName);
mdiAreaPropertyHash.insert(QLatin1String(subWindowTitleC), MdiAreaSubWindowTitle);
}
diff --git a/src/designer/src/components/formeditor/qwizard_container.cpp b/src/designer/src/components/formeditor/qwizard_container.cpp
index dbc7084eb..5853fbf98 100644
--- a/src/designer/src/components/formeditor/qwizard_container.cpp
+++ b/src/designer/src/components/formeditor/qwizard_container.cpp
@@ -65,15 +65,12 @@ QWidget *QWizardContainer::widget(int index) const
int QWizardContainer::currentIndex() const
{
- const IdList idList = m_wizard->pageIds();
- const int currentId = m_wizard->currentId();
- const int rc = idList.empty() ? -1 : idList.indexOf(currentId);
- return rc;
+ return m_wizard->pageIds().indexOf(m_wizard->currentId());
}
void QWizardContainer::setCurrentIndex(int index)
{
- if (index < 0 || m_wizard->pageIds().empty())
+ if (index < 0 || m_wizard->pageIds().isEmpty())
return;
int currentIdx = currentIndex();
diff --git a/src/designer/src/components/formeditor/templateoptionspage.cpp b/src/designer/src/components/formeditor/templateoptionspage.cpp
index b1c0dc2d4..e50260406 100644
--- a/src/designer/src/components/formeditor/templateoptionspage.cpp
+++ b/src/designer/src/components/formeditor/templateoptionspage.cpp
@@ -79,7 +79,7 @@ void TemplateOptionsWidget::setTemplatePaths(const QStringList &l)
{
// add paths and select 0
m_ui->m_templatePathListWidget->clear();
- if (l.empty()) {
+ if (l.isEmpty()) {
// disable button
templatePathSelectionChanged();
} else {
@@ -98,7 +98,7 @@ void TemplateOptionsWidget::addTemplatePath()
const QList<QListWidgetItem *> existing
= m_ui->m_templatePathListWidget->findItems(templatePath, Qt::MatchExactly);
- if (!existing.empty())
+ if (!existing.isEmpty())
return;
QListWidgetItem *newItem = new QListWidgetItem(templatePath);
@@ -110,15 +110,15 @@ void TemplateOptionsWidget::removeTemplatePath()
{
const QList<QListWidgetItem *> selectedPaths
= m_ui->m_templatePathListWidget->selectedItems();
- if (selectedPaths.empty())
+ if (selectedPaths.isEmpty())
return;
- delete selectedPaths.front();
+ delete selectedPaths.constFirst();
}
void TemplateOptionsWidget::templatePathSelectionChanged()
{
const QList<QListWidgetItem *> selectedPaths = m_ui->m_templatePathListWidget->selectedItems();
- m_ui->m_removeTemplatePathButton->setEnabled(!selectedPaths.empty());
+ m_ui->m_removeTemplatePathButton->setEnabled(!selectedPaths.isEmpty());
}
QString TemplateOptionsWidget::chooseTemplatePath(QDesignerFormEditorInterface *core, QWidget *parent)
diff --git a/src/designer/src/components/objectinspector/objectinspector.cpp b/src/designer/src/components/objectinspector/objectinspector.cpp
index 4267fea22..248041811 100644
--- a/src/designer/src/components/objectinspector/objectinspector.cpp
+++ b/src/designer/src/components/objectinspector/objectinspector.cpp
@@ -424,7 +424,7 @@ bool ObjectInspector::ObjectInspectorPrivate::selectObject(QObject *o)
using ModelIndexSet = QSet<QModelIndex>;
const QModelIndexList objectIndexes = indexesOf(o);
- if (objectIndexes.empty())
+ if (objectIndexes.isEmpty())
return false;
QItemSelectionModel *selectionModel = m_treeView->selectionModel();
@@ -432,8 +432,10 @@ bool ObjectInspector::ObjectInspectorPrivate::selectObject(QObject *o)
const ModelIndexSet currentSelectedItems(currentSelectedItemList.cbegin(), currentSelectedItemList.cend());
// Change in selection?
- if (!currentSelectedItems.empty() && currentSelectedItems == ModelIndexSet(objectIndexes.cbegin(), objectIndexes.cend()))
+ if (!currentSelectedItems.isEmpty()
+ && currentSelectedItems == ModelIndexSet(objectIndexes.cbegin(), objectIndexes.cend())) {
return true;
+ }
// do select and update
selectIndexRange(objectIndexes, MakeCurrent);
@@ -442,7 +444,7 @@ bool ObjectInspector::ObjectInspectorPrivate::selectObject(QObject *o)
void ObjectInspector::ObjectInspectorPrivate::selectIndexRange(const QModelIndexList &indexes, unsigned flags)
{
- if (indexes.empty())
+ if (indexes.isEmpty())
return;
QItemSelectionModel::SelectionFlags selectFlags = QItemSelectionModel::Select|QItemSelectionModel::Rows;
@@ -459,7 +461,7 @@ void ObjectInspector::ObjectInspectorPrivate::selectIndexRange(const QModelIndex
selectFlags &= ~(QItemSelectionModel::Clear|QItemSelectionModel::Current);
}
if (flags & MakeCurrent)
- m_treeView->scrollTo(indexes.front(), QAbstractItemView::EnsureVisible);
+ m_treeView->scrollTo(indexes.constFirst(), QAbstractItemView::EnsureVisible);
}
void ObjectInspector::ObjectInspectorPrivate::clear()
@@ -528,10 +530,10 @@ void ObjectInspector::ObjectInspectorPrivate::setFormWindowBlocked(QDesignerForm
bool applySelection = !mainContainerIsCurrent(m_formWindow);
if (!applySelection) {
const QModelIndexList currentIndexes = m_treeView->selectionModel()->selectedRows(0);
- if (currentIndexes.empty()) {
+ if (currentIndexes.isEmpty()) {
applySelection = true;
} else {
- applySelection = selectionType(m_formWindow, objectAt(currentIndexes.front())) == ManagedWidgetSelection;
+ applySelection = selectionType(m_formWindow, objectAt(currentIndexes.constFirst())) == ManagedWidgetSelection;
}
}
if (applySelection)
@@ -590,7 +592,7 @@ void ObjectInspector::ObjectInspectorPrivate::slotSelectionChanged(const QItemSe
// some index lists are multicolumn ranges
QObjectVector ObjectInspector::ObjectInspectorPrivate::indexesToObjects(const QModelIndexList &indexes) const
{
- if (indexes.empty())
+ if (indexes.isEmpty())
return QObjectVector();
QObjectVector rc;
rc.reserve(indexes.size());
@@ -638,11 +640,11 @@ void ObjectInspector::ObjectInspectorPrivate::synchronizeSelection(const QItemSe
const QModelIndexList currentSelectedIndexes = m_treeView->selectionModel()->selectedRows(0);
int deselectedManagedWidgetCount = 0;
- if (!deselected.empty())
+ if (!deselected.isEmpty())
deselectedManagedWidgetCount = selectInCursor(m_formWindow, deselected, false);
- if (newlySelected.empty()) { // Nothing selected
- if (currentSelectedIndexes.empty()) // Do not allow a null-selection, reset to main container
+ if (newlySelected.isEmpty()) { // Nothing selected
+ if (currentSelectedIndexes.isEmpty()) // Do not allow a null-selection, reset to main container
m_formWindow->clearSelection(!m_withinClearSelection);
return;
}
@@ -660,7 +662,7 @@ void ObjectInspector::ObjectInspectorPrivate::synchronizeSelection(const QItemSe
}
// And now for the unmanaged selection
m_formWindow->clearSelection(false);
- QObject *unmanagedObject = newlySelected.front();
+ QObject *unmanagedObject = newlySelected.constFirst();
m_core->propertyEditor()->setObject(unmanagedObject);
m_core->propertyEditor()->setEnabled(true);
// open container page if it is a single widget
@@ -670,7 +672,7 @@ void ObjectInspector::ObjectInspectorPrivate::synchronizeSelection(const QItemSe
}
// Open container page if it is a single widget
if (newlySelected.size() == 1) {
- QObject *object = newlySelected.back();
+ QObject *object = newlySelected.constFirst();
if (object->isWidgetType())
showContainersCurrentPage(static_cast<QWidget*>(object));
}
@@ -693,7 +695,7 @@ void ObjectInspector::ObjectInspectorPrivate::getSelection(Selection &s) const
return;
const QModelIndexList currentSelectedIndexes = m_treeView->selectionModel()->selectedRows(0);
- if (currentSelectedIndexes.empty())
+ if (currentSelectedIndexes.isEmpty())
return;
// sort objects
diff --git a/src/designer/src/components/objectinspector/objectinspectormodel.cpp b/src/designer/src/components/objectinspector/objectinspectormodel.cpp
index 6baf4bcdc..b980d3967 100644
--- a/src/designer/src/components/objectinspector/objectinspectormodel.cpp
+++ b/src/designer/src/components/objectinspector/objectinspectormodel.cpp
@@ -290,7 +290,7 @@ namespace qdesigner_internal {
}
QObjectList children = object->children();
- if (!children.empty()) {
+ if (!children.isEmpty()) {
ButtonGroupList buttonGroups;
std::sort(children.begin(), children.end(), sortEntry);
const QObjectList::const_iterator cend = children.constEnd();
@@ -310,7 +310,7 @@ namespace qdesigner_internal {
}
}
// Add button groups
- if (!buttonGroups.empty()) {
+ if (!buttonGroups.isEmpty()) {
const ButtonGroupList::const_iterator bgcend = buttonGroups.constEnd();
for (ButtonGroupList::const_iterator bgit = buttonGroups.constBegin(); bgit != bgcend; ++bgit)
createModelRecursion(fwi, object, *bgit, model, ctx);
@@ -319,7 +319,7 @@ namespace qdesigner_internal {
if (object->isWidgetType()) {
// Add actions
const ActionList actions = static_cast<QWidget*>(object)->actions();
- if (!actions.empty()) {
+ if (!actions.isEmpty()) {
const ActionList::const_iterator cend = actions.constEnd();
for (ActionList::const_iterator it = actions.constBegin(); it != cend; ++it)
if (ctx.mdb->item(*it)) {
@@ -415,7 +415,7 @@ namespace qdesigner_internal {
void ObjectInspectorModel::rebuild(const ObjectModel &newModel)
{
clearItems();
- if (newModel.empty())
+ if (newModel.isEmpty())
return;
const ObjectModel::const_iterator mcend = newModel.constEnd();
@@ -424,7 +424,7 @@ namespace qdesigner_internal {
StandardItemList rootRow = createModelRow(it->object());
it->setItems(rootRow, m_icons);
appendRow(rootRow);
- m_objectIndexMultiMap.insert(it->object(), indexFromItem(rootRow.front()));
+ m_objectIndexMultiMap.insert(it->object(), indexFromItem(rootRow.constFirst()));
for (++it; it != mcend; ++it) {
// Add to parent item, found via map
const QModelIndex parentIndex = m_objectIndexMultiMap.value(it->parent(), QModelIndex());
@@ -433,7 +433,7 @@ namespace qdesigner_internal {
StandardItemList row = createModelRow(it->object());
it->setItems(row, m_icons);
parentItem->appendRow(row);
- m_objectIndexMultiMap.insert(it->object(), indexFromItem(row.front()));
+ m_objectIndexMultiMap.insert(it->object(), indexFromItem(row.constFirst()));
}
}
diff --git a/src/designer/src/components/propertyeditor/designerpropertymanager.cpp b/src/designer/src/components/propertyeditor/designerpropertymanager.cpp
index 2f1a65940..ad1b6505c 100644
--- a/src/designer/src/components/propertyeditor/designerpropertymanager.cpp
+++ b/src/designer/src/components/propertyeditor/designerpropertymanager.cpp
@@ -2272,7 +2272,7 @@ void DesignerEditorFactory::disconnectPropertyManager(QtVariantPropertyManager *
template <class EditorContainer, class Editor, class SetterParameter, class Value>
static inline void applyToEditors(const EditorContainer &list, void (Editor::*setter)(SetterParameter), const Value &value)
{
- if (list.empty()) {
+ if (list.isEmpty()) {
return;
}
for (auto it = list.constBegin(), end = list.constEnd(); it != end; ++it) {
@@ -2659,7 +2659,7 @@ void DesignerEditorFactory::slotStringTextChanged(const QString &value)
PropertySheetStringValue strVal = qvariant_cast<PropertySheetStringValue>(val);
strVal.setValue(value);
// Disable translation if no translation subproperties exist.
- if (varProp->subProperties().empty())
+ if (varProp->subProperties().isEmpty())
strVal.setTranslatable(false);
val = QVariant::fromValue(strVal);
} else {
@@ -2725,7 +2725,7 @@ void DesignerEditorFactory::slotStringListChanged(const QStringList &value)
PropertySheetStringListValue listValue = qvariant_cast<PropertySheetStringListValue>(val);
listValue.setValue(value);
// Disable translation if no translation subproperties exist.
- if (varProp->subProperties().empty())
+ if (varProp->subProperties().isEmpty())
listValue.setTranslatable(false);
val = QVariant::fromValue(listValue);
} else {
diff --git a/src/designer/src/components/propertyeditor/fontpropertymanager.cpp b/src/designer/src/components/propertyeditor/fontpropertymanager.cpp
index a29867011..b34b288a5 100644
--- a/src/designer/src/components/propertyeditor/fontpropertymanager.cpp
+++ b/src/designer/src/components/propertyeditor/fontpropertymanager.cpp
@@ -86,7 +86,7 @@ namespace qdesigner_internal {
// Map the font family names to display names retrieved from the XML configuration
static QStringList designerFamilyNames(QStringList families, const FontPropertyManager::NameMap &nm)
{
- if (nm.empty())
+ if (nm.isEmpty())
return families;
const auto ncend = nm.constEnd();
@@ -117,9 +117,9 @@ namespace qdesigner_internal {
m_propertyToAntialiasing[property] = antialiasing;
m_antialiasingToProperty[antialiasing] = property;
// Fiddle family names
- if (!m_familyMappings.empty()) {
+ if (!m_familyMappings.isEmpty()) {
const PropertyToSubPropertiesMap::iterator it = m_propertyToFontSubProperties.find(m_createdFontProperty);
- QtVariantProperty *familyProperty = vm->variantProperty(it.value().front());
+ QtVariantProperty *familyProperty = vm->variantProperty(it.value().constFirst());
const QString enumNamesAttribute = QStringLiteral("enumNames");
QStringList plainFamilyNames = familyProperty->attributeValue(enumNamesAttribute).toStringList();
// Did someone load fonts or something?
diff --git a/src/designer/src/components/propertyeditor/propertyeditor.cpp b/src/designer/src/components/propertyeditor/propertyeditor.cpp
index af590a7d5..85724eb01 100644
--- a/src/designer/src/components/propertyeditor/propertyeditor.cpp
+++ b/src/designer/src/components/propertyeditor/propertyeditor.cpp
@@ -363,7 +363,7 @@ PropertyEditor::PropertyEditor(QDesignerFormEditorInterface *core, QWidget *pare
break;
}
// Restore expansionState from QVariant map
- if (!expansionState.empty()) {
+ if (!expansionState.isEmpty()) {
const QVariantMap::const_iterator cend = expansionState.constEnd();
for (QVariantMap::const_iterator it = expansionState.constBegin(); it != cend; ++it)
m_expansionState.insert(it.key(), it.value().toBool());
@@ -386,7 +386,7 @@ void PropertyEditor::saveSettings() const
settings->setValue(QLatin1String(SortedKeyC), QVariant(m_sorting));
// Save last expansionState as QVariant map
QVariantMap expansionState;
- if (!m_expansionState.empty()) {
+ if (!m_expansionState.isEmpty()) {
const QMap<QString, bool>::const_iterator cend = m_expansionState.constEnd();
for (QMap<QString, bool>::const_iterator it = m_expansionState.constBegin(); it != cend; ++it)
expansionState.insert(it.key(), QVariant(it.value()));
@@ -436,7 +436,7 @@ void PropertyEditor::storePropertiesExpansionState(const QList<QtBrowserItem *>
{
const QChar bar = QLatin1Char('|');
for (QtBrowserItem *propertyItem : items) {
- if (!propertyItem->children().empty()) {
+ if (!propertyItem->children().isEmpty()) {
QtProperty *property = propertyItem->property();
const QString propertyName = property->propertyName();
const QMap<QtProperty *, QString>::const_iterator itGroup = m_propertyToGroup.constFind(property);
@@ -459,7 +459,7 @@ void PropertyEditor::storeExpansionState()
for (QtBrowserItem *item : items) {
const QString groupName = item->property()->propertyName();
QList<QtBrowserItem *> propertyItems = item->children();
- if (!propertyItems.empty())
+ if (!propertyItems.isEmpty())
m_expansionState[groupName] = isExpanded(item);
// properties stuff here
@@ -814,7 +814,7 @@ void PropertyEditor::updateBrowserValue(QtVariantProperty *property, const QVari
}
// Rich text string property with comment: Store/Update the font the rich text editor dialog starts out with
- if (type == QVariant::String && !property->subProperties().empty()) {
+ if (type == QVariant::String && !property->subProperties().isEmpty()) {
const int fontIndex = m_propertySheet->indexOf(m_strings.m_fontProperty);
if (fontIndex != -1)
property->setAttribute(m_strings.m_fontAttribute, m_propertySheet->property(fontIndex));
@@ -1093,8 +1093,8 @@ void PropertyEditor::setObject(QObject *object)
lastGroup = groupProperty;
lastProperty = nullptr; // Append at end
const QList<QtProperty*> subProperties = lastGroup->subProperties();
- if (!subProperties.empty())
- lastProperty = subProperties.back();
+ if (!subProperties.isEmpty())
+ lastProperty = subProperties.constLast();
lastGroup = groupProperty;
}
if (!m_groups.contains(groupProperty))
@@ -1123,7 +1123,7 @@ void PropertyEditor::setObject(QObject *object)
QMap<QString, QtVariantProperty *> groups = m_nameToGroup;
for (auto itGroup = groups.cbegin(), end = groups.cend(); itGroup != end; ++itGroup) {
QtVariantProperty *groupProperty = itGroup.value();
- if (groupProperty->subProperties().empty()) {
+ if (groupProperty->subProperties().isEmpty()) {
if (groupProperty == m_dynamicGroup)
m_dynamicGroup = nullptr;
delete groupProperty;
@@ -1247,7 +1247,7 @@ void PropertyEditor::editProperty(const QString &name)
if (QtVariantProperty *property = m_nameToProperty.value(name, 0)) {
const QList<QtBrowserItem *> items = m_currentBrowser->items(property);
if (items.size() == 1)
- browserItem = items.front();
+ browserItem = items.constFirst();
}
if (browserItem == nullptr)
return;
diff --git a/src/designer/src/components/signalsloteditor/connectdialog.cpp b/src/designer/src/components/signalsloteditor/connectdialog.cpp
index 571ddba12..6eef6dcc7 100644
--- a/src/designer/src/components/signalsloteditor/connectdialog.cpp
+++ b/src/designer/src/components/signalsloteditor/connectdialog.cpp
@@ -140,20 +140,20 @@ void ConnectDialog::setSignalSlot(const QString &signal, const QString &slot)
{
ListWidgetItems sigItems = m_ui.signalList->findItems(signal, Qt::MatchExactly);
- if (sigItems.empty()) {
+ if (sigItems.isEmpty()) {
m_ui.showAllCheckBox->setChecked(true);
sigItems = m_ui.signalList->findItems(signal, Qt::MatchExactly);
}
- if (!sigItems.empty()) {
- selectSignal(sigItems.front());
+ if (!sigItems.isEmpty()) {
+ selectSignal(sigItems.constFirst());
ListWidgetItems slotItems = m_ui.slotList->findItems(slot, Qt::MatchExactly);
- if (slotItems.empty()) {
+ if (slotItems.isEmpty()) {
m_ui.showAllCheckBox->setChecked(true);
slotItems = m_ui.slotList->findItems(slot, Qt::MatchExactly);
}
- if (!slotItems.empty())
- selectSlot(slotItems.front());
+ if (!slotItems.isEmpty())
+ selectSlot(slotItems.constFirst());
}
}
diff --git a/src/designer/src/components/signalsloteditor/signalslot_utils.cpp b/src/designer/src/components/signalsloteditor/signalslot_utils.cpp
index f913b5bdf..c7a960ef3 100644
--- a/src/designer/src/components/signalsloteditor/signalslot_utils.cpp
+++ b/src/designer/src/components/signalsloteditor/signalslot_utils.cpp
@@ -93,7 +93,7 @@ static void memberList(QDesignerFormEditorInterface *core,
const QString className = wdbItem->name();
const QStringList wdbFakeMethods = member_type == qdesigner_internal::SlotMember ? wdbItem->fakeSlots() : wdbItem->fakeSignals();
- if (!wdbFakeMethods.empty())
+ if (!wdbFakeMethods.isEmpty())
for (const QString &fakeMethod : wdbFakeMethods)
if (predicate(fakeMethod)) {
*it = ClassNameSignaturePair(className, fakeMethod);
@@ -106,7 +106,7 @@ static void memberList(QDesignerFormEditorInterface *core,
if (const qdesigner_internal::MetaDataBaseItem *mdbItem = metaDataBase->metaDataBaseItem(object)) {
const QStringList mdbFakeMethods = member_type == qdesigner_internal::SlotMember ? mdbItem->fakeSlots() : mdbItem->fakeSignals();
- if (!mdbFakeMethods.empty())
+ if (!mdbFakeMethods.isEmpty())
for (const QString &fakeMethod : mdbFakeMethods)
if (predicate(fakeMethod)) {
*it = ClassNameSignaturePair(className, fakeMethod);
@@ -266,7 +266,7 @@ namespace qdesigner_internal {
{
QMap<QString, QString> rc;
memberList(core, object, type, true, EqualsPredicate(signature), SignatureIterator(&rc));
- return !rc.empty();
+ return !rc.isEmpty();
}
// ### deprecated
diff --git a/src/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp b/src/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp
index c2f53a46e..175b4f6a8 100644
--- a/src/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp
+++ b/src/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp
@@ -105,7 +105,7 @@ static QStringList objectNameList(QDesignerFormWindowInterface *form)
// Add managed actions and actions with managed menus
const ActionList actions = mainContainer->findChildren<QAction*>();
- if (!actions.empty()) {
+ if (!actions.isEmpty()) {
const ActionList::const_iterator cend = actions.constEnd();
for (ActionList::const_iterator it = actions.constBegin(); it != cend; ++it) {
QAction *a = *it;
@@ -123,7 +123,7 @@ static QStringList objectNameList(QDesignerFormWindowInterface *form)
// Add managed buttons groups
const ButtonGroupList buttonGroups = mainContainer->findChildren<QButtonGroup *>();
- if (!buttonGroups.empty()) {
+ if (!buttonGroups.isEmpty()) {
const ButtonGroupList::const_iterator cend = buttonGroups.constEnd();
for (ButtonGroupList::const_iterator it = buttonGroups.constBegin(); it != cend; ++it)
if (mdb->item(*it))
diff --git a/src/designer/src/components/taskmenu/button_taskmenu.cpp b/src/designer/src/components/taskmenu/button_taskmenu.cpp
index 5791c6991..80e9d45c3 100644
--- a/src/designer/src/components/taskmenu/button_taskmenu.cpp
+++ b/src/designer/src/components/taskmenu/button_taskmenu.cpp
@@ -211,7 +211,7 @@ CreateButtonGroupCommand::CreateButtonGroupCommand(QDesignerFormWindowInterface
bool CreateButtonGroupCommand::init(const ButtonList &bl)
{
- if (bl.empty())
+ if (bl.isEmpty())
return false;
QDesignerFormWindowInterface *fw = formWindow();
QButtonGroup *buttonGroup = new QButtonGroup(fw->mainContainer());
@@ -286,9 +286,9 @@ RemoveButtonsFromGroupCommand::RemoveButtonsFromGroupCommand(QDesignerFormWindow
bool RemoveButtonsFromGroupCommand::init(const ButtonList &bl)
{
- if (bl.empty())
+ if (bl.isEmpty())
return false;
- QButtonGroup *group = bl.front()->group();
+ QButtonGroup *group = bl.constFirst()->group();
if (!group)
return false;
if (bl.size() >= group->buttons().size())
@@ -560,7 +560,7 @@ static ButtonList buttonList(const QDesignerFormWindowCursorInterface *cursor)
static QUndoCommand *createRemoveButtonsCommand(QDesignerFormWindowInterface *fw, const ButtonList &bl)
{
- QButtonGroup *bg = bl.front()->group();
+ QButtonGroup *bg = bl.constFirst()->group();
// Complete group or 1-member group?
if (bl.size() >= bg->buttons().size() - 1) {
BreakButtonGroupCommand *breakCmd = new BreakButtonGroupCommand(fw);
@@ -588,7 +588,7 @@ void ButtonTaskMenu::createGroup()
const ButtonList bl = buttonList(fw->cursor());
// Do we need to remove the buttons from an existing group?
QUndoCommand *removeCmd = nullptr;
- if (bl.front()->group()) {
+ if (bl.constFirst()->group()) {
removeCmd = createRemoveButtonsCommand(fw, bl);
if (!removeCmd)
return;
@@ -651,7 +651,7 @@ void ButtonTaskMenu::addToGroup(QAction *a)
const ButtonList bl = buttonList(fw->cursor());
// Do we need to remove the buttons from an existing group?
QUndoCommand *removeCmd = nullptr;
- if (bl.front()->group()) {
+ if (bl.constFirst()->group()) {
removeCmd = createRemoveButtonsCommand(fw, bl);
if (!removeCmd)
return;
diff --git a/src/designer/src/components/widgetbox/widgetbox_dnditem.cpp b/src/designer/src/components/widgetbox/widgetbox_dnditem.cpp
index 30fbc2337..c44fa4169 100644
--- a/src/designer/src/components/widgetbox/widgetbox_dnditem.cpp
+++ b/src/designer/src/components/widgetbox/widgetbox_dnditem.cpp
@@ -174,7 +174,7 @@ static QWidget *decorationFromDomWidget(DomUI *dom_ui, QDesignerFormEditorInterf
QWidget *fakeTopLevel = builder.createUI(dom_ui, nullptr);
fakeTopLevel->setParent(nullptr, Qt::ToolTip); // Container
// Actual widget
- const DomWidget *domW = dom_ui->elementWidget()->elementWidget().front();
+ const DomWidget *domW = dom_ui->elementWidget()->elementWidget().constFirst();
QWidget *w = fakeTopLevel->findChildren<QWidget*>().constFirst();
Q_ASSERT(w);
// hack begin;
diff --git a/src/designer/src/components/widgetbox/widgetboxtreewidget.cpp b/src/designer/src/components/widgetbox/widgetboxtreewidget.cpp
index dd17b3a4e..a170fa7c7 100644
--- a/src/designer/src/components/widgetbox/widgetboxtreewidget.cpp
+++ b/src/designer/src/components/widgetbox/widgetboxtreewidget.cpp
@@ -160,7 +160,7 @@ void WidgetBoxTreeWidget::restoreExpandedState()
const auto &closedCategoryList = settings->value(groupKey + QLatin1String(widgetBoxExpandedKeyC), QStringList()).toStringList();
const StringSet closedCategories(closedCategoryList.cbegin(), closedCategoryList.cend());
expandAll();
- if (closedCategories.empty())
+ if (closedCategories.isEmpty())
return;
if (const int numCategories = categoryCount()) {
@@ -594,8 +594,7 @@ static inline bool isValidIcon(const QIcon &icon)
{
if (!icon.isNull()) {
const QList<QSize> availableSizes = icon.availableSizes();
- if (!availableSizes.empty())
- return !availableSizes.front().isEmpty();
+ return !availableSizes.isEmpty() && !availableSizes.constFirst().isEmpty();
}
return false;
}
@@ -606,7 +605,7 @@ WidgetBoxTreeWidget::CategoryList WidgetBoxTreeWidget::loadCustomCategoryList()
const QDesignerPluginManager *pm = m_core->pluginManager();
const QDesignerPluginManager::CustomWidgetList customWidgets = pm->registeredCustomWidgets();
- if (customWidgets.empty())
+ if (customWidgets.isEmpty())
return result;
static const QString customCatName = tr("Custom Widgets");