summaryrefslogtreecommitdiff
path: root/src/designer/src/components/propertyeditor
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2019-11-08 13:49:49 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2019-11-15 16:23:21 +0100
commite8a4f4a92cfbab9fd43aea326dc5a7c88dbe390a (patch)
tree368c889fe1a1be32eea35730c7722cb6d04db8de /src/designer/src/components/propertyeditor
parentec4b367cc41375564b6869cea833b60484965ac9 (diff)
downloadqttools-e8a4f4a92cfbab9fd43aea326dc5a7c88dbe390a.tar.gz
Qt Designer: Fix Qt API usage
Replace: empty() by isEmpty() front()/back() by constFirst()/constLast(), preventing detaching Streamline some code. Task-number: QTBUG-79896 Change-Id: Ic3f8414db79a83a30b55369a9352f332b41aa621 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Diffstat (limited to 'src/designer/src/components/propertyeditor')
-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
3 files changed, 15 insertions, 15 deletions
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;