diff options
Diffstat (limited to 'src/designer/src/components/objectinspector/objectinspector.cpp')
-rw-r--r-- | src/designer/src/components/objectinspector/objectinspector.cpp | 28 |
1 files changed, 15 insertions, 13 deletions
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 |