diff options
author | Marco Bubke <marco.bubke@qt.io> | 2023-06-07 13:03:11 +0200 |
---|---|---|
committer | Marco Bubke <marco.bubke@qt.io> | 2023-06-07 11:31:25 +0000 |
commit | 278d69df4f5807e5049203e1cb2dccef2836b6a9 (patch) | |
tree | 38f527d4008f17dd2dcefcd492026e4dbd830e9d | |
parent | 63f366efdd37b855d956ff239b3d6a30aa8c5e0a (diff) |
QmlDesigner: Fix deprecated function calls
count() -> size()
userType() -> typeId()
type() -> typeId()
Fixes: QTCREATORBUG-29237
Change-Id: Ic63b79f6fab1f6ed5227d97aa12dcbfdebb4f05f
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
105 files changed, 394 insertions, 437 deletions
diff --git a/src/plugins/qmldesigner/assetexporterplugin/filepathmodel.cpp b/src/plugins/qmldesigner/assetexporterplugin/filepathmodel.cpp index 5020b095a3..f5df42df39 100644 --- a/src/plugins/qmldesigner/assetexporterplugin/filepathmodel.cpp +++ b/src/plugins/qmldesigner/assetexporterplugin/filepathmodel.cpp @@ -67,7 +67,7 @@ Qt::ItemFlags FilePathModel::flags(const QModelIndex &index) const int FilePathModel::rowCount(const QModelIndex &parent) const { if (!parent.isValid()) - return m_files.count(); + return m_files.size(); return 0; } @@ -123,12 +123,14 @@ void FilePathModel::processProject() beginResetModel(); m_preprocessWatcher.reset(new QFutureWatcher<Utils::FilePath>(this)); - connect(m_preprocessWatcher.get(), &QFutureWatcher<Utils::FilePath>::resultReadyAt, this, + connect(m_preprocessWatcher.get(), + &QFutureWatcher<Utils::FilePath>::resultReadyAt, + this, [this](int resultIndex) { - beginInsertRows(index(0, 0) , m_files.count(), m_files.count()); - m_files.append(m_preprocessWatcher->resultAt(resultIndex)); - endInsertRows(); - }); + beginInsertRows(index(0, 0), m_files.size(), m_files.size()); + m_files.append(m_preprocessWatcher->resultAt(resultIndex)); + endInsertRows(); + }); connect(m_preprocessWatcher.get(), &QFutureWatcher<Utils::FilePath>::finished, this, &FilePathModel::endResetModel); diff --git a/src/plugins/qmldesigner/components/annotationeditor/annotationtableview.cpp b/src/plugins/qmldesigner/components/annotationeditor/annotationtableview.cpp index 7c8daa5eeb..f3cc629dd8 100644 --- a/src/plugins/qmldesigner/components/annotationeditor/annotationtableview.cpp +++ b/src/plugins/qmldesigner/components/annotationeditor/annotationtableview.cpp @@ -66,7 +66,7 @@ void CommentDelegate::updateEditorGeometry(QWidget *editor, editor->setGeometry(option.rect); } -Comment CommentDelegate::comment(QModelIndex const &index) +Comment CommentDelegate::comment(const QModelIndex &index) { auto *model = index.model(); return model->data(model->index(index.row(), ColumnId::Title), CommentRole).value<Comment>(); @@ -136,9 +136,9 @@ void CommentValueDelegate::paint(QPainter *painter, const QModelIndex &index) const { auto data = index.model()->data(index, Qt::DisplayRole); - if (data.userType() == qMetaTypeId<RichTextProxy>()) + if (data.typeId() == qMetaTypeId<RichTextProxy>()) drawDisplay(painter, option, option.rect, data.value<RichTextProxy>().plainText()); - else if (data.userType() == QMetaType::QColor) + else if (data.typeId() == QMetaType::QColor) painter->fillRect(option.rect, data.value<QColor>()); else QItemDelegate::paint(painter, option, index); @@ -147,7 +147,7 @@ void CommentValueDelegate::paint(QPainter *painter, void CommentValueDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const { auto data = index.model()->data(index, Qt::DisplayRole); - if (data.userType() == qMetaTypeId<RichTextProxy>()) { + if (data.typeId() == qMetaTypeId<RichTextProxy>()) { auto richText = data.value<RichTextProxy>(); auto *e = qobject_cast<RichTextCellEditor *>(editor); e->setText(richText.plainText()); @@ -157,10 +157,10 @@ void CommentValueDelegate::setEditorData(QWidget *editor, const QModelIndex &ind this, &CommentValueDelegate::richTextEditorRequested, Qt::UniqueConnection); - } else if (data.userType() == QMetaType::QString) { + } else if (data.typeId() == QMetaType::QString) { auto *e = qobject_cast<QLineEdit *>(editor); e->setText(data.toString()); - } else if (data.userType() == QMetaType::QColor) { + } else if (data.typeId() == QMetaType::QColor) { auto *e = qobject_cast<AnnotationTableColorButton *>(editor); e->setColor(data.value<QColor>()); e->installEventFilter(e); @@ -206,15 +206,13 @@ void CommentValueDelegate::setModelData(QWidget *editor, const QModelIndex &index) const { auto data = model->data(index, Qt::EditRole); - if (data.userType() == qMetaTypeId<RichTextProxy>()) + if (data.typeId() == qMetaTypeId<RichTextProxy>()) return; - else if (data.userType() == QMetaType::QColor) - { + else if (data.typeId() == QMetaType::QColor) { model->setData(index, qobject_cast<AnnotationTableColorButton *>(editor)->color(), Qt::DisplayRole); - } - else if (data.userType() == QMetaType::QString) + } else if (data.typeId() == QMetaType::QString) model->setData(index, qobject_cast<QLineEdit *>(editor)->text(), Qt::DisplayRole); else QItemDelegate::setModelData(editor, model, index); @@ -288,7 +286,7 @@ AnnotationTableView::AnnotationTableView(QWidget *parent) // When comment title was edited, make value item editable if (item->column() == ColumnId::Title && valueItem) { valueItem->setEditable(!item->text().isEmpty()); - valueItem->setCheckable(valueItem->data(Qt::DisplayRole).userType() == QMetaType::Bool); + valueItem->setCheckable(valueItem->data(Qt::DisplayRole).typeId() == QMetaType::Bool); } m_modelUpdating = true; @@ -344,7 +342,7 @@ Comment AnnotationTableView::fetchComment(int row) const return comment; } -void AnnotationTableView::setupComments(QVector<Comment> const &comments) +void AnnotationTableView::setupComments(const QVector<Comment> &comments) { m_model->clear(); m_modelUpdating = true; @@ -379,7 +377,7 @@ void AnnotationTableView::setDefaultAnnotations(DefaultAnnotationsModel *default m_valueDelegate.setDefaultAnnotations(defaults); } -void AnnotationTableView::changeRow(int index, Comment const &comment) +void AnnotationTableView::changeRow(int index, const Comment &comment) { auto *titleItem = m_model->item(index, ColumnId::Title); auto *authorItem = m_model->item(index, ColumnId::Author); @@ -395,7 +393,7 @@ void AnnotationTableView::changeRow(int index, Comment const &comment) : QMetaType::UnknownType); textItem->setEditable(data.isValid()); - textItem->setCheckable(data.userType() == QMetaType::Bool); + textItem->setCheckable(data.typeId() == QMetaType::Bool); textItem->setData(data, Qt::DisplayRole); } @@ -433,9 +431,9 @@ bool AnnotationTableView::rowIsEmpty(int row) const return QString(itemText(0) + itemText(1) + itemText(2)).isEmpty(); } -QString AnnotationTableView::dataToCommentText(QVariant const &data) +QString AnnotationTableView::dataToCommentText(const QVariant &data) { - auto type = data.userType(); + auto type = data.typeId(); if (type == qMetaTypeId<RichTextProxy>()) return data.value<RichTextProxy>().text; @@ -451,7 +449,7 @@ QString AnnotationTableView::dataToCommentText(QVariant const &data) return {}; } -QVariant AnnotationTableView::commentToData(Comment const& comment, QMetaType::Type type) +QVariant AnnotationTableView::commentToData(const Comment &comment, QMetaType::Type type) { switch (type) { case QMetaType::Bool: diff --git a/src/plugins/qmldesigner/components/annotationeditor/defaultannotations.cpp b/src/plugins/qmldesigner/components/annotationeditor/defaultannotations.cpp index 7a9212d535..d3a302a782 100644 --- a/src/plugins/qmldesigner/components/annotationeditor/defaultannotations.cpp +++ b/src/plugins/qmldesigner/components/annotationeditor/defaultannotations.cpp @@ -58,7 +58,7 @@ bool DefaultAnnotationsModel::hasDefault(const Comment &comment) const QMetaType::Type DefaultAnnotationsModel::defaultType(const Comment &comment) const { - return hasDefault(comment) ? QMetaType::Type(m_defaultMap[comment.title().toLower()].userType()) + return hasDefault(comment) ? QMetaType::Type(m_defaultMap[comment.title().toLower()].typeId()) : QMetaType::UnknownType; } @@ -73,7 +73,7 @@ bool DefaultAnnotationsModel::isRichText(const Comment &comment) const return type == QMetaType::UnknownType || type == qMetaTypeId<RichTextProxy>(); } -void DefaultAnnotationsModel::loadFromFile(QString const &filename) +void DefaultAnnotationsModel::loadFromFile(const QString &filename) { QFile file(filename); if (file.open(QFile::ReadOnly)) { diff --git a/src/plugins/qmldesigner/components/bindingeditor/actioneditordialog.cpp b/src/plugins/qmldesigner/components/bindingeditor/actioneditordialog.cpp index ba797ee1a7..8fddcb1ade 100644 --- a/src/plugins/qmldesigner/components/bindingeditor/actioneditordialog.cpp +++ b/src/plugins/qmldesigner/components/bindingeditor/actioneditordialog.cpp @@ -88,7 +88,7 @@ void ActionEditorDialog::adjustProperties() bool typeDone = false; bool targetDone = false; - for (int i = 0; i < expression.count(); ++i) { + for (int i = 0; i < expression.size(); ++i) { switch (expression[i].first) { case QmlJS::AST::Node::Kind::Kind_CallExpression: @@ -592,7 +592,7 @@ void ActionEditorDialog::fillAndSetSourceProperty(const QString &value, for (const auto &state : std::as_const(m_states)) m_assignmentSourceProperty->addItem(state, specificItem); - specificsEnd = m_states.count(); + specificsEnd = m_states.size(); } if (specificsEnd != -1) diff --git a/src/plugins/qmldesigner/components/componentcore/designeractionmanager.cpp b/src/plugins/qmldesigner/components/componentcore/designeractionmanager.cpp index 77976993e4..32a3d4af70 100644 --- a/src/plugins/qmldesigner/components/componentcore/designeractionmanager.cpp +++ b/src/plugins/qmldesigner/components/componentcore/designeractionmanager.cpp @@ -50,7 +50,7 @@ namespace QmlDesigner { -static inline QString captionForModelNode(const ModelNode &modelNode) +inline static QString captionForModelNode(const ModelNode &modelNode) { if (modelNode.id().isEmpty()) return modelNode.simplifiedTypeName(); @@ -58,7 +58,7 @@ static inline QString captionForModelNode(const ModelNode &modelNode) return modelNode.id(); } -static inline bool contains(const QmlItemNode &node, const QPointF &position) +inline static bool contains(const QmlItemNode &node, const QPointF &position) { return node.isValid() && node.instanceSceneTransform().mapRect(node.instanceBoundingRect()).contains(position); } @@ -1208,7 +1208,7 @@ bool isStackedContainerAndIndexCanBeIncreased(const SelectionContext &context) const int value = containerItemNode.instanceValue(propertyName).toInt(); - const int maxValue = currentSelectedNode.directSubModelNodes().count() - 1; + const int maxValue = currentSelectedNode.directSubModelNodes().size() - 1; return value < maxValue; } diff --git a/src/plugins/qmldesigner/components/componentcore/formatoperation.cpp b/src/plugins/qmldesigner/components/componentcore/formatoperation.cpp index 4676e0f46a..546ad0cc6b 100644 --- a/src/plugins/qmldesigner/components/componentcore/formatoperation.cpp +++ b/src/plugins/qmldesigner/components/componentcore/formatoperation.cpp @@ -52,7 +52,7 @@ void readFormatConfiguration(){ QVariantMap rootMap = jsonObject.toVariantMap(); QJsonArray jsonArray = rootMap["propertylist"].toJsonArray(); - for (int i=0; i< jsonArray.count(); ++i){ + for (int i = 0; i < jsonArray.size(); ++i) { auto item = jsonArray.at(i).toObject(); QVariantMap itemMap = item.toVariantMap(); StylePropertyStruct current; diff --git a/src/plugins/qmldesigner/components/componentcore/layoutingridlayout.cpp b/src/plugins/qmldesigner/components/componentcore/layoutingridlayout.cpp index 09d3fdeffd..89a5868d89 100644 --- a/src/plugins/qmldesigner/components/componentcore/layoutingridlayout.cpp +++ b/src/plugins/qmldesigner/components/componentcore/layoutingridlayout.cpp @@ -15,7 +15,7 @@ namespace QmlDesigner { -static inline void reparentTo(const ModelNode &node, const QmlItemNode &parent) +inline static void reparentTo(const ModelNode &node, const QmlItemNode &parent) { if (parent.isValid() && node.isValid()) { @@ -78,7 +78,7 @@ static int lowerBound(int i) return i; } -static inline QPointF getUpperLeftPosition(const QList<ModelNode> &modelNodeList) +inline static QPointF getUpperLeftPosition(const QList<ModelNode> &modelNodeList) { QPointF postion(std::numeric_limits<qreal>::max(), std::numeric_limits<qreal>::max()); for (const ModelNode &modelNode : modelNodeList) { @@ -193,7 +193,7 @@ void LayoutInGridLayout::doIt() } } -bool static hasQtQuickLayoutImport(const SelectionContext &context) +static bool hasQtQuickLayoutImport(const SelectionContext &context) { if (context.view() && context.view()->model()) { Import import = Import::createLibraryImport(QStringLiteral("QtQuick.Layouts"), QStringLiteral("1.0")); @@ -219,12 +219,12 @@ void LayoutInGridLayout::layout(const SelectionContext &context) int LayoutInGridLayout::columnCount() const { - return m_xTopOffsets.count(); + return m_xTopOffsets.size(); } int LayoutInGridLayout::rowCount() const { - return m_yTopOffsets.count(); + return m_yTopOffsets.size(); } void LayoutInGridLayout::collectItemNodes() diff --git a/src/plugins/qmldesigner/components/componentcore/modelnodeoperations.cpp b/src/plugins/qmldesigner/components/componentcore/modelnodeoperations.cpp index 258ae0ba92..d791b04672 100644 --- a/src/plugins/qmldesigner/components/componentcore/modelnodeoperations.cpp +++ b/src/plugins/qmldesigner/components/componentcore/modelnodeoperations.cpp @@ -88,7 +88,7 @@ Utils::SmallString auxPropertyString(Utils::SmallStringView name) } } // namespace -static inline void reparentTo(const ModelNode &node, const QmlItemNode &parent) +inline static void reparentTo(const ModelNode &node, const QmlItemNode &parent) { if (parent.isValid() && node.isValid()) { @@ -103,7 +103,7 @@ static inline void reparentTo(const ModelNode &node, const QmlItemNode &parent) } } -static inline QPointF getUpperLeftPosition(const QList<ModelNode> &modelNodeList) +inline static QPointF getUpperLeftPosition(const QList<ModelNode> &modelNodeList) { QPointF postion(std::numeric_limits<qreal>::max(), std::numeric_limits<qreal>::max()); for (const ModelNode &modelNode : modelNodeList) { @@ -364,7 +364,7 @@ void reverse(const SelectionContext &selectionState) }); } -static inline void backupPropertyAndRemove(const ModelNode &node, const PropertyName &propertyName) +inline static void backupPropertyAndRemove(const ModelNode &node, const PropertyName &propertyName) { if (node.hasVariantProperty(propertyName)) { node.setAuxiliaryData(AuxiliaryDataType::Document, @@ -695,7 +695,8 @@ void addSignalHandlerOrGotoImplementation(const SelectionContext &selectionState Core::ModeManager::activateMode(Core::Constants::MODE_EDIT); - if (!usages.isEmpty() && (addAlwaysNewSlot || usages.count() < 2) && (!isModelNodeRoot || addAlwaysNewSlot)) { + if (!usages.isEmpty() && (addAlwaysNewSlot || usages.size() < 2) + && (!isModelNodeRoot || addAlwaysNewSlot)) { Core::EditorManager::openEditorAt( {usages.constFirst().path, usages.constFirst().line, usages.constFirst().col}); @@ -879,7 +880,7 @@ void addItemToStackedContainer(const SelectionContext &selectionContext) if (potentialTabBar.isValid()) {// The stacked container is hooked up to a TabBar NodeMetaInfo tabButtonMetaInfo = view->model()->metaInfo("QtQuick.Controls.TabButton", -1, -1); if (tabButtonMetaInfo.isValid()) { - const int buttonIndex = potentialTabBar.directSubModelNodes().count(); + const int buttonIndex = potentialTabBar.directSubModelNodes().size(); ModelNode tabButtonNode = view->createModelNode("QtQuick.Controls.TabButton", tabButtonMetaInfo.majorVersion(), @@ -949,7 +950,7 @@ void increaseIndexOfStackedContainer(const SelectionContext &selectionContext) int value = containerItemNode.instanceValue(propertyName).toInt(); ++value; - const int maxValue = container.directSubModelNodes().count(); + const int maxValue = container.directSubModelNodes().size(); QTC_ASSERT(value < maxValue, return); @@ -1012,7 +1013,7 @@ void addTabBarToStackedContainer(const SelectionContext &selectionContext) container.parentProperty().reparentHere(tabBarNode); - const int maxValue = container.directSubModelNodes().count(); + const int maxValue = container.directSubModelNodes().size(); QmlItemNode tabBarItem(tabBarNode); @@ -1239,8 +1240,7 @@ void setFlowStartItem(const SelectionContext &selectionContext) }); } - -bool static hasStudioComponentsImport(const SelectionContext &context) +static bool hasStudioComponentsImport(const SelectionContext &context) { if (context.view() && context.view()->model()) { Import import = Import::createLibraryImport("QtQuick.Studio.Components", "1.0"); @@ -1250,7 +1250,7 @@ bool static hasStudioComponentsImport(const SelectionContext &context) return false; } -static inline void setAdjustedPos(const QmlDesigner::ModelNode &modelNode) +inline static void setAdjustedPos(const QmlDesigner::ModelNode &modelNode) { if (modelNode.hasParentProperty()) { ModelNode parentNode = modelNode.parentProperty().parentModelNode(); diff --git a/src/plugins/qmldesigner/components/componentcore/svgpasteaction.cpp b/src/plugins/qmldesigner/components/componentcore/svgpasteaction.cpp index 99bf56078b..738b1affed 100644 --- a/src/plugins/qmldesigner/components/componentcore/svgpasteaction.cpp +++ b/src/plugins/qmldesigner/components/componentcore/svgpasteaction.cpp @@ -27,7 +27,7 @@ namespace { /* Copied from qquicksvgparser.cpp 3e783b26a8fb41e3f5a53b883735f5d10fbbd98a */ // '0' is 0x30 and '9' is 0x39 -static inline bool isDigit(ushort ch) +inline static bool isDigit(ushort ch) { static quint16 magic = 0x3ff; return ((ch >> 4) == 3) && (magic >> (ch & 15)); @@ -110,7 +110,7 @@ static qreal toDouble(const QChar *&str) return val; } -static inline void parseNumbersArray(const QChar *&str, QVarLengthArray<qreal, 8> &points) +inline static void parseNumbersArray(const QChar *&str, QVarLengthArray<qreal, 8> &points) { while (str->isSpace()) ++str; @@ -261,7 +261,7 @@ bool parsePathDataFast(const QString &dataStr, QPainterPath &path) if (pathElem == QLatin1Char('z') || pathElem == QLatin1Char('Z')) arg.append(0);//dummy const qreal *num = arg.constData(); - int count = arg.count(); + int count = arg.size(); while (count > 0) { qreal offsetX = x; // correction offsets qreal offsetY = y; // for relative commands diff --git a/src/plugins/qmldesigner/components/connectioneditor/backendmodel.cpp b/src/plugins/qmldesigner/components/connectioneditor/backendmodel.cpp index 6c970f2646..5778d8242f 100644 --- a/src/plugins/qmldesigner/components/connectioneditor/backendmodel.cpp +++ b/src/plugins/qmldesigner/components/connectioneditor/backendmodel.cpp @@ -203,7 +203,7 @@ void BackendModel::addNewBackend() if (dialog.applied()) { QStringList importSplit = dialog.importString().split(" "); - if (importSplit.count() != 2) { + if (importSplit.size() != 2) { qWarning() << Q_FUNC_INFO << "invalid import" << importSplit; QTC_ASSERT(false, return); } diff --git a/src/plugins/qmldesigner/components/connectioneditor/bindingmodel.cpp b/src/plugins/qmldesigner/components/connectioneditor/bindingmodel.cpp index e0a8f03e99..191900d5e9 100644 --- a/src/plugins/qmldesigner/components/connectioneditor/bindingmodel.cpp +++ b/src/plugins/qmldesigner/components/connectioneditor/bindingmodel.cpp @@ -217,7 +217,7 @@ static PropertyName unusedProperty(const ModelNode &modelNode) void BindingModel::addBindingForCurrentNode() { - if (connectionView()->selectedModelNodes().count() == 1) { + if (connectionView()->selectedModelNodes().size() == 1) { const ModelNode modelNode = connectionView()->selectedModelNodes().constFirst(); if (modelNode.isValid()) { try { @@ -380,9 +380,9 @@ bool BindingModel::getExpressionStrings(const BindingProperty &bindingProperty, QString propertyName; - for (int i=1; i < stringList.count(); i++) { + for (int i = 1; i < stringList.size(); i++) { propertyName += stringList.at(i); - if (i != stringList.count() - 1) + if (i != stringList.size() - 1) propertyName += QLatin1String("."); } *sourceProperty = propertyName; diff --git a/src/plugins/qmldesigner/components/connectioneditor/connectionmodel.cpp b/src/plugins/qmldesigner/components/connectioneditor/connectionmodel.cpp index 25a5756c28..4abb7b2137 100644 --- a/src/plugins/qmldesigner/components/connectioneditor/connectionmodel.cpp +++ b/src/plugins/qmldesigner/components/connectioneditor/connectionmodel.cpp @@ -301,7 +301,7 @@ void ConnectionModel::addConnection() nodeMetaInfo.minorVersion()); QString source = "console.log(\"clicked\")"; - if (connectionView()->selectedModelNodes().count() == 1) { + if (connectionView()->selectedModelNodes().size() == 1) { ModelNode selectedNode = connectionView()->selectedModelNodes().constFirst(); if (QmlItemNode::isValidQmlItemNode(selectedNode)) selectedNode.nodeAbstractProperty("data").reparentHere(newNode); diff --git a/src/plugins/qmldesigner/components/connectioneditor/connectionview.cpp b/src/plugins/qmldesigner/components/connectioneditor/connectionview.cpp index 56fcc7ef6b..d8f84f3e0f 100644 --- a/src/plugins/qmldesigner/components/connectioneditor/connectionview.cpp +++ b/src/plugins/qmldesigner/components/connectioneditor/connectionview.cpp @@ -155,7 +155,7 @@ void ConnectionView::selectedNodesChanged(const QList<ModelNode> & selectedNodeL if (connectionViewWidget()->currentTab() == ConnectionViewWidget::BindingTab || connectionViewWidget()->currentTab() == ConnectionViewWidget::DynamicPropertiesTab) - emit connectionViewWidget()->setEnabledAddButton(selectedNodeList.count() == 1); + emit connectionViewWidget()->setEnabledAddButton(selectedNodeList.size() == 1); } void ConnectionView::auxiliaryDataChanged([[maybe_unused]] const ModelNode &node, diff --git a/src/plugins/qmldesigner/components/connectioneditor/connectionviewwidget.cpp b/src/plugins/qmldesigner/components/connectioneditor/connectionviewwidget.cpp index f1b0c3f4cb..edade6ae40 100644 --- a/src/plugins/qmldesigner/components/connectioneditor/connectionviewwidget.cpp +++ b/src/plugins/qmldesigner/components/connectioneditor/connectionviewwidget.cpp @@ -347,14 +347,14 @@ void ConnectionViewWidget::invalidateButtonStatus() } else if (currentTab() == BindingTab) { emit setEnabledRemoveButton(ui->bindingView->selectionModel()->hasSelection()); auto bindingModel = qobject_cast<BindingModel*>(ui->bindingView->model()); - emit setEnabledAddButton(bindingModel->connectionView()->model() && - bindingModel->connectionView()->selectedModelNodes().count() == 1); + emit setEnabledAddButton(bindingModel->connectionView()->model() + && bindingModel->connectionView()->selectedModelNodes().size() == 1); } else if (currentTab() == DynamicPropertiesTab) { emit setEnabledRemoveButton(ui->dynamicPropertiesView->selectionModel()->hasSelection()); auto dynamicPropertiesModel = qobject_cast<DynamicPropertiesModel*>(ui->dynamicPropertiesView->model()); - emit setEnabledAddButton(dynamicPropertiesModel->view()->model() && - dynamicPropertiesModel->selectedNodes().count() == 1); + emit setEnabledAddButton(dynamicPropertiesModel->view()->model() + && dynamicPropertiesModel->selectedNodes().size() == 1); } else if (currentTab() == BackendTab) { emit setEnabledAddButton(true); emit setEnabledRemoveButton(ui->backendView->selectionModel()->hasSelection()); diff --git a/src/plugins/qmldesigner/components/connectioneditor/dynamicpropertiesmodel.cpp b/src/plugins/qmldesigner/components/connectioneditor/dynamicpropertiesmodel.cpp index 89e08c5441..4faf5d23f1 100644 --- a/src/plugins/qmldesigner/components/connectioneditor/dynamicpropertiesmodel.cpp +++ b/src/plugins/qmldesigner/components/connectioneditor/dynamicpropertiesmodel.cpp @@ -180,7 +180,7 @@ void DynamicPropertiesModel::resetModel() // Value copying is optional BindingProperty DynamicPropertiesModel::replaceVariantWithBinding(const PropertyName &name, bool copyValue) { - if (selectedNodes().count() == 1) { + if (selectedNodes().size() == 1) { const ModelNode modelNode = selectedNodes().constFirst(); if (modelNode.isValid()) { if (modelNode.hasVariantProperty(name)) { @@ -214,7 +214,7 @@ BindingProperty DynamicPropertiesModel::replaceVariantWithBinding(const Property // If it's a BindingProperty, then replaces it with empty VariantProperty void DynamicPropertiesModel::resetProperty(const PropertyName &name) { - if (selectedNodes().count() == 1) { + if (selectedNodes().size() == 1) { const ModelNode modelNode = selectedNodes().constFirst(); if (modelNode.isValid()) { if (modelNode.hasProperty(name)) { @@ -454,7 +454,7 @@ void DynamicPropertiesModel::addDynamicPropertyForCurrentNode() { QmlDesignerPlugin::emitUsageStatistics(Constants::EVENT_PROPERTY_ADDED); - if (selectedNodes().count() == 1) { + if (selectedNodes().size() == 1) { const ModelNode modelNode = selectedNodes().constFirst(); if (modelNode.isValid()) { try { @@ -839,9 +839,9 @@ bool DynamicPropertiesModel::getExpressionStrings(const BindingProperty &binding QString propertyName; - for (int i = 1; i < expressionParts.count(); ++i) { + for (int i = 1; i < expressionParts.size(); ++i) { propertyName += expressionParts.at(i); - if (i != expressionParts.count() - 1) + if (i != expressionParts.size() - 1) propertyName += QLatin1String("."); } *sourceProperty = propertyName; diff --git a/src/plugins/qmldesigner/components/contentlibrary/contentlibrarymaterialsmodel.cpp b/src/plugins/qmldesigner/components/contentlibrary/contentlibrarymaterialsmodel.cpp index f272a4121d..c25873c77f 100644 --- a/src/plugins/qmldesigner/components/contentlibrary/contentlibrarymaterialsmodel.cpp +++ b/src/plugins/qmldesigner/components/contentlibrary/contentlibrarymaterialsmodel.cpp @@ -53,7 +53,7 @@ int ContentLibraryMaterialsModel::rowCount(const QModelIndex &) const QVariant ContentLibraryMaterialsModel::data(const QModelIndex &index, int role) const { - QTC_ASSERT(index.isValid() && index.row() < m_bundleCategories.count(), return {}); + QTC_ASSERT(index.isValid() && index.row() < m_bundleCategories.size(), return {}); QTC_ASSERT(roleNames().contains(role), return {}); return m_bundleCategories.at(index.row())->property(roleNames().value(role)); diff --git a/src/plugins/qmldesigner/components/contentlibrary/contentlibrarytexture.cpp b/src/plugins/qmldesigner/components/contentlibrary/contentlibrarytexture.cpp index 8da65cd2fb..7ab239aab4 100644 --- a/src/plugins/qmldesigner/components/contentlibrary/contentlibrarytexture.cpp +++ b/src/plugins/qmldesigner/components/contentlibrary/contentlibrarytexture.cpp @@ -64,7 +64,7 @@ QString ContentLibraryTexture::resolveFileExt() if (textureFiles.isEmpty()) return {}; - if (textureFiles.count() > 1) { + if (textureFiles.size() > 1) { qWarning() << "Found multiple textures with the same name in the same directories: " << Utils::transform(textureFiles, [](const QFileInfo &fi) { return fi.fileName(); diff --git a/src/plugins/qmldesigner/components/contentlibrary/contentlibrarytexturesmodel.cpp b/src/plugins/qmldesigner/components/contentlibrary/contentlibrarytexturesmodel.cpp index 900376a4d3..9026d944da 100644 --- a/src/plugins/qmldesigner/components/contentlibrary/contentlibrarytexturesmodel.cpp +++ b/src/plugins/qmldesigner/components/contentlibrary/contentlibrarytexturesmodel.cpp @@ -36,7 +36,7 @@ int ContentLibraryTexturesModel::rowCount(const QModelIndex &) const QVariant ContentLibraryTexturesModel::data(const QModelIndex &index, int role) const { - QTC_ASSERT(index.isValid() && index.row() < m_bundleCategories.count(), return {}); + QTC_ASSERT(index.isValid() && index.row() < m_bundleCategories.size(), return {}); QTC_ASSERT(roleNames().contains(role), return {}); return m_bundleCategories.at(index.row())->property(roleNames().value(role)); diff --git a/src/plugins/qmldesigner/components/curveeditor/curveeditormodel.cpp b/src/plugins/qmldesigner/components/curveeditor/curveeditormodel.cpp index 802a75c2bf..84c8cb56bd 100644 --- a/src/plugins/qmldesigner/components/curveeditor/curveeditormodel.cpp +++ b/src/plugins/qmldesigner/components/curveeditor/curveeditormodel.cpp @@ -319,7 +319,7 @@ std::vector<Keyframe> resolveSmallCurves(const std::vector<Keyframe> &frames) if (frame.hasData() && !out.empty()) { QEasingCurve curve = frame.data().toEasingCurve(); // One-segment-curve: Since (0,0) is implicit => 3 - if (curve.toCubicSpline().count() == 3) { + if (curve.toCubicSpline().size() == 3) { Keyframe &previous = out.back(); #if 0 // Do not resolve when two adjacent keyframes have the same value. diff --git a/src/plugins/qmldesigner/components/curveeditor/curveeditorview.cpp b/src/plugins/qmldesigner/components/curveeditor/curveeditorview.cpp index 2a401fc4fb..1d0b38b3f1 100644 --- a/src/plugins/qmldesigner/components/curveeditor/curveeditorview.cpp +++ b/src/plugins/qmldesigner/components/curveeditor/curveeditorview.cpp @@ -338,7 +338,7 @@ void CurveEditorView::commitKeyframes(TreeItem *item) attachEasingCurve(group, pos.x(), segment.easingCurve()); } else if (frame.interpolation() == Keyframe::Interpolation::Easing) { QVariant data = frame.data(); - if (data.type() == static_cast<int>(QMetaType::QEasingCurve)) + if (data.typeId() == static_cast<int>(QMetaType::QEasingCurve)) attachEasingCurve(group, pos.x(), data.value<QEasingCurve>()); } } diff --git a/src/plugins/qmldesigner/components/curveeditor/curvesegment.cpp b/src/plugins/qmldesigner/components/curveeditor/curvesegment.cpp index 2608e65144..76fa2a2ffc 100644 --- a/src/plugins/qmldesigner/components/curveeditor/curvesegment.cpp +++ b/src/plugins/qmldesigner/components/curveeditor/curvesegment.cpp @@ -244,7 +244,7 @@ void CurveSegment::extendWithEasingCurve(QPainterPath &path, const QEasingCurve }; QVector<QPointF> points = curve.toCubicSpline(); - int numSegments = points.count() / 3; + int numSegments = points.size() / 3; for (int i = 0; i < numSegments; i++) { QPointF p1 = mapEasing(m_left.position(), m_right.position(), points.at(i * 3)); QPointF p2 = mapEasing(m_left.position(), m_right.position(), points.at(i * 3 + 1)); @@ -264,7 +264,7 @@ void CurveSegment::extend(QPainterPath &path) const extendWithEasingCurve(path, easingCurve()); } else if (interpolation() == Keyframe::Interpolation::Easing) { QVariant data = m_right.data(); - if (data.isValid() && data.type() == static_cast<int>(QMetaType::QEasingCurve)) { + if (data.isValid() && data.typeId() == static_cast<int>(QMetaType::QEasingCurve)) { extendWithEasingCurve(path, data.value<QEasingCurve>()); } } diff --git a/src/plugins/qmldesigner/components/curveeditor/keyframe.cpp b/src/plugins/qmldesigner/components/curveeditor/keyframe.cpp index aa698c35da..8e71e593c3 100644 --- a/src/plugins/qmldesigner/components/curveeditor/keyframe.cpp +++ b/src/plugins/qmldesigner/components/curveeditor/keyframe.cpp @@ -149,7 +149,7 @@ void Keyframe::setRightHandle(const QPointF &pos) void Keyframe::setData(const QVariant &data) { - if (data.type() == static_cast<int>(QMetaType::QEasingCurve)) + if (data.typeId() == static_cast<int>(QMetaType::QEasingCurve)) m_interpolation = Interpolation::Easing; m_data = data; diff --git a/src/plugins/qmldesigner/components/edit3d/bakelightsconnectionmanager.cpp b/src/plugins/qmldesigner/components/edit3d/bakelightsconnectionmanager.cpp index d2a6f3d332..6c334d2db5 100644 --- a/src/plugins/qmldesigner/components/edit3d/bakelightsconnectionmanager.cpp +++ b/src/plugins/qmldesigner/components/edit3d/bakelightsconnectionmanager.cpp @@ -27,7 +27,7 @@ void BakeLightsConnectionManager::dispatchCommand(const QVariant &command, { static const int commandType = QMetaType::type("PuppetToCreatorCommand"); - if (command.userType() == commandType) { + if (command.typeId() == commandType) { auto cmd = command.value<PuppetToCreatorCommand>(); switch (cmd.type()) { case PuppetToCreatorCommand::BakeLightsProgress: diff --git a/src/plugins/qmldesigner/components/edit3d/bakelightsdatamodel.cpp b/src/plugins/qmldesigner/components/edit3d/bakelightsdatamodel.cpp index 8bc0f9e7a6..e812bb6d00 100644 --- a/src/plugins/qmldesigner/components/edit3d/bakelightsdatamodel.cpp +++ b/src/plugins/qmldesigner/components/edit3d/bakelightsdatamodel.cpp @@ -36,7 +36,7 @@ BakeLightsDataModel::~BakeLightsDataModel() int BakeLightsDataModel::rowCount(const QModelIndex &) const { - return m_dataList.count(); + return m_dataList.size(); } QHash<int, QByteArray> BakeLightsDataModel::roleNames() const @@ -57,7 +57,7 @@ QHash<int, QByteArray> BakeLightsDataModel::roleNames() const QVariant BakeLightsDataModel::data(const QModelIndex &index, int role) const { - QTC_ASSERT(index.isValid() && index.row() < m_dataList.count(), return {}); + QTC_ASSERT(index.isValid() && index.row() < m_dataList.size(), return {}); QTC_ASSERT(roleNames().contains(role), return {}); QByteArray roleName = roleNames().value(role); @@ -102,7 +102,7 @@ QVariant BakeLightsDataModel::data(const QModelIndex &index, int role) const bool BakeLightsDataModel::setData(const QModelIndex &index, const QVariant &value, int role) { - QTC_ASSERT(index.isValid() && index.row() < m_dataList.count(), return false); + QTC_ASSERT(index.isValid() && index.row() < m_dataList.size(), return false); QTC_ASSERT(roleNames().contains(role), return false); QByteArray roleName = roleNames().value(role); diff --git a/src/plugins/qmldesigner/components/formeditor/abstractformeditortool.cpp b/src/plugins/qmldesigner/components/formeditor/abstractformeditortool.cpp index c6cbb8252c..774b4c0d91 100644 --- a/src/plugins/qmldesigner/components/formeditor/abstractformeditortool.cpp +++ b/src/plugins/qmldesigner/components/formeditor/abstractformeditortool.cpp @@ -260,7 +260,7 @@ void AbstractFormEditorTool::mouseReleaseEvent(const QList<QGraphicsItem*> & ite QmlItemNode currentSelectedNode; - if (view()->selectedModelNodes().count() == 1) { + if (view()->selectedModelNodes().size() == 1) { currentSelectedNode = view()->selectedModelNodes().constFirst(); if (!containsItemNode(itemList, currentSelectedNode)) { diff --git a/src/plugins/qmldesigner/components/formeditor/anchorindicator.cpp b/src/plugins/qmldesigner/components/formeditor/anchorindicator.cpp index 7d75c71c22..8a8a3e524f 100644 --- a/src/plugins/qmldesigner/components/formeditor/anchorindicator.cpp +++ b/src/plugins/qmldesigner/components/formeditor/anchorindicator.cpp @@ -64,7 +64,7 @@ void AnchorIndicator::setItems(const QList<FormEditorItem *> &itemList) { clear(); - if (itemList.count() == 1) { + if (itemList.size() == 1) { m_formEditorItem = itemList.constFirst(); QmlItemNode sourceQmlItemNode = m_formEditorItem->qmlItemNode(); if (!sourceQmlItemNode.modelNode().isRootNode()) { diff --git a/src/plugins/qmldesigner/components/formeditor/backgroundaction.cpp b/src/plugins/qmldesigner/components/formeditor/backgroundaction.cpp index a9d72be8dd..37dfafad9a 100644 --- a/src/plugins/qmldesigner/components/formeditor/backgroundaction.cpp +++ b/src/plugins/qmldesigner/components/formeditor/backgroundaction.cpp @@ -45,7 +45,7 @@ QWidget *BackgroundAction::createWidget(QWidget *parent) auto comboBox = new QComboBox(parent); comboBox->setFixedWidth(42); - for (int i = 0; i < colors().count(); ++i) { + for (int i = 0; i < colors().size(); ++i) { comboBox->addItem(tr("")); comboBox->setItemIcon(i, iconForColor((colors().at(i)))); } @@ -62,7 +62,7 @@ QWidget *BackgroundAction::createWidget(QWidget *parent) void BackgroundAction::emitBackgroundChanged(int index) { - if (index < colors().count()) + if (index < colors().size()) emit backgroundChanged(colors().at(index)); } diff --git a/src/plugins/qmldesigner/components/formeditor/bindingindicator.cpp b/src/plugins/qmldesigner/components/formeditor/bindingindicator.cpp index e5a990d1ef..5795841693 100644 --- a/src/plugins/qmldesigner/components/formeditor/bindingindicator.cpp +++ b/src/plugins/qmldesigner/components/formeditor/bindingindicator.cpp @@ -91,7 +91,7 @@ void BindingIndicator::setItems(const QList<FormEditorItem *> &itemList) { clear(); - if (itemList.count() == 1) { + if (itemList.size() == 1) { m_formEditorItem = itemList.constFirst(); const QmlItemNode qmlItemNode = m_formEditorItem->qmlItemNode(); diff --git a/src/plugins/qmldesigner/components/formeditor/movetool.cpp b/src/plugins/qmldesigner/components/formeditor/movetool.cpp index 449cdd745c..76b8f9a5f6 100644 --- a/src/plugins/qmldesigner/components/formeditor/movetool.cpp +++ b/src/plugins/qmldesigner/components/formeditor/movetool.cpp @@ -94,9 +94,9 @@ void MoveTool::mouseMoveEvent(const QList<QGraphicsItem*> &itemList, const FormEditorItem *movingItem = m_movingItems.constFirst(); - if (m_movingItems.count() > 1 - || (movingItem->qmlItemNode().canBereparentedTo(containerItem->qmlItemNode()))) - m_moveManipulator.reparentTo(containerItem, MoveManipulator::EnforceReparent); + if (m_movingItems.size() > 1 + || (movingItem->qmlItemNode().canBereparentedTo(containerItem->qmlItemNode()))) + m_moveManipulator.reparentTo(containerItem, MoveManipulator::EnforceReparent); } } diff --git a/src/plugins/qmldesigner/components/formeditor/snapper.cpp b/src/plugins/qmldesigner/components/formeditor/snapper.cpp index da50f92a81..828a713211 100644 --- a/src/plugins/qmldesigner/components/formeditor/snapper.cpp +++ b/src/plugins/qmldesigner/components/formeditor/snapper.cpp @@ -426,7 +426,7 @@ double Snapper::snappingDistance() const static QLineF mergedHorizontalLine(const QList<QLineF> &lineList) { - if (lineList.count() == 1) + if (lineList.size() == 1) return lineList.constFirst(); double minimumX = std::numeric_limits<double>::max(); @@ -444,7 +444,7 @@ static QLineF mergedHorizontalLine(const QList<QLineF> &lineList) static QLineF mergedVerticalLine(const QList<QLineF> &lineList) { - if (lineList.count() == 1) + if (lineList.size() == 1) return lineList.constFirst(); double minimumY = std::numeric_limits<double>::max(); diff --git a/src/plugins/qmldesigner/components/integration/designdocument.cpp b/src/plugins/qmldesigner/components/integration/designdocument.cpp index a61aeb50a0..f5d89a4e98 100644 --- a/src/plugins/qmldesigner/components/integration/designdocument.cpp +++ b/src/plugins/qmldesigner/components/integration/designdocument.cpp @@ -211,8 +211,7 @@ void DesignDocument::moveNodesToPosition(const QList<ModelNode> &nodes, const st targetNode = view.firstSelectedModelNode(); // in case we copy and paste a selection we paste in the parent item - if ((view.selectedModelNodes().count() == movingNodes.count()) - && targetNode.hasParentProperty()) { + if ((view.selectedModelNodes().size() == movingNodes.size()) && targetNode.hasParentProperty()) { targetNode = targetNode.parentProperty().parentModelNode(); } else if (view.selectedModelNodes().isEmpty()) { // if selection is empty and copied nodes are all 3D nodes, paste them under the active scene diff --git a/src/plugins/qmldesigner/components/integration/designdocumentview.cpp b/src/plugins/qmldesigner/components/integration/designdocumentview.cpp index 4a1c92ad0a..9d0deef713 100644 --- a/src/plugins/qmldesigner/components/integration/designdocumentview.cpp +++ b/src/plugins/qmldesigner/components/integration/designdocumentview.cpp @@ -227,7 +227,7 @@ void DesignDocumentView::copyModelNodes(const QList<ModelNode> &nodesToCopy, DesignDocumentView view{externalDependencies}; copyModel->attachView(&view); - if (selectedNodes.count() == 1) { + if (selectedNodes.size() == 1) { const ModelNode &selectedNode = selectedNodes.constFirst(); if (!selectedNode.isValid()) @@ -253,7 +253,6 @@ void DesignDocumentView::copyModelNodes(const QList<ModelNode> &nodesToCopy, view.toClipboard(); } - } }// namespace QmlDesigner diff --git a/src/plugins/qmldesigner/components/itemlibrary/assetimportupdatetreeitem.cpp b/src/plugins/qmldesigner/components/itemlibrary/assetimportupdatetreeitem.cpp index 6fa6ec4c34..a5d84605dd 100644 --- a/src/plugins/qmldesigner/components/itemlibrary/assetimportupdatetreeitem.cpp +++ b/src/plugins/qmldesigner/components/itemlibrary/assetimportupdatetreeitem.cpp @@ -32,7 +32,7 @@ void AssetImportUpdateTreeItem::clear() int AssetImportUpdateTreeItem::childCount() const { - return m_children.count(); + return m_children.size(); } int AssetImportUpdateTreeItem::rowOfItem() const diff --git a/src/plugins/qmldesigner/components/itemlibrary/itemlibraryaddimportmodel.cpp b/src/plugins/qmldesigner/components/itemlibrary/itemlibraryaddimportmodel.cpp index 41a9c6b5f4..66afa19f8b 100644 --- a/src/plugins/qmldesigner/components/itemlibrary/itemlibraryaddimportmodel.cpp +++ b/src/plugins/qmldesigner/components/itemlibrary/itemlibraryaddimportmodel.cpp @@ -28,12 +28,12 @@ ItemLibraryAddImportModel::~ItemLibraryAddImportModel() int ItemLibraryAddImportModel::rowCount(const QModelIndex & /*parent*/) const { - return m_importList.count(); + return m_importList.size(); } QVariant ItemLibraryAddImportModel::data(const QModelIndex &index, int role) const { - if (!index.isValid() || index.row() >= m_importList.count()) + if (!index.isValid() || index.row() >= m_importList.size()) return {}; Import import = m_importList[index.row()]; diff --git a/src/plugins/qmldesigner/components/itemlibrary/itemlibraryassetimporter.cpp b/src/plugins/qmldesigner/components/itemlibrary/itemlibraryassetimporter.cpp index d141b88dc8..c535e78c12 100644 --- a/src/plugins/qmldesigner/components/itemlibrary/itemlibraryassetimporter.cpp +++ b/src/plugins/qmldesigner/components/itemlibrary/itemlibraryassetimporter.cpp @@ -216,7 +216,7 @@ void ItemLibraryAssetImporter::parseFiles(const QStringList &filePaths, addInfo(progressTitle); notifyProgress(0, progressTitle); uint count = 0; - double quota = 100.0 / filePaths.count(); + double quota = 100.0 / filePaths.size(); std::function<void(double)> progress = [this, quota, &count, &progressTitle](double value) { notifyProgress(qRound(quota * (count + value)), progressTitle); }; diff --git a/src/plugins/qmldesigner/components/itemlibrary/itemlibrarycategoriesmodel.cpp b/src/plugins/qmldesigner/components/itemlibrary/itemlibrarycategoriesmodel.cpp index 187bd38e2f..824027e555 100644 --- a/src/plugins/qmldesigner/components/itemlibrary/itemlibrarycategoriesmodel.cpp +++ b/src/plugins/qmldesigner/components/itemlibrary/itemlibrarycategoriesmodel.cpp @@ -27,12 +27,12 @@ ItemLibraryCategoriesModel::~ItemLibraryCategoriesModel() int ItemLibraryCategoriesModel::rowCount(const QModelIndex &) const { - return m_categoryList.count(); + return m_categoryList.size(); } QVariant ItemLibraryCategoriesModel::data(const QModelIndex &index, int role) const { - if (!index.isValid() || index.row() >= m_categoryList.count()) { + if (!index.isValid() || index.row() >= m_categoryList.size()) { qWarning() << Q_FUNC_INFO << "invalid index requested"; return {}; } diff --git a/src/plugins/qmldesigner/components/itemlibrary/itemlibraryitemsmodel.cpp b/src/plugins/qmldesigner/components/itemlibrary/itemlibraryitemsmodel.cpp index 8ee40b6d24..65330af023 100644 --- a/src/plugins/qmldesigner/components/itemlibrary/itemlibraryitemsmodel.cpp +++ b/src/plugins/qmldesigner/components/itemlibrary/itemlibraryitemsmodel.cpp @@ -21,7 +21,7 @@ ItemLibraryItemsModel::~ItemLibraryItemsModel() int ItemLibraryItemsModel::rowCount(const QModelIndex &) const { - return m_itemList.count(); + return m_itemList.size(); } QVariant ItemLibraryItemsModel::data(const QModelIndex &index, int role) const diff --git a/src/plugins/qmldesigner/components/itemlibrary/itemlibrarymodel.cpp b/src/plugins/qmldesigner/components/itemlibrary/itemlibrarymodel.cpp index 21f2e6aa55..40b7f50d37 100644 --- a/src/plugins/qmldesigner/components/itemlibrary/itemlibrarymodel.cpp +++ b/src/plugins/qmldesigner/components/itemlibrary/itemlibrarymodel.cpp @@ -228,12 +228,12 @@ ItemLibraryModel::~ItemLibraryModel() int ItemLibraryModel::rowCount(const QModelIndex & /*parent*/) const { - return m_importList.count(); + return m_importList.size(); } QVariant ItemLibraryModel::data(const QModelIndex &index, int role) const { - if (!index.isValid() || index.row() >= m_importList.count()) + if (!index.isValid() || index.row() >= m_importList.size()) return {}; if (m_roleNames.contains(role)) { diff --git a/src/plugins/qmldesigner/components/itemlibrary/itemlibrarywidget.cpp b/src/plugins/qmldesigner/components/itemlibrary/itemlibrarywidget.cpp index f98284f61d..d43dcc47c6 100644 --- a/src/plugins/qmldesigner/components/itemlibrary/itemlibrarywidget.cpp +++ b/src/plugins/qmldesigner/components/itemlibrary/itemlibrarywidget.cpp @@ -217,7 +217,7 @@ QString ItemLibraryWidget::getDependencyImport(const Import &import) const QStringList splitImport = import.url().split('.'); - if (splitImport.count() > 1) { + if (splitImport.size() > 1) { if (prefixDependencies.contains(splitImport.first())) return splitImport.first(); } diff --git a/src/plugins/qmldesigner/components/listmodeleditor/listmodeleditormodel.cpp b/src/plugins/qmldesigner/components/listmodeleditor/listmodeleditormodel.cpp index a1b25c37c8..b6009edc77 100644 --- a/src/plugins/qmldesigner/components/listmodeleditor/listmodeleditormodel.cpp +++ b/src/plugins/qmldesigner/components/listmodeleditor/listmodeleditormodel.cpp @@ -29,10 +29,10 @@ public: QVariant maybeConvertToNumber(const QVariant &value) { - if (value.type() == QVariant::Bool) + if (value.typeId() == QVariant::Bool) return value; - if (value.type() == QVariant::String) { + if (value.typeId() == QVariant::String) { const QString text = value.toString(); if (text == "true") return QVariant(true); diff --git a/src/plugins/qmldesigner/components/materialbrowser/materialbrowsermodel.cpp b/src/plugins/qmldesigner/components/materialbrowser/materialbrowsermodel.cpp index d4aedb1cec..d6a098168c 100644 --- a/src/plugins/qmldesigner/components/materialbrowser/materialbrowsermodel.cpp +++ b/src/plugins/qmldesigner/components/materialbrowser/materialbrowsermodel.cpp @@ -24,12 +24,12 @@ MaterialBrowserModel::~MaterialBrowserModel() int MaterialBrowserModel::rowCount(const QModelIndex &) const { - return m_materialList.count(); + return m_materialList.size(); } QVariant MaterialBrowserModel::data(const QModelIndex &index, int role) const { - QTC_ASSERT(index.isValid() && index.row() < m_materialList.count(), return {}); + QTC_ASSERT(index.isValid() && index.row() < m_materialList.size(), return {}); QTC_ASSERT(roleNames().contains(role), return {}); QByteArray roleName = roleNames().value(role); @@ -223,7 +223,7 @@ void MaterialBrowserModel::refreshSearch() // if selected material goes invisible, select nearest material if (!isVisible(m_selectedIndex)) { int inc = 1; - int incCap = m_materialList.count(); + int incCap = m_materialList.size(); while (!isEmpty && inc < incCap) { if (isVisible(m_selectedIndex - inc)) { selectMaterial(m_selectedIndex - inc); diff --git a/src/plugins/qmldesigner/components/materialbrowser/materialbrowsertexturesmodel.cpp b/src/plugins/qmldesigner/components/materialbrowser/materialbrowsertexturesmodel.cpp index 4ed241abf9..ba4536132a 100644 --- a/src/plugins/qmldesigner/components/materialbrowser/materialbrowsertexturesmodel.cpp +++ b/src/plugins/qmldesigner/components/materialbrowser/materialbrowsertexturesmodel.cpp @@ -24,12 +24,12 @@ MaterialBrowserTexturesModel::~MaterialBrowserTexturesModel() int MaterialBrowserTexturesModel::rowCount(const QModelIndex &) const { - return m_textureList.count(); + return m_textureList.size(); } QVariant MaterialBrowserTexturesModel::data(const QModelIndex &index, int role) const { - QTC_ASSERT(index.isValid() && index.row() < m_textureList.count(), return {}); + QTC_ASSERT(index.isValid() && index.row() < m_textureList.size(), return {}); QTC_ASSERT(roleNames().contains(role), return {}); if (role == RoleTexSource) { @@ -124,7 +124,7 @@ void MaterialBrowserTexturesModel::refreshSearch() // if selected texture goes invisible, select nearest one if (!isVisible(m_selectedIndex)) { int inc = 1; - int incCap = m_textureList.count(); + int incCap = m_textureList.size(); while (!isEmpty && inc < incCap) { if (isVisible(m_selectedIndex - inc)) { selectTexture(m_selectedIndex - inc); diff --git a/src/plugins/qmldesigner/components/materialeditor/materialeditorqmlbackend.cpp b/src/plugins/qmldesigner/components/materialeditor/materialeditorqmlbackend.cpp index edae2377bf..fe84c0c184 100644 --- a/src/plugins/qmldesigner/components/materialeditor/materialeditorqmlbackend.cpp +++ b/src/plugins/qmldesigner/components/materialeditor/materialeditorqmlbackend.cpp @@ -31,7 +31,7 @@ static QObject *variantToQObject(const QVariant &value) { - if (value.userType() == QMetaType::QObjectStar || value.userType() > QMetaType::User) + if (value.typeId() == QMetaType::QObjectStar || value.typeId() > QMetaType::User) return *(QObject **)value.constData(); return nullptr; @@ -143,7 +143,7 @@ void MaterialEditorQmlBackend::createPropertyEditorValue(const QmlObjectNode &qm void MaterialEditorQmlBackend::setValue(const QmlObjectNode &, const PropertyName &name, const QVariant &value) { // Vector*D values need to be split into their subcomponents - if (value.type() == QVariant::Vector2D) { + if (value.typeId() == QVariant::Vector2D) { const char *suffix[2] = {"_x", "_y"}; auto vecValue = value.value<QVector2D>(); for (int i = 0; i < 2; ++i) { @@ -154,7 +154,7 @@ void MaterialEditorQmlBackend::setValue(const QmlObjectNode &, const PropertyNam if (propertyValue) propertyValue->setValue(QVariant(vecValue[i])); } - } else if (value.type() == QVariant::Vector3D) { + } else if (value.typeId() == QVariant::Vector3D) { const char *suffix[3] = {"_x", "_y", "_z"}; auto vecValue = value.value<QVector3D>(); for (int i = 0; i < 3; ++i) { @@ -165,7 +165,7 @@ void MaterialEditorQmlBackend::setValue(const QmlObjectNode &, const PropertyNam if (propertyValue) propertyValue->setValue(QVariant(vecValue[i])); } - } else if (value.type() == QVariant::Vector4D) { + } else if (value.typeId() == QVariant::Vector4D) { const char *suffix[4] = {"_x", "_y", "_z", "_w"}; auto vecValue = value.value<QVector4D>(); for (int i = 0; i < 4; ++i) { diff --git a/src/plugins/qmldesigner/components/materialeditor/materialeditorview.cpp b/src/plugins/qmldesigner/components/materialeditor/materialeditorview.cpp index 96e0107290..01d55d13db 100644 --- a/src/plugins/qmldesigner/components/materialeditor/materialeditorview.cpp +++ b/src/plugins/qmldesigner/components/materialeditor/materialeditorview.cpp @@ -149,7 +149,7 @@ void MaterialEditorView::changeValue(const QString &name) if (name == "state" && castedValue.toString() == "base state") castedValue = ""; - if (castedValue.type() == QVariant::Color) { + if (castedValue.typeId() == QVariant::Color) { QColor color = castedValue.value<QColor>(); QColor newColor = QColor(color.name()); newColor.setAlpha(color.alpha()); @@ -161,9 +161,9 @@ void MaterialEditorView::changeValue(const QString &name) } else { // QVector*D(0, 0, 0) detects as null variant though it is valid value if (castedValue.isValid() - && (!castedValue.isNull() || castedValue.type() == QVariant::Vector2D - || castedValue.type() == QVariant::Vector3D - || castedValue.type() == QVariant::Vector4D)) { + && (!castedValue.isNull() || castedValue.typeId() == QVariant::Vector2D + || castedValue.typeId() == QVariant::Vector3D + || castedValue.typeId() == QVariant::Vector4D)) { commitVariantValueToModel(propertyName, castedValue); } } diff --git a/src/plugins/qmldesigner/components/navigator/choosefrompropertylistdialog.cpp b/src/plugins/qmldesigner/components/navigator/choosefrompropertylistdialog.cpp index 91c300e87a..304ff91fcd 100644 --- a/src/plugins/qmldesigner/components/navigator/choosefrompropertylistdialog.cpp +++ b/src/plugins/qmldesigner/components/navigator/choosefrompropertylistdialog.cpp @@ -115,10 +115,10 @@ ChooseFromPropertyListDialog::ChooseFromPropertyListDialog(const QStringList &pr : QDialog(parent) , m_ui(new Ui::ChooseFromPropertyListDialog) { - if (propNames.count() == 1) { - m_selectedProperty = propNames.first().toLatin1(); - m_isSoloProperty = true; - return; + if (propNames.size() == 1) { + m_selectedProperty = propNames.first().toLatin1(); + m_isSoloProperty = true; + return; } m_ui->setupUi(this); setWindowTitle(tr("Select Property")); diff --git a/src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp b/src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp index 16dd224286..8768f0703c 100644 --- a/src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp +++ b/src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp @@ -69,13 +69,12 @@ static QList<ModelNode> modelNodesFromMimeData(const QMimeData *mineData, Abstra bool fitsToTargetProperty(const NodeAbstractProperty &targetProperty, const QList<ModelNode> &modelNodeList) { - bool const canBeContainer = - NodeHints::fromModelNode(targetProperty.parentModelNode()).canBeContainerFor(modelNodeList.first()); - return !(targetProperty.isNodeProperty() && - modelNodeList.count() > 1) && canBeContainer; + const bool canBeContainer = NodeHints::fromModelNode(targetProperty.parentModelNode()) + .canBeContainerFor(modelNodeList.first()); + return !(targetProperty.isNodeProperty() && modelNodeList.size() > 1) && canBeContainer; } -static inline QString msgUnknownItem(const QString &t) +inline static QString msgUnknownItem(const QString &t) { return NavigatorTreeModel::tr("Unknown component: %1").arg(t); } @@ -289,7 +288,7 @@ Qt::ItemFlags NavigatorTreeModel::flags(const QModelIndex &index) const return Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsUserCheckable; } -void static appendForcedNodes(const NodeListProperty &property, QList<ModelNode> &list) +static void appendForcedNodes(const NodeListProperty &property, QList<ModelNode> &list) { const QSet<ModelNode> set = QSet<ModelNode>(list.constBegin(), list.constEnd()); for (const ModelNode &node : property.parentModelNode().directSubModelNodes()) { @@ -411,7 +410,8 @@ int NavigatorTreeModel::rowCount(const QModelIndex &parent) const if (modelNode.defaultNodeListProperty().isValid()) { rows = filteredList(modelNode.defaultNodeListProperty(), m_showOnlyVisibleItems, - m_reverseItemOrder).count(); + m_reverseItemOrder) + .size(); } return rows; @@ -451,7 +451,7 @@ void NavigatorTreeModel::setView(NavigatorView *view) QStringList NavigatorTreeModel::mimeTypes() const { - const static QStringList types({Constants::MIME_TYPE_MODELNODE_LIST, + static const QStringList types({Constants::MIME_TYPE_MODELNODE_LIST, Constants::MIME_TYPE_ITEM_LIBRARY_INFO, Constants::MIME_TYPE_TEXTURE, Constants::MIME_TYPE_MATERIAL, diff --git a/src/plugins/qmldesigner/components/navigator/navigatorview.cpp b/src/plugins/qmldesigner/components/navigator/navigatorview.cpp index f1a00a36c7..ceccf25554 100644 --- a/src/plugins/qmldesigner/components/navigator/navigatorview.cpp +++ b/src/plugins/qmldesigner/components/navigator/navigatorview.cpp @@ -42,7 +42,7 @@ #include <QPixmap> #include <QTimer> -static inline void setScenePos(const QmlDesigner::ModelNode &modelNode,const QPointF &pos) +inline static void setScenePos(const QmlDesigner::ModelNode &modelNode, const QPointF &pos) { if (modelNode.hasParentProperty() && QmlDesigner::QmlItemNode::isValidQmlItemNode(modelNode.parentProperty().parentModelNode())) { QmlDesigner::QmlItemNode parentNode = modelNode.parentProperty().parentQmlObjectNode().toQmlItemNode(); @@ -58,7 +58,7 @@ static inline void setScenePos(const QmlDesigner::ModelNode &modelNode,const QPo } } -static inline void moveNodesUp(const QList<QmlDesigner::ModelNode> &nodes) +inline static void moveNodesUp(const QList<QmlDesigner::ModelNode> &nodes) { for (const auto &node : nodes) { if (!node.isRootNode() && node.parentProperty().isNodeListProperty()) { @@ -73,7 +73,7 @@ static inline void moveNodesUp(const QList<QmlDesigner::ModelNode> &nodes) } } -static inline void moveNodesDown(const QList<QmlDesigner::ModelNode> &nodes) +inline static void moveNodesDown(const QList<QmlDesigner::ModelNode> &nodes) { for (const auto &node : nodes) { if (!node.isRootNode() && node.parentProperty().isNodeListProperty()) { @@ -280,7 +280,7 @@ void NavigatorView::dragStarted(QMimeData *mimeData) m_widget->update(); } else if (mimeData->hasFormat(Constants::MIME_TYPE_ASSETS)) { const QStringList assetsPaths = QString::fromUtf8(mimeData->data(Constants::MIME_TYPE_ASSETS)).split(','); - if (assetsPaths.count() > 0) { + if (assetsPaths.size() > 0) { auto assetTypeAndData = AssetsLibraryWidget::getAssetTypeAndData(assetsPaths[0]); QString assetType = assetTypeAndData.first; if (assetType == Constants::MIME_TYPE_ASSET_EFFECT) { @@ -517,7 +517,7 @@ void NavigatorView::propagateInstanceErrorToExplorer(const ModelNode &modelNode) void NavigatorView::leftButtonClicked() { - if (selectedModelNodes().count() > 1) + if (selectedModelNodes().size() > 1) return; //Semantics are unclear for multi selection. bool blocked = blockSelectionChangedSignal(true); @@ -541,14 +541,15 @@ void NavigatorView::leftButtonClicked() void NavigatorView::rightButtonClicked() { - if (selectedModelNodes().count() > 1) + if (selectedModelNodes().size() > 1) return; //Semantics are unclear for multi selection. bool blocked = blockSelectionChangedSignal(true); bool reverse = QmlDesignerPlugin::settings().value(DesignerSettingsKey::NAVIGATOR_REVERSE_ITEM_ORDER).toBool(); for (const ModelNode &node : selectedModelNodes()) { - if (!node.isRootNode() && node.parentProperty().isNodeListProperty() && node.parentProperty().count() > 1) { + if (!node.isRootNode() && node.parentProperty().isNodeListProperty() + && node.parentProperty().count() > 1) { int index = node.parentProperty().indexOf(node); bool indexOk = false; diff --git a/src/plugins/qmldesigner/components/pathtool/pathitem.cpp b/src/plugins/qmldesigner/components/pathtool/pathitem.cpp index 10c93ad559..801be712ad 100644 --- a/src/plugins/qmldesigner/components/pathtool/pathitem.cpp +++ b/src/plugins/qmldesigner/components/pathtool/pathitem.cpp @@ -587,7 +587,7 @@ QAction *PathItem::createClosedPathAction(QMenu *contextMenu) const closedPathAction->setText(tr("Closed Path")); contextMenu->addAction(closedPathAction); - if (m_cubicSegments.count() == 1) + if (m_cubicSegments.size() == 1) closedPathAction->setDisabled(true); return closedPathAction; @@ -617,7 +617,7 @@ void PathItem::createCubicSegmentContextMenu(CubicSegment &cubicSegment, const Q straightLinePointAction->setText(tr("Make Curve Segment Straight")); contextMenu.addAction(straightLinePointAction); - if (m_cubicSegments.count() == 1 && isClosedPath()) + if (m_cubicSegments.size() == 1 && isClosedPath()) straightLinePointAction->setDisabled(true); QAction *closedPathAction = createClosedPathAction(&contextMenu); @@ -649,7 +649,7 @@ void PathItem::createEditPointContextMenu(const ControlPoint &controlPoint, cons QAction *closedPathAction = createClosedPathAction(&contextMenu); - if (m_cubicSegments.count() <= 1 || (m_cubicSegments.count() == 2 && isClosedPath())) + if (m_cubicSegments.size() <= 1 || (m_cubicSegments.size() == 2 && isClosedPath())) removeEditPointAction->setDisabled(true); QAction *activatedAction = contextMenu.exec(menuPosition); @@ -663,7 +663,7 @@ void PathItem::createEditPointContextMenu(const ControlPoint &controlPoint, cons const QList<ControlPoint> PathItem::controlPoints() const { QList<ControlPoint> controlPointList; - controlPointList.reserve((m_cubicSegments.count() * 4)); + controlPointList.reserve((m_cubicSegments.size() * 4)); if (!m_cubicSegments.isEmpty()) controlPointList.append(m_cubicSegments.constFirst().firstControlPoint()); @@ -914,9 +914,9 @@ void PathItem::removeEditPoint(const ControlPoint &controlPoint) { QList<CubicSegment> cubicSegments = cubicSegmentsContainingControlPoint(controlPoint, m_cubicSegments); - if (cubicSegments.count() == 1) { + if (cubicSegments.size() == 1) { m_cubicSegments.removeOne(cubicSegments.constFirst()); - } else if (cubicSegments.count() == 2){ + } else if (cubicSegments.size() == 2) { CubicSegment mergedCubicSegment = CubicSegment::create(); const CubicSegment &firstCubicSegment = cubicSegments.at(0); const CubicSegment &secondCubicSegment = cubicSegments.at(1); diff --git a/src/plugins/qmldesigner/components/pathtool/pathselectionmanipulator.cpp b/src/plugins/qmldesigner/components/pathtool/pathselectionmanipulator.cpp index 6d62057848..c1c2fd725a 100644 --- a/src/plugins/qmldesigner/components/pathtool/pathselectionmanipulator.cpp +++ b/src/plugins/qmldesigner/components/pathtool/pathselectionmanipulator.cpp @@ -54,12 +54,12 @@ static ControlPoint getControlPoint(const QList<ControlPoint> &selectedPoints, c int controlPointIndex = selectedPoints.indexOf(controlPoint); if (controlPointIndex >= 0) { int offsetIndex = controlPointIndex + indexOffset; - if (offsetIndex >= 0 && offsetIndex < selectedPoints.count()) + if (offsetIndex >= 0 && offsetIndex < selectedPoints.size()) return selectedPoints.at(offsetIndex); else if (isClosedPath) { if (offsetIndex == -1) return selectedPoints.constLast(); - else if (offsetIndex < selectedPoints.count()) + else if (offsetIndex < selectedPoints.size()) return selectedPoints.at(1); } } diff --git a/src/plugins/qmldesigner/components/propertyeditor/aligndistribute.cpp b/src/plugins/qmldesigner/components/propertyeditor/aligndistribute.cpp index 5d8400b47e..f14e423c9f 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/aligndistribute.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/aligndistribute.cpp @@ -30,7 +30,7 @@ bool AlignDistribute::multiSelection() const if (!m_qmlObjectNode.isValid()) return false; - return m_qmlObjectNode.view()->selectedModelNodes().count() > 1; + return m_qmlObjectNode.view()->selectedModelNodes().size() > 1; } bool AlignDistribute::selectionHasAnchors() const @@ -210,7 +210,7 @@ bool compareByDepth(const ModelNode &node1, const ModelNode &node2) return false; } -static inline QRectF getBoundingRect(const QList<ModelNode> &modelNodeList) +inline static QRectF getBoundingRect(const QList<ModelNode> &modelNodeList) { QRectF boundingRect; for (const ModelNode &modelNode : modelNodeList) { @@ -222,7 +222,7 @@ static inline QRectF getBoundingRect(const QList<ModelNode> &modelNodeList) return boundingRect; } -static inline QSizeF getSummedSize(const QList<ModelNode> &modelNodeList) +inline static QSizeF getSummedSize(const QList<ModelNode> &modelNodeList) { QSizeF summedSize = QSizeF(0, 0); for (const ModelNode &modelNode : modelNodeList) { @@ -234,7 +234,7 @@ static inline QSizeF getSummedSize(const QList<ModelNode> &modelNodeList) return summedSize; } -static inline qreal getInstanceSceneX(const QmlItemNode &qmlItemNode) +inline static qreal getInstanceSceneX(const QmlItemNode &qmlItemNode) { const qreal x = qmlItemNode.modelValue("x").toReal(); if (qmlItemNode.hasInstanceParentItem()) @@ -242,7 +242,7 @@ static inline qreal getInstanceSceneX(const QmlItemNode &qmlItemNode) return x; } -static inline qreal getInstanceSceneY(const QmlItemNode &qmlItemNode) +inline static qreal getInstanceSceneY(const QmlItemNode &qmlItemNode) { const qreal y = qmlItemNode.modelValue("y").toReal(); if (qmlItemNode.hasInstanceParentItem()) diff --git a/src/plugins/qmldesigner/components/propertyeditor/dynamicpropertiesproxymodel.cpp b/src/plugins/qmldesigner/components/propertyeditor/dynamicpropertiesproxymodel.cpp index 689753ff8b..5067a6f5b1 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/dynamicpropertiesproxymodel.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/dynamicpropertiesproxymodel.cpp @@ -152,7 +152,7 @@ void DynamicPropertiesProxyModel::createProperty(const QString &name, const QStr TypeName typeName = type.toUtf8(); const auto selectedNodes = dynamicPropertiesModel()->selectedNodes(); - if (selectedNodes.count() == 1) { + if (selectedNodes.size() == 1) { const ModelNode modelNode = selectedNodes.constFirst(); if (modelNode.isValid()) { if (modelNode.hasProperty(name.toUtf8())) { diff --git a/src/plugins/qmldesigner/components/propertyeditor/gradientmodel.cpp b/src/plugins/qmldesigner/components/propertyeditor/gradientmodel.cpp index a81560f566..d037846df7 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/gradientmodel.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/gradientmodel.cpp @@ -100,11 +100,11 @@ int GradientModel::addStop(qreal position, const QColor &color) const QList<QmlDesigner::ModelNode> stopNodes = gradientNode.nodeListProperty("stops").toModelNodeList(); - for (int i = 0; i < stopNodes.count(); i++) { + for (int i = 0; i < stopNodes.size(); i++) { if (QmlDesigner::QmlObjectNode(stopNodes.at(i)).modelValue("position").toReal() < position) properPos = i + 1; } - gradientNode.nodeListProperty("stops").slide(stopNodes.count() - 1, properPos); + gradientNode.nodeListProperty("stops").slide(stopNodes.size() - 1, properPos); setupModel(); resetPuppet(); diff --git a/src/plugins/qmldesigner/components/propertyeditor/gradientpresetlistmodel.cpp b/src/plugins/qmldesigner/components/propertyeditor/gradientpresetlistmodel.cpp index 5b25f56f51..b4b4177332 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/gradientpresetlistmodel.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/gradientpresetlistmodel.cpp @@ -28,12 +28,12 @@ GradientPresetListModel::~GradientPresetListModel() int GradientPresetListModel::rowCount(const QModelIndex & /*parent*/) const { - return m_items.count(); + return m_items.size(); } QVariant GradientPresetListModel::data(const QModelIndex &index, int role) const { - if (index.isValid() && (index.row() >= 0) && (index.row() < m_items.count())) { + if (index.isValid() && (index.row() >= 0) && (index.row() < m_items.size())) { if (m_roleNames.contains(role)) { QVariant value = m_items.at(index.row()) .getProperty(static_cast<GradientPresetItem::Property>(role)); diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp index 18ac064737..3b991a5f62 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp @@ -41,7 +41,7 @@ static Q_LOGGING_CATEGORY(propertyEditorBenchmark, "qtc.propertyeditor.load", Qt static QmlJS::SimpleReaderNode::Ptr s_templateConfiguration = QmlJS::SimpleReaderNode::Ptr(); -static inline QString propertyTemplatesPath() +inline static QString propertyTemplatesPath() { return QmlDesigner::PropertyEditorQmlBackend::propertyEditorResourcesPath() + QStringLiteral("/PropertyTemplates/"); } @@ -71,7 +71,7 @@ QStringList variantToStringList(const QVariant &variant) { static QObject *variantToQObject(const QVariant &value) { - if (value.userType() == QMetaType::QObjectStar || value.userType() > QMetaType::User) + if (value.typeId() == QMetaType::QObjectStar || value.typeId() > QMetaType::User) return *(QObject **)value.constData(); return nullptr; @@ -323,7 +323,7 @@ void PropertyEditorQmlBackend::createPropertyEditorValue(const QmlObjectNode &qm void PropertyEditorQmlBackend::setValue(const QmlObjectNode & , const PropertyName &name, const QVariant &value) { // Vector*D values need to be split into their subcomponents - if (value.type() == QVariant::Vector2D) { + if (value.typeId() == QVariant::Vector2D) { const char *suffix[2] = {"_x", "_y"}; auto vecValue = value.value<QVector2D>(); for (int i = 0; i < 2; ++i) { @@ -334,7 +334,7 @@ void PropertyEditorQmlBackend::setValue(const QmlObjectNode & , const PropertyNa if (propertyValue) propertyValue->setValue(QVariant(vecValue[i])); } - } else if (value.type() == QVariant::Vector3D) { + } else if (value.typeId() == QVariant::Vector3D) { const char *suffix[3] = {"_x", "_y", "_z"}; auto vecValue = value.value<QVector3D>(); for (int i = 0; i < 3; ++i) { @@ -345,7 +345,7 @@ void PropertyEditorQmlBackend::setValue(const QmlObjectNode & , const PropertyNa if (propertyValue) propertyValue->setValue(QVariant(vecValue[i])); } - } else if (value.type() == QVariant::Vector4D) { + } else if (value.typeId() == QVariant::Vector4D) { const char *suffix[4] = {"_x", "_y", "_z", "_w"}; auto vecValue = value.value<QVector4D>(); for (int i = 0; i < 4; ++i) { @@ -495,7 +495,8 @@ void PropertyEditorQmlBackend::setup(const QmlObjectNode &qmlObjectNode, const Q if (!qmlObjectNode.isValid()) return; - context()->setContextProperty(QLatin1String("propertyCount"), QVariant(qmlObjectNode.modelNode().properties().count())); + context()->setContextProperty(QLatin1String("propertyCount"), + QVariant(qmlObjectNode.modelNode().properties().size())); QStringList stateNames = qmlObjectNode.allStateNames(); stateNames.prepend("base state"); @@ -862,7 +863,7 @@ NodeMetaInfo PropertyEditorQmlBackend::findCommonAncestor(const ModelNode &node) AbstractView *view = node.view(); - if (view->selectedModelNodes().count() > 1) { + if (view->selectedModelNodes().size() > 1) { NodeMetaInfo commonClass = node.metaInfo(); for (const ModelNode ¤tNode : view->selectedModelNodes()) { if (currentNode.metaInfo().isValid() && !currentNode.metaInfo().isBasedOn(commonClass)) @@ -977,7 +978,7 @@ QString PropertyEditorQmlBackend::locateQmlFile(const NodeMetaInfo &info, const const QDir importDir(info.importDirectoryPath() + Constants::QML_DESIGNER_SUBFOLDER); const QDir importDirVersion(info.importDirectoryPath() + QStringLiteral(".") + QString::number(info.majorVersion()) + Constants::QML_DESIGNER_SUBFOLDER); - const QString relativePathWithoutEnding = relativePath.left(relativePath.count() - 4); + const QString relativePathWithoutEnding = relativePath.left(relativePath.size() - 4); const QString relativePathWithVersion = QString("%1_%2_%3.qml").arg(relativePathWithoutEnding ).arg(info.majorVersion()).arg(info.minorVersion()); diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.cpp b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.cpp index 89f8a77b0d..3f3ddaaf16 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.cpp @@ -41,7 +41,7 @@ QVariant PropertyEditorValue::value() const static bool cleverDoubleCompare(const QVariant &value1, const QVariant &value2) { - if (value1.type() == QVariant::Double && value2.type() == QVariant::Double) { + if (value1.typeId() == QVariant::Double && value2.typeId() == QVariant::Double) { // ignore slight changes on doubles if (qFuzzyCompare(value1.toDouble(), value2.toDouble())) return true; @@ -51,16 +51,16 @@ static bool cleverDoubleCompare(const QVariant &value1, const QVariant &value2) static bool cleverColorCompare(const QVariant &value1, const QVariant &value2) { - if (value1.type() == QVariant::Color && value2.type() == QVariant::Color) { + if (value1.typeId() == QVariant::Color && value2.typeId() == QVariant::Color) { QColor c1 = value1.value<QColor>(); QColor c2 = value2.value<QColor>(); return c1.name() == c2.name() && c1.alpha() == c2.alpha(); } - if (value1.type() == QVariant::String && value2.type() == QVariant::Color) + if (value1.typeId() == QVariant::String && value2.typeId() == QVariant::Color) return cleverColorCompare(QVariant(QColor(value1.toString())), value2); - if (value1.type() == QVariant::Color && value2.type() == QVariant::String) + if (value1.typeId() == QVariant::Color && value2.typeId() == QVariant::String) return cleverColorCompare(value1, QVariant(QColor(value2.toString()))); return false; @@ -71,7 +71,7 @@ static bool cleverColorCompare(const QVariant &value1, const QVariant &value2) static void fixAmbigousColorNames(const ModelNode &modelNode, const PropertyName &name, QVariant *value) { if (auto metaInfo = modelNode.metaInfo(); metaInfo.property(name).propertyType().isColor()) { - if (value->type() == QVariant::Color) { + if (value->typeId() == QVariant::Color) { QColor color = value->value<QColor>(); int alpha = color.alpha(); color = QColor(color.name()); diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorview.cpp b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorview.cpp index 17471733ae..976d2078a5 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorview.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorview.cpp @@ -201,7 +201,7 @@ void PropertyEditorView::changeValue(const QString &name) if (name == "state" && castedValue.toString() == "base state") castedValue = ""; - if (castedValue.type() == QVariant::Color) { + if (castedValue.typeId() == QVariant::Color) { QColor color = castedValue.value<QColor>(); QColor newColor = QColor(color.name()); newColor.setAlpha(color.alpha()); @@ -214,9 +214,9 @@ void PropertyEditorView::changeValue(const QString &name) } else { // QVector*D(0, 0, 0) detects as null variant though it is valid value if (castedValue.isValid() - && (!castedValue.isNull() || castedValue.type() == QVariant::Vector2D - || castedValue.type() == QVariant::Vector3D - || castedValue.type() == QVariant::Vector4D)) { + && (!castedValue.isNull() || castedValue.typeId() == QVariant::Vector2D + || castedValue.typeId() == QVariant::Vector3D + || castedValue.typeId() == QVariant::Vector4D)) { commitVariantValueToModel(propertyName, castedValue); } } diff --git a/src/plugins/qmldesigner/components/propertyeditor/qmlmodelnodeproxy.cpp b/src/plugins/qmldesigner/components/propertyeditor/qmlmodelnodeproxy.cpp index f121489916..96ec5f92e7 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/qmlmodelnodeproxy.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/qmlmodelnodeproxy.cpp @@ -50,7 +50,7 @@ bool QmlModelNodeProxy::multiSelection() const if (!m_qmlObjectNode.isValid()) return false; - return m_qmlObjectNode.view()->selectedModelNodes().count() > 1; + return m_qmlObjectNode.view()->selectedModelNodes().size() > 1; } QString QmlModelNodeProxy::nodeId() const diff --git a/src/plugins/qmldesigner/components/textureeditor/textureeditorqmlbackend.cpp b/src/plugins/qmldesigner/components/textureeditor/textureeditorqmlbackend.cpp index e54909049e..1325ade10c 100644 --- a/src/plugins/qmldesigner/components/textureeditor/textureeditorqmlbackend.cpp +++ b/src/plugins/qmldesigner/components/textureeditor/textureeditorqmlbackend.cpp @@ -34,7 +34,7 @@ static QObject *variantToQObject(const QVariant &value) { - if (value.userType() == QMetaType::QObjectStar || value.userType() > QMetaType::User) + if (value.typeId() == QMetaType::QObjectStar || value.typeId() > QMetaType::User) return *(QObject **)value.constData(); return nullptr; @@ -109,7 +109,7 @@ void TextureEditorQmlBackend::createPropertyEditorValue(const QmlObjectNode &qml void TextureEditorQmlBackend::setValue(const QmlObjectNode &, const PropertyName &name, const QVariant &value) { // Vector*D values need to be split into their subcomponents - if (value.type() == QVariant::Vector2D) { + if (value.typeId() == QVariant::Vector2D) { const char *suffix[2] = {"_x", "_y"}; auto vecValue = value.value<QVector2D>(); for (int i = 0; i < 2; ++i) { @@ -120,7 +120,7 @@ void TextureEditorQmlBackend::setValue(const QmlObjectNode &, const PropertyName if (propertyValue) propertyValue->setValue(QVariant(vecValue[i])); } - } else if (value.type() == QVariant::Vector3D) { + } else if (value.typeId() == QVariant::Vector3D) { const char *suffix[3] = {"_x", "_y", "_z"}; auto vecValue = value.value<QVector3D>(); for (int i = 0; i < 3; ++i) { @@ -131,7 +131,7 @@ void TextureEditorQmlBackend::setValue(const QmlObjectNode &, const PropertyName if (propertyValue) propertyValue->setValue(QVariant(vecValue[i])); } - } else if (value.type() == QVariant::Vector4D) { + } else if (value.typeId() == QVariant::Vector4D) { const char *suffix[4] = {"_x", "_y", "_z", "_w"}; auto vecValue = value.value<QVector4D>(); for (int i = 0; i < 4; ++i) { diff --git a/src/plugins/qmldesigner/components/textureeditor/textureeditorview.cpp b/src/plugins/qmldesigner/components/textureeditor/textureeditorview.cpp index a4132d0eb7..250f3324e4 100644 --- a/src/plugins/qmldesigner/components/textureeditor/textureeditorview.cpp +++ b/src/plugins/qmldesigner/components/textureeditor/textureeditorview.cpp @@ -141,7 +141,7 @@ void TextureEditorView::changeValue(const QString &name) if (name == "state" && castedValue.toString() == "base state") castedValue = ""; - if (castedValue.type() == QVariant::Color) { + if (castedValue.typeId() == QVariant::Color) { QColor color = castedValue.value<QColor>(); QColor newColor = QColor(color.name()); newColor.setAlpha(color.alpha()); @@ -153,9 +153,9 @@ void TextureEditorView::changeValue(const QString &name) } else { // QVector*D(0, 0, 0) detects as null variant though it is valid value if (castedValue.isValid() - && (!castedValue.isNull() || castedValue.type() == QVariant::Vector2D - || castedValue.type() == QVariant::Vector3D - || castedValue.type() == QVariant::Vector4D)) { + && (!castedValue.isNull() || castedValue.typeId() == QVariant::Vector2D + || castedValue.typeId() == QVariant::Vector3D + || castedValue.typeId() == QVariant::Vector4D)) { commitVariantValueToModel(propertyName, castedValue); } } diff --git a/src/plugins/qmldesigner/components/timelineeditor/canvas.cpp b/src/plugins/qmldesigner/components/timelineeditor/canvas.cpp index f82d2098c6..66f207bd83 100644 --- a/src/plugins/qmldesigner/components/timelineeditor/canvas.cpp +++ b/src/plugins/qmldesigner/components/timelineeditor/canvas.cpp @@ -134,7 +134,7 @@ void Canvas::paintCurve(QPainter *painter, const EasingCurve &curve, const QColo void Canvas::paintControlPoints(QPainter *painter, const EasingCurve &curve) { QVector<QPointF> points = curve.toCubicSpline(); - int count = points.count(); + int count = points.size(); if (count <= 1) return; diff --git a/src/plugins/qmldesigner/components/timelineeditor/easingcurve.cpp b/src/plugins/qmldesigner/components/timelineeditor/easingcurve.cpp index 92f7590503..ae9833e46e 100644 --- a/src/plugins/qmldesigner/components/timelineeditor/easingcurve.cpp +++ b/src/plugins/qmldesigner/components/timelineeditor/easingcurve.cpp @@ -49,7 +49,7 @@ void EasingCurve::registerStreamOperators() int EasingCurve::count() const { - return toCubicSpline().count(); + return toCubicSpline().size(); } int EasingCurve::active() const @@ -59,7 +59,7 @@ int EasingCurve::active() const int EasingCurve::segmentCount() const { - return toCubicSpline().count() / 3; + return toCubicSpline().size() / 3; } bool EasingCurve::isLegal() const @@ -127,10 +127,10 @@ bool EasingCurve::fromString(const QString &code) if (code.startsWith(QLatin1Char('[')) && code.endsWith(QLatin1Char(']'))) { const auto stringList = code.mid(1, code.size() - 2).split(QLatin1Char(','), Qt::SkipEmptyParts); - if (stringList.count() >= 6 && (stringList.count() % 6 == 0)) { + if (stringList.size() >= 6 && (stringList.size() % 6 == 0)) { bool checkX, checkY; QVector<QPointF> points; - for (int i = 0; i < stringList.count(); ++i) { + for (int i = 0; i < stringList.size(); ++i) { QPointF point; point.rx() = stringList[i].toDouble(&checkX); point.ry() = stringList[++i].toDouble(&checkY); @@ -146,7 +146,7 @@ bool EasingCurve::fromString(const QString &code) QEasingCurve easingCurve(QEasingCurve::BezierSpline); - for (int i = 0; i < points.count() / 3; ++i) { + for (int i = 0; i < points.size() / 3; ++i) { easingCurve.addCubicBezierSegment(points.at(i * 3), points.at(i * 3 + 1), points.at(i * 3 + 2)); @@ -176,7 +176,7 @@ QPainterPath EasingCurve::path() const QVector<QPointF> controlPoints = toCubicSpline(); - int numSegments = controlPoints.count() / 3; + int numSegments = controlPoints.size() / 3; for (int i = 0; i < numSegments; i++) { QPointF p1 = controlPoints.at(i * 3); QPointF p2 = controlPoints.at(i * 3 + 1); @@ -202,7 +202,7 @@ QPointF EasingCurve::point(int idx) const { QVector<QPointF> controlPoints = toCubicSpline(); - QTC_ASSERT(controlPoints.count() > idx || idx < 0, return QPointF()); + QTC_ASSERT(controlPoints.size() > idx || idx < 0, return QPointF()); return controlPoints.at(idx); } @@ -259,7 +259,7 @@ void EasingCurve::makeSmooth(int idx) before = controlPoints.at(idx - 3); QPointF after = end(); - if ((idx + 3) < controlPoints.count()) + if ((idx + 3) < controlPoints.size()) after = controlPoints.at(idx + 3); QPointF tangent = (after - before) / 6; @@ -269,7 +269,7 @@ void EasingCurve::makeSmooth(int idx) if (idx > 0) controlPoints[idx - 1] = thisPoint - tangent; - if (idx + 1 < controlPoints.count()) + if (idx + 1 < controlPoints.size()) controlPoints[idx + 1] = thisPoint + tangent; fromCubicSpline(controlPoints); @@ -288,7 +288,7 @@ void EasingCurve::breakTangent(int idx) before = controlPoints.at(idx - 3); QPointF after = end(); - if ((idx + 3) < controlPoints.count()) + if ((idx + 3) < controlPoints.size()) after = controlPoints.at(idx + 3); QPointF thisPoint = controlPoints.at(idx); @@ -296,7 +296,7 @@ void EasingCurve::breakTangent(int idx) if (idx > 0) controlPoints[idx - 1] = (before - thisPoint) / 3 + thisPoint; - if (idx + 1 < controlPoints.count()) + if (idx + 1 < controlPoints.size()) controlPoints[idx + 1] = (after - thisPoint) / 3 + thisPoint; fromCubicSpline(controlPoints); @@ -326,7 +326,7 @@ void EasingCurve::addPoint(const QPointF &point) } QPointF after = end(); - if ((splitIndex + 3) < controlPoints.count()) { + if ((splitIndex + 3) < controlPoints.size()) { after = controlPoints.at(splitIndex + 3); } @@ -394,7 +394,7 @@ void EasingCurve::fromCubicSpline(const QVector<QPointF> &points) { QEasingCurve tmp(QEasingCurve::BezierSpline); - int numSegments = points.count() / 3; + int numSegments = points.size() / 3; for (int i = 0; i < numSegments; ++i) { tmp.addCubicBezierSegment(points.at(i * 3), points.at(i * 3 + 1), points.at(i * 3 + 2)); } diff --git a/src/plugins/qmldesigner/components/timelineeditor/timelineanimationform.cpp b/src/plugins/qmldesigner/components/timelineeditor/timelineanimationform.cpp index 494674891e..dbb34c02c8 100644 --- a/src/plugins/qmldesigner/components/timelineeditor/timelineanimationform.cpp +++ b/src/plugins/qmldesigner/components/timelineeditor/timelineanimationform.cpp @@ -222,7 +222,7 @@ void TimelineAnimationForm::populateStateComboBox() if (m_animation.signalHandlerProperty("onFinished").isValid()) { const QString source = m_animation.signalHandlerProperty("onFinished").source(); const QStringList list = source.split("="); - if (list.count() == 2) { + if (list.size() == 2) { QString name = list.last().trimmed(); name.chop(1); name.remove(0, 1); diff --git a/src/plugins/qmldesigner/components/timelineeditor/timelinecontrols.cpp b/src/plugins/qmldesigner/components/timelineeditor/timelinecontrols.cpp index d9f3dd4d16..708bd8c4d3 100644 --- a/src/plugins/qmldesigner/components/timelineeditor/timelinecontrols.cpp +++ b/src/plugins/qmldesigner/components/timelineeditor/timelinecontrols.cpp @@ -78,7 +78,7 @@ QVariant FloatControl::controlValue() const void FloatControl::setControlValue(const QVariant &value) { - if (value.userType() != QMetaType::Float && value.userType() != QMetaType::Double) + if (value.typeId() != QMetaType::Float && value.typeId() != QMetaType::Double) return; QSignalBlocker blocker(this); @@ -129,7 +129,7 @@ QVariant ColorControl::controlValue() const void ColorControl::setControlValue(const QVariant &value) { - if (value.userType() != QMetaType::QColor) + if (value.typeId() != QMetaType::QColor) return; m_color = qvariant_cast<QColor>(value); diff --git a/src/plugins/qmldesigner/components/timelineeditor/timelinegraphicsscene.cpp b/src/plugins/qmldesigner/components/timelineeditor/timelinegraphicsscene.cpp index ddddc7c753..f116d96223 100644 --- a/src/plugins/qmldesigner/components/timelineeditor/timelinegraphicsscene.cpp +++ b/src/plugins/qmldesigner/components/timelineeditor/timelinegraphicsscene.cpp @@ -386,7 +386,7 @@ bool AbstractScrollGraphicsScene::isKeyframeSelected(TimelineKeyframeItem *keyfr bool AbstractScrollGraphicsScene::multipleKeyframesSelected() const { - return m_selectedKeyframes.count() > 1; + return m_selectedKeyframes.size() > 1; } void TimelineGraphicsScene::invalidateSectionForTarget(const ModelNode &target) diff --git a/src/plugins/qmldesigner/components/timelineeditor/timelinepropertyitem.cpp b/src/plugins/qmldesigner/components/timelineeditor/timelinepropertyitem.cpp index 90e4a66acf..6dcb39f2a0 100644 --- a/src/plugins/qmldesigner/components/timelineeditor/timelinepropertyitem.cpp +++ b/src/plugins/qmldesigner/components/timelineeditor/timelinepropertyitem.cpp @@ -105,7 +105,7 @@ static void editValue(const ModelNode &frameNode, const std::pair<qreal, qreal> if (newFrame != frame) frameNode.variantProperty("frame").setValue(newFrame); - int userType = value.userType(); + int userType = value.typeId(); QVariant newValue = dialog->value(); if (newValue.canConvert(userType)) { @@ -264,7 +264,7 @@ bool TimelinePropertyItem::isSelected() const QString convertVariant(const QVariant &variant) { - if (variant.userType() == QMetaType::QColor) + if (variant.typeId() == QMetaType::QColor) return variant.toString(); return QString::number(variant.toFloat(), 'f', 2); diff --git a/src/plugins/qmldesigner/components/timelineeditor/timelinesectionitem.cpp b/src/plugins/qmldesigner/components/timelineeditor/timelinesectionitem.cpp index 4604e9e3b8..7a733c3729 100644 --- a/src/plugins/qmldesigner/components/timelineeditor/timelinesectionitem.cpp +++ b/src/plugins/qmldesigner/components/timelineeditor/timelinesectionitem.cpp @@ -420,7 +420,7 @@ void TimelineSectionItem::invalidateHeight() visible = false; } else { height = TimelineConstants::sectionHeight - + m_timeline.keyframeGroupsForTarget(m_targetNode).count() + + m_timeline.keyframeGroupsForTarget(m_targetNode).size() * TimelineConstants::sectionHeight; visible = true; } @@ -801,7 +801,7 @@ void TimelineRulerSectionItem::extendPlaybackLoop(const QList<qreal> &positions, qreal right = m_playbackLoopEnd; if (reset) { - if (positions.count() >= 2) { + if (positions.size() >= 2) { left = m_duration; right = 0; } else { diff --git a/src/plugins/qmldesigner/components/timelineeditor/timelineselectiontool.cpp b/src/plugins/qmldesigner/components/timelineeditor/timelineselectiontool.cpp index 68aeefcd23..230ab401a7 100644 --- a/src/plugins/qmldesigner/components/timelineeditor/timelineselectiontool.cpp +++ b/src/plugins/qmldesigner/components/timelineeditor/timelineselectiontool.cpp @@ -169,7 +169,7 @@ void TimelineSelectionTool::aboutToSelect(SelectionMode mode, QList<QGraphicsIte void TimelineSelectionTool::commitSelection(SelectionMode mode) { - if (m_playbackLoopTimeSteps.count()) + if (m_playbackLoopTimeSteps.size()) qobject_cast<TimelineGraphicsScene *>(scene())->layoutRuler()->extendPlaybackLoop(m_playbackLoopTimeSteps, mode == SelectionMode::Toggle); // TODO: Highlighting items with selection tool is set or added to loop range. Select shortcut for this QDS-4941 scene()->selectKeyframes(mode, m_aboutToSelectBuffer); diff --git a/src/plugins/qmldesigner/components/toolbar/toolbarbackend.cpp b/src/plugins/qmldesigner/components/toolbar/toolbarbackend.cpp index 1b9f1e3271..c917dfe8a8 100644 --- a/src/plugins/qmldesigner/components/toolbar/toolbarbackend.cpp +++ b/src/plugins/qmldesigner/components/toolbar/toolbarbackend.cpp @@ -86,7 +86,7 @@ CrumbleBarModel::CrumbleBarModel(QObject *) int CrumbleBarModel::rowCount(const QModelIndex &) const { - return crumbleBar()->path().count(); + return crumbleBar()->path().size(); } QHash<int, QByteArray> CrumbleBarModel::roleNames() const @@ -148,7 +148,7 @@ WorkspaceModel::WorkspaceModel(QObject *) int WorkspaceModel::rowCount(const QModelIndex &) const { if (designModeWidget() && designModeWidget()->dockManager()) - return designModeWidget()->dockManager()->workspaces().count(); + return designModeWidget()->dockManager()->workspaces().size(); return 0; } @@ -476,7 +476,7 @@ void ToolBarBackend::setCurrentStyle(int index) QmlDesignerPlugin::emitUsageStatistics(Constants::EVENT_STATUSBAR_SET_STYLE); const QList<StyleWidgetEntry> items = ChangeStyleWidgetAction::getAllStyleItems(); - QTC_ASSERT(items.count() > index, return ); + QTC_ASSERT(items.size() > index, return); QTC_ASSERT(index > 0, return ); QTC_ASSERT(currentDesignDocument(), return ); @@ -499,7 +499,7 @@ void ToolBarBackend::setCurrentKit(int index) const auto kits = ProjectExplorer::KitManager::kits(); - QTC_ASSERT(kits.count() > index, return ); + QTC_ASSERT(kits.size() > index, return); QTC_ASSERT(index >= 0, return ); const auto kit = kits.at(index); diff --git a/src/plugins/qmldesigner/components/transitioneditor/transitioneditorsectionitem.cpp b/src/plugins/qmldesigner/components/transitioneditor/transitioneditorsectionitem.cpp index d331e82b40..a5ec84fad2 100644 --- a/src/plugins/qmldesigner/components/transitioneditor/transitioneditorsectionitem.cpp +++ b/src/plugins/qmldesigner/components/transitioneditor/transitioneditorsectionitem.cpp @@ -441,7 +441,7 @@ void TransitionEditorSectionItem::invalidateHeight() model->qtQuickPropertyAnimationMetaInfo()); height = TimelineConstants::sectionHeight - + propertyAnimations.count() * TimelineConstants::sectionHeight; + + propertyAnimations.size() * TimelineConstants::sectionHeight; visible = true; } diff --git a/src/plugins/qmldesigner/components/transitioneditor/transitionform.cpp b/src/plugins/qmldesigner/components/transitioneditor/transitionform.cpp index 9613be5178..c58bdf61d5 100644 --- a/src/plugins/qmldesigner/components/transitioneditor/transitionform.cpp +++ b/src/plugins/qmldesigner/components/transitioneditor/transitionform.cpp @@ -66,7 +66,7 @@ TransitionForm::TransitionForm(QWidget *parent) QTC_ASSERT(m_transition.isValid(), return ); const QmlItemNode root(m_transition.view()->rootModelNode()); QTC_ASSERT(root.isValid(), return ); - const int stateCount = root.states().names().count(); + const int stateCount = root.states().names().size(); QStringList stateNames; @@ -76,7 +76,7 @@ TransitionForm::TransitionForm(QWidget *parent) } QString toValue; - if (stateCount == stateNames.count()) + if (stateCount == stateNames.size()) toValue = "*"; else toValue = stateNames.join(","); @@ -90,7 +90,7 @@ TransitionForm::TransitionForm(QWidget *parent) QTC_ASSERT(m_transition.isValid(), return ); const QmlItemNode root(m_transition.view()->rootModelNode()); QTC_ASSERT(root.isValid(), return ); - const int stateCount = root.states().names().count(); + const int stateCount = root.states().names().size(); QStringList stateNames; @@ -100,7 +100,7 @@ TransitionForm::TransitionForm(QWidget *parent) } QString fromValue; - if (stateCount == stateNames.count()) + if (stateCount == stateNames.size()) fromValue = "*"; else fromValue = stateNames.join(","); diff --git a/src/plugins/qmldesigner/designercore/imagecache/imagecacheconnectionmanager.cpp b/src/plugins/qmldesigner/designercore/imagecache/imagecacheconnectionmanager.cpp index ee40b3ec31..20728b445e 100644 --- a/src/plugins/qmldesigner/designercore/imagecache/imagecacheconnectionmanager.cpp +++ b/src/plugins/qmldesigner/designercore/imagecache/imagecacheconnectionmanager.cpp @@ -47,7 +47,7 @@ void ImageCacheConnectionManager::dispatchCommand(const QVariant &command, { static const int capturedDataCommandType = QMetaType::type("CapturedDataCommand"); - if (command.userType() == capturedDataCommandType) { + if (command.typeId() == capturedDataCommandType) { m_captureCallback(command.value<CapturedDataCommand>().image); m_capturedDataArrived = true; } diff --git a/src/plugins/qmldesigner/designercore/include/modelnode.h b/src/plugins/qmldesigner/designercore/include/modelnode.h index bfc1570cb6..657093b0ac 100644 --- a/src/plugins/qmldesigner/designercore/include/modelnode.h +++ b/src/plugins/qmldesigner/designercore/include/modelnode.h @@ -74,7 +74,7 @@ public: NodeWithComponentSource = 2 }; - ModelNode(); + ModelNode() = default; ModelNode(const Internal::InternalNodePointer &internalNode, Model *model, const AbstractView *view); ModelNode(const ModelNode &modelNode, AbstractView *view); ModelNode(const ModelNode &) = default; @@ -173,7 +173,7 @@ public: void selectNode(); void deselectNode(); - static int variantUserType(); + static int variantTypeId(); QVariant toVariant() const; std::optional<QVariant> auxiliaryData(AuxiliaryDataKeyView key) const; diff --git a/src/plugins/qmldesigner/designercore/include/propertynode.h b/src/plugins/qmldesigner/designercore/include/propertynode.h index 2489bac3c0..2df0b195a4 100644 --- a/src/plugins/qmldesigner/designercore/include/propertynode.h +++ b/src/plugins/qmldesigner/designercore/include/propertynode.h @@ -12,7 +12,7 @@ class QMLDESIGNERCORE_EXPORT PropertyNode // : public BaseModelNode public: PropertyNode(); -// static int variantUserType() { return qMetaTypeId<InternalNode::Pointer>(); } +// static int variantTypeId() { return qMetaTypeId<InternalNode::Pointer>(); } // static QVariant toVariant(const InternalNode::Pointer &internalNodePointer) { return QVariant::fromValue(internalNodePointer); } }; diff --git a/src/plugins/qmldesigner/designercore/instances/baseconnectionmanager.cpp b/src/plugins/qmldesigner/designercore/instances/baseconnectionmanager.cpp index 15f84e92c9..39da5f99ba 100644 --- a/src/plugins/qmldesigner/designercore/instances/baseconnectionmanager.cpp +++ b/src/plugins/qmldesigner/designercore/instances/baseconnectionmanager.cpp @@ -107,8 +107,8 @@ void BaseConnectionManager::readDataStream(Connection &connection) connection.blockSize = 0; #ifdef NANOTRACE_ENABLED - if (command.userType() != QMetaType::type("PuppetAliveCommand")) { - if (command.userType() == QMetaType::type("SyncNanotraceCommand")) { + if (command.typeId() != QMetaType::type("PuppetAliveCommand")) { + if (command.typeId() == QMetaType::type("SyncNanotraceCommand")) { SyncNanotraceCommand cmd = command.value<SyncNanotraceCommand>(); NANOTRACE_INSTANT_ARGS("Sync", "readCommand", {"name", cmd.name().toStdString()}, diff --git a/src/plugins/qmldesigner/designercore/instances/capturingconnectionmanager.cpp b/src/plugins/qmldesigner/designercore/instances/capturingconnectionmanager.cpp index b2b8f297f7..77b087e8c9 100644 --- a/src/plugins/qmldesigner/designercore/instances/capturingconnectionmanager.cpp +++ b/src/plugins/qmldesigner/designercore/instances/capturingconnectionmanager.cpp @@ -55,7 +55,7 @@ void CapturingConnectionManager::writeCommand(const QVariant &command) InteractiveConnectionManager::writeCommand(command); if (m_captureFileForTest.isWritable()) { - qDebug() << "command name: " << QMetaType::typeName(command.userType()); + qDebug() << "command name: " << QMetaType::typeName(command.typeId()); writeCommandToIODevice(command, &m_captureFileForTest, writeCommandCounter()); qDebug() << "\tcatpure file offset: " << m_captureFileForTest.pos(); } diff --git a/src/plugins/qmldesigner/designercore/instances/interactiveconnectionmanager.cpp b/src/plugins/qmldesigner/designercore/instances/interactiveconnectionmanager.cpp index 33dad3c37d..cd36cac76d 100644 --- a/src/plugins/qmldesigner/designercore/instances/interactiveconnectionmanager.cpp +++ b/src/plugins/qmldesigner/designercore/instances/interactiveconnectionmanager.cpp @@ -70,7 +70,7 @@ void InteractiveConnectionManager::dispatchCommand(const QVariant &command, Conn { static const int puppetAliveCommandType = QMetaType::type("PuppetAliveCommand"); - if (command.userType() == puppetAliveCommandType) { + if (command.typeId() == puppetAliveCommandType) { puppetAlive(connection); } else { BaseConnectionManager::dispatchCommand(command, connection); diff --git a/src/plugins/qmldesigner/designercore/instances/nodeinstance.cpp b/src/plugins/qmldesigner/designercore/instances/nodeinstance.cpp index 7ed2906338..414a05683e 100644 --- a/src/plugins/qmldesigner/designercore/instances/nodeinstance.cpp +++ b/src/plugins/qmldesigner/designercore/instances/nodeinstance.cpp @@ -296,7 +296,7 @@ QVariant NodeInstance::property(const PropertyName &name) const if (index != -1) { PropertyName parentPropName = name.left(index); QVariant varValue = d->propertyValues.value(parentPropName); - if (varValue.type() == QVariant::Vector2D) { + if (varValue.typeId() == QVariant::Vector2D) { auto value = varValue.value<QVector2D>(); char subProp = name.right(1)[0]; float subValue = 0.f; @@ -312,7 +312,7 @@ QVariant NodeInstance::property(const PropertyName &name) const break; } return QVariant(subValue); - } else if (varValue.type() == QVariant::Vector3D) { + } else if (varValue.typeId() == QVariant::Vector3D) { auto value = varValue.value<QVector3D>(); char subProp = name.right(1)[0]; float subValue = 0.f; @@ -331,7 +331,7 @@ QVariant NodeInstance::property(const PropertyName &name) const break; } return QVariant(subValue); - } else if (varValue.type() == QVariant::Vector4D) { + } else if (varValue.typeId() == QVariant::Vector4D) { auto value = varValue.value<QVector4D>(); char subProp = name.right(1)[0]; float subValue = 0.f; @@ -417,9 +417,9 @@ void NodeInstance::setProperty(const PropertyName &name, const QVariant &value) QVariant oldValue = d->propertyValues.value(parentPropName); QVariant newValueVar; bool update = false; - if (oldValue.type() == QVariant::Vector2D) { + if (oldValue.typeId() == QVariant::Vector2D) { QVector2D newValue; - if (oldValue.type() == QVariant::Vector2D) + if (oldValue.typeId() == QVariant::Vector2D) newValue = oldValue.value<QVector2D>(); if (name.endsWith(".x")) { newValue.setX(value.toFloat()); @@ -429,9 +429,9 @@ void NodeInstance::setProperty(const PropertyName &name, const QVariant &value) update = true; } newValueVar = newValue; - } else if (oldValue.type() == QVariant::Vector3D) { + } else if (oldValue.typeId() == QVariant::Vector3D) { QVector3D newValue; - if (oldValue.type() == QVariant::Vector3D) + if (oldValue.typeId() == QVariant::Vector3D) newValue = oldValue.value<QVector3D>(); if (name.endsWith(".x")) { newValue.setX(value.toFloat()); @@ -444,9 +444,9 @@ void NodeInstance::setProperty(const PropertyName &name, const QVariant &value) update = true; } newValueVar = newValue; - } else if (oldValue.type() == QVariant::Vector4D) { + } else if (oldValue.typeId() == QVariant::Vector4D) { QVector4D newValue; - if (oldValue.type() == QVariant::Vector4D) + if (oldValue.typeId() == QVariant::Vector4D) newValue = oldValue.value<QVector4D>(); if (name.endsWith(".x")) { newValue.setX(value.toFloat()); diff --git a/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp b/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp index 2893d0e131..8b80a9c4af 100644 --- a/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp +++ b/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp @@ -107,37 +107,38 @@ void NodeInstanceServerProxy::dispatchCommand(const QVariant &command) static const int puppetToCreatorCommandType = QMetaType::type("PuppetToCreatorCommand"); static const int SyncNanotraceCommandType = QMetaType::type("SyncNanotraceCommand"); - qCInfo(instanceViewBenchmark) << "dispatching command" << command.userType() << command.typeName(); - if (command.userType() == informationChangedCommandType) { + qCInfo(instanceViewBenchmark) << "dispatching command" << command.typeId() << command.typeName(); + if (command.typeId() == informationChangedCommandType) { nodeInstanceClient()->informationChanged(command.value<InformationChangedCommand>()); - } else if (command.userType() == valuesChangedCommandType) { + } else if (command.typeId() == valuesChangedCommandType) { nodeInstanceClient()->valuesChanged(command.value<ValuesChangedCommand>()); - } else if (command.userType() == valuesModifiedCommandType) { + } else if (command.typeId() == valuesModifiedCommandType) { nodeInstanceClient()->valuesModified(command.value<ValuesModifiedCommand>()); - } else if (command.userType() == pixmapChangedCommandType) { + } else if (command.typeId() == pixmapChangedCommandType) { nodeInstanceClient()->pixmapChanged(command.value<PixmapChangedCommand>()); - } else if (command.userType() == childrenChangedCommandType) { + } else if (command.typeId() == childrenChangedCommandType) { nodeInstanceClient()->childrenChanged(command.value<ChildrenChangedCommand>()); - } else if (command.userType() == statePreviewImageChangedCommandType) { + } else if (command.typeId() == statePreviewImageChangedCommandType) { nodeInstanceClient()->statePreviewImagesChanged(command.value<StatePreviewImageChangedCommand>()); - } else if (command.userType() == componentCompletedCommandType) { + } else if (command.typeId() == componentCompletedCommandType) { nodeInstanceClient()->componentCompleted(command.value<ComponentCompletedCommand>()); - } else if (command.userType() == tokenCommandType) { + } else if (command.typeId() == tokenCommandType) { nodeInstanceClient()->token(command.value<TokenCommand>()); - } else if (command.userType() == debugOutputCommandType) { + } else if (command.typeId() == debugOutputCommandType) { nodeInstanceClient()->debugOutput(command.value<DebugOutputCommand>()); - } else if (command.userType() == changeSelectionCommandType) { + } else if (command.typeId() == changeSelectionCommandType) { nodeInstanceClient()->selectionChanged(command.value<ChangeSelectionCommand>()); - } else if (command.userType() == puppetToCreatorCommandType) { + } else if (command.typeId() == puppetToCreatorCommandType) { nodeInstanceClient()->handlePuppetToCreatorCommand(command.value<PuppetToCreatorCommand>()); - } else if (command.userType() == SyncNanotraceCommandType) { + } else if (command.typeId() == SyncNanotraceCommandType) { // ignore. } else { QTC_ASSERT(false, ); Q_ASSERT(false); } - qCInfo(instanceViewBenchmark) << "dispatching command" << "done" << command.userType(); + qCInfo(instanceViewBenchmark) << "dispatching command" + << "done" << command.typeId(); } NodeInstanceClientInterface *NodeInstanceServerProxy::nodeInstanceClient() const @@ -173,7 +174,7 @@ QString NodeInstanceServerProxy::qrcMappingString() const void NodeInstanceServerProxy::writeCommand(const QVariant &command) { #ifdef NANOTRACE_ENABLED - if (command.userType() == QMetaType::type("SyncNanotraceCommand")) { + if (command.typeId() == QMetaType::type("SyncNanotraceCommand")) { SyncNanotraceCommand cmd = command.value<SyncNanotraceCommand>(); NANOTRACE_INSTANT_ARGS("Sync", "writeCommand", {"name", cmd.name().toStdString()}, diff --git a/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp b/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp index 0864e137c2..e5775228ef 100644 --- a/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp +++ b/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp @@ -201,7 +201,7 @@ NodeInstanceView::~NodeInstanceView() //\{ -bool static isSkippedRootNode(const ModelNode &node) +static bool isSkippedRootNode(const ModelNode &node) { static const PropertyNameList skipList({"Qt.ListModel", "QtQuick.ListModel", "Qt.ListModel", "QtQuick.ListModel"}); @@ -211,8 +211,7 @@ bool static isSkippedRootNode(const ModelNode &node) return false; } - -bool static isSkippedNode(const ModelNode &node) +static bool isSkippedNode(const ModelNode &node) { static const PropertyNameList skipList({"QtQuick.XmlRole", "Qt.XmlRole", "QtQuick.ListElement", "Qt.ListElement"}); @@ -222,7 +221,7 @@ bool static isSkippedNode(const ModelNode &node) return false; } -bool static parentTakesOverRendering(const ModelNode &modelNode) +static bool parentTakesOverRendering(const ModelNode &modelNode) { ModelNode currentNode = modelNode; @@ -1503,7 +1502,7 @@ void NodeInstanceView::pixmapChanged(const PixmapChangedCommand &command) } } - m_nodeInstanceServer->benchmark(Q_FUNC_INFO + QString::number(renderImageChangeSet.count())); + m_nodeInstanceServer->benchmark(Q_FUNC_INFO + QString::number(renderImageChangeSet.size())); if (!renderImageChangeSet.isEmpty()) emitInstancesRenderImageChanged(Utils::toList(renderImageChangeSet)); @@ -1542,7 +1541,7 @@ void NodeInstanceView::informationChanged(const InformationChangedCommand &comma QMultiHash<ModelNode, InformationName> informationChangeHash = informationChanged(command.informations()); - m_nodeInstanceServer->benchmark(Q_FUNC_INFO + QString::number(informationChangeHash.count())); + m_nodeInstanceServer->benchmark(Q_FUNC_INFO + QString::number(informationChangeHash.size())); if (!informationChangeHash.isEmpty()) emitInstanceInformationsChange(informationChangeHash); @@ -1615,7 +1614,7 @@ void NodeInstanceView::componentCompleted(const ComponentCompletedCommand &comma nodeVector.append(modelNodeForInternalId(instanceId)); } - m_nodeInstanceServer->benchmark(Q_FUNC_INFO + QString::number(nodeVector.count())); + m_nodeInstanceServer->benchmark(Q_FUNC_INFO + QString::number(nodeVector.size())); if (!nodeVector.isEmpty()) emitInstancesCompleted(nodeVector); diff --git a/src/plugins/qmldesigner/designercore/metainfo/metainforeader.cpp b/src/plugins/qmldesigner/designercore/metainfo/metainforeader.cpp index f418d003e1..a56221f643 100644 --- a/src/plugins/qmldesigner/designercore/metainfo/metainforeader.cpp +++ b/src/plugins/qmldesigner/designercore/metainfo/metainforeader.cpp @@ -289,7 +289,7 @@ inline QString deEscape(const QString &value) inline QVariant deEscapeVariant(const QVariant &value) { - if (value.type() == QVariant::String) + if (value.typeId() == QVariant::String) return deEscape(value.toString()); return value; } diff --git a/src/plugins/qmldesigner/designercore/metainfo/nodehints.cpp b/src/plugins/qmldesigner/designercore/metainfo/nodehints.cpp index 0a4f84f320..ece5b4bf6f 100644 --- a/src/plugins/qmldesigner/designercore/metainfo/nodehints.cpp +++ b/src/plugins/qmldesigner/designercore/metainfo/nodehints.cpp @@ -266,7 +266,7 @@ QPair<QString, QVariant> NodeHints::setParentProperty() const QStringList list = str.split(":"); - if (list.count() != 2) + if (list.size() != 2) return {}; return qMakePair(list.first().trimmed(), parseValue(list.last().trimmed())); diff --git a/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp b/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp index bdb7b63392..09a9a1d72b 100644 --- a/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp +++ b/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp @@ -336,7 +336,7 @@ private: const ContextPtr m_context; }; -static inline bool isValueType(const TypeName &type) +inline static bool isValueType(const TypeName &type) { static const PropertyTypeList objectValuesList({"QFont", "QPoint", @@ -356,7 +356,7 @@ static inline bool isValueType(const TypeName &type) return objectValuesList.contains(type); } -static inline bool isValueType(const QString &type) +inline static bool isValueType(const QString &type) { static const QStringList objectValuesList({"QFont", "QPoint", @@ -713,7 +713,7 @@ PropertyName NodeMetaInfoPrivate::defaultPropertyName() const return PropertyName("data"); } -static inline TypeName stringIdentifier( const TypeName &type, int maj, int min) +inline static TypeName stringIdentifier(const TypeName &type, int maj, int min) { return type + QByteArray::number(maj) + '_' + QByteArray::number(min); } @@ -2911,8 +2911,7 @@ QVariant PropertyMetaInfo::castedValue(const QVariant &value) const QVariant::Type typeId = nodeMetaInfoPrivateData()->variantTypeId(propertyName()); - if (variant.type() == QVariant::UserType - && variant.userType() == ModelNode::variantUserType()) { + if (variant.typeId() == QVariant::UserType && variant.typeId() == ModelNode::variantTypeId()) { return variant; } else if (typeId == QVariant::UserType && typeName == "QVariant") { return variant; @@ -2920,7 +2919,7 @@ QVariant PropertyMetaInfo::castedValue(const QVariant &value) const return variant; } else if (typeId == QVariant::UserType && typeName == "var") { return variant; - } else if (variant.type() == QVariant::List) { + } else if (variant.typeId() == QVariant::List) { // TODO: check the contents of the list return variant; } else if (typeName == "var" || typeName == "variant") { @@ -2946,11 +2945,11 @@ QVariant PropertyMetaInfo::castedValue(const QVariant &value) const const TypeId &typeId = propertyData().typeId; - if (value.type() == QVariant::UserType && value.userType() == ModelNode::variantUserType()) { + if (value.typeId() == QVariant::UserType && value.typeId() == ModelNode::variantTypeId()) { return value; } else if (typeId == m_projectStorage->builtinTypeId<QVariant>()) { return value; - } else if (value.type() == QVariant::List) { + } else if (value.typeId() == QVariant::List) { // TODO: check the contents of the list return value; } else if (typeId == m_projectStorage->builtinTypeId<double>()) { diff --git a/src/plugins/qmldesigner/designercore/model/abstractview.cpp b/src/plugins/qmldesigner/designercore/model/abstractview.cpp index 881f43b658..a8ad4b76e7 100644 --- a/src/plugins/qmldesigner/designercore/model/abstractview.cpp +++ b/src/plugins/qmldesigner/designercore/model/abstractview.cpp @@ -440,7 +440,7 @@ bool AbstractView::hasSelectedModelNodes() const bool AbstractView::hasSingleSelectedModelNode() const { - return model()->d->selectedNodes().count() == 1; + return model()->d->selectedNodes().size() == 1; } bool AbstractView::isSelectedModelNode(const ModelNode &modelNode) const diff --git a/src/plugins/qmldesigner/designercore/model/bindingproperty.cpp b/src/plugins/qmldesigner/designercore/model/bindingproperty.cpp index 30f8d50fd4..558f6849be 100644 --- a/src/plugins/qmldesigner/designercore/model/bindingproperty.cpp +++ b/src/plugins/qmldesigner/designercore/model/bindingproperty.cpp @@ -92,7 +92,7 @@ ModelNode BindingProperty::resolveBinding(const QString &binding, ModelNode curr currentNode = ModelNode(privateModel()->nodeForId(element), model(), view()); } index++; - if (index < binding.split(QLatin1Char('.')).count()) + if (index < binding.split(QLatin1Char('.')).size()) element = binding.split(QLatin1Char('.')).at(index); else element.clear(); @@ -117,7 +117,7 @@ ModelNode BindingProperty::resolveToModelNode() const return resolveBinding(binding, parentModelNode()); } -static inline QStringList commaSeparatedSimplifiedStringList(const QString &string) +inline static QStringList commaSeparatedSimplifiedStringList(const QString &string) { const QStringList stringList = string.split(QStringLiteral(",")); QStringList simpleList; diff --git a/src/plugins/qmldesigner/designercore/model/internalnodelistproperty.cpp b/src/plugins/qmldesigner/designercore/model/internalnodelistproperty.cpp index 8c8b1c73e5..f5c4662785 100644 --- a/src/plugins/qmldesigner/designercore/model/internalnodelistproperty.cpp +++ b/src/plugins/qmldesigner/designercore/model/internalnodelistproperty.cpp @@ -26,7 +26,7 @@ bool InternalNodeListProperty::isEmpty() const int InternalNodeListProperty::count() const { - return m_nodeList.count(); + return m_nodeList.size(); } int InternalNodeListProperty::indexOf(const InternalNode::Pointer &node) const diff --git a/src/plugins/qmldesigner/designercore/model/internalnodelistproperty.h b/src/plugins/qmldesigner/designercore/model/internalnodelistproperty.h index 72ab08ae74..2e15fdf8ae 100644 --- a/src/plugins/qmldesigner/designercore/model/internalnodelistproperty.h +++ b/src/plugins/qmldesigner/designercore/model/internalnodelistproperty.h @@ -27,13 +27,13 @@ public: int indexOf(const InternalNodePointer &node) const override; const InternalNodePointer &at(int index) const { - Q_ASSERT(index >= 0 && index < m_nodeList.count()); + Q_ASSERT(index >= 0 && index < m_nodeList.size()); return m_nodeList[index]; } InternalNodePointer &at(int index) { - Q_ASSERT(index >= 0 && index < m_nodeList.count()); + Q_ASSERT(index >= 0 && index < m_nodeList.size()); return m_nodeList[index]; } diff --git a/src/plugins/qmldesigner/designercore/model/modelmerger.cpp b/src/plugins/qmldesigner/designercore/model/modelmerger.cpp index 30d100f350..a9fa1ebd19 100644 --- a/src/plugins/qmldesigner/designercore/model/modelmerger.cpp +++ b/src/plugins/qmldesigner/designercore/model/modelmerger.cpp @@ -83,7 +83,7 @@ static void splitIdInBaseNameAndNumber(const QString &id, QString *baseId, int * { int counter = 0; - while (counter < id.count()) { + while (counter < id.size()) { bool canConvertToInteger = false; int newNumber = id.right(counter + 1).toInt(&canConvertToInteger); if (canConvertToInteger) @@ -94,7 +94,7 @@ static void splitIdInBaseNameAndNumber(const QString &id, QString *baseId, int * counter++; } - *baseId = id.left(id.count() - counter); + *baseId = id.left(id.size() - counter); } static void setupIdRenamingHash(const ModelNode &modelNode, QHash<QString, QString> &idRenamingHash, AbstractView *view) diff --git a/src/plugins/qmldesigner/designercore/model/modelnode.cpp b/src/plugins/qmldesigner/designercore/model/modelnode.cpp index 8fde4d0620..45c076022d 100644 --- a/src/plugins/qmldesigner/designercore/model/modelnode.cpp +++ b/src/plugins/qmldesigner/designercore/model/modelnode.cpp @@ -3,15 +3,15 @@ #include "modelnode.h" +#include "annotation.h" +#include "bindingproperty.h" #include "internalnode_p.h" #include "model_p.h" -#include "variantproperty.h" -#include "bindingproperty.h" -#include "signalhandlerproperty.h" #include "nodeabstractproperty.h" #include "nodelistproperty.h" #include "nodeproperty.h" -#include "annotation.h" +#include "signalhandlerproperty.h" +#include "variantproperty.h" #include <auxiliarydataproperties.h> #include <model.h> @@ -51,32 +51,20 @@ childNode.addProperty("pos", QPoint(2, 12)); All the manipulation functions are generating undo commands internally. */ - - /*! \brief internal constructor */ -ModelNode::ModelNode(const InternalNodePointer &internalNode, Model *model, const AbstractView *view): - m_internalNode(internalNode), - m_model(model), - m_view(const_cast<AbstractView*>(view)) -{ -} +ModelNode::ModelNode(const InternalNodePointer &internalNode, Model *model, const AbstractView *view) + : m_internalNode(internalNode) + , m_model(model) + , m_view(const_cast<AbstractView *>(view)) +{} ModelNode::ModelNode(const ModelNode &modelNode, AbstractView *view) - : m_internalNode(modelNode.m_internalNode), - m_model(modelNode.model()), - m_view(view) -{ -} - -/*! \brief contructs a invalid model node -\return invalid node -\see invalid -*/ -ModelNode::ModelNode() -{ -} + : m_internalNode(modelNode.m_internalNode) + , m_model(modelNode.model()) + , m_view(view) +{} /*! \brief does nothing */ @@ -101,7 +89,7 @@ QString ModelNode::validId() return id(); } -static bool idIsQmlKeyWord(const QString& id) +static bool idIsQmlKeyWord(const QString &id) { static const QSet<QString> keywords = {"as", "break", "case", "catch", "continue", "debugger", "default", "delete", @@ -115,49 +103,22 @@ static bool idIsQmlKeyWord(const QString& id) return keywords.contains(id); } -static bool isIdToAvoid(const QString& id) -{ - static const QSet<QString> ids = { - "top", - "bottom", - "left", - "right", - "width", - "height", - "x", - "y", - "opacity", - "parent", - "item", - "flow", - "color", - "margin", - "padding", - "border", - "font", - "text", - "source", - "state", - "visible", - "focus", - "data", - "clip", - "layer", - "scale", - "enabled", - "anchors", - "texture", - "shaderInfo", - "sprite", - "spriteSequence", - "baseState", - "rect" - }; +static bool isIdToAvoid(const QString &id) +{ + static const QSet<QString> ids = {"top", "bottom", "left", "right", + "width", "height", "x", "y", + "opacity", "parent", "item", "flow", + "color", "margin", "padding", "border", + "font", "text", "source", "state", + "visible", "focus", "data", "clip", + "layer", "scale", "enabled", "anchors", + "texture", "shaderInfo", "sprite", "spriteSequence", + "baseState", "rect"}; return ids.contains(id); } -static bool idContainsWrongLetter(const QString& id) +static bool idContainsWrongLetter(const QString &id) { static QRegularExpression idExpr(QStringLiteral("^[a-z_][a-zA-Z0-9_]*$")); return !id.contains(idExpr); @@ -199,7 +160,7 @@ bool ModelNode::hasId() const return !m_internalNode->id.isEmpty(); } -void ModelNode::setIdWithRefactoring(const QString& id) +void ModelNode::setIdWithRefactoring(const QString &id) { if (isValid()) { if (model()->rewriterView() && !id.isEmpty() @@ -325,10 +286,12 @@ NodeAbstractProperty ModelNode::parentProperty() const if (!m_internalNode->parentProperty()) return {}; - return NodeAbstractProperty(m_internalNode->parentProperty()->name(), m_internalNode->parentProperty()->propertyOwner(), m_model.data(), view()); + return NodeAbstractProperty(m_internalNode->parentProperty()->name(), + m_internalNode->parentProperty()->propertyOwner(), + m_model.data(), + view()); } - /*! \brief the command id is used to compress the some commands together. \param newParentNode parent of this node will be set to this node \param commandId integer which is used to descripe commands which should compressed together to one command @@ -542,7 +505,6 @@ QList<AbstractProperty> ModelNode::properties() const return propertyList; } - /*! \brief returns a list of all VariantProperties \return list of all VariantProperties @@ -593,7 +555,6 @@ QList<NodeListProperty> ModelNode::nodeListProperties() const return propertyList; } - /*! \brief returns a list of all BindingProperties \return list of all BindingProperties @@ -693,6 +654,7 @@ void ModelNode::destroy() removeModelNodeFromSelection(*this); model()->d->removeNodeAndRelatedResources(m_internalNode); } + //\} /*! \name Property Manipulation @@ -723,7 +685,6 @@ AbstractView *ModelNode::view() const return m_view.data(); } - /*! \brief returns all ModelNodes that are direct children of this ModelNode The list contains every ModelNode that belongs to one of this ModelNodes @@ -913,7 +874,7 @@ static bool recursiveAncestor(const ModelNode &possibleAncestor, const ModelNode if (node.hasParentProperty()) { if (node.parentProperty().parentModelNode() == possibleAncestor) - return true; + return true; return recursiveAncestor(possibleAncestor, node.parentProperty().parentModelNode()); } @@ -928,10 +889,8 @@ bool ModelNode::isAncestorOf(const ModelNode &node) const QDebug operator<<(QDebug debug, const ModelNode &modelNode) { if (modelNode.isValid()) { - debug.nospace() << "ModelNode(" - << modelNode.internalId() << ", " - << modelNode.type() << ", " - << modelNode.id() << ')'; + debug.nospace() << "ModelNode(" << modelNode.internalId() << ", " << modelNode.type() + << ", " << modelNode.id() << ')'; } else { debug.nospace() << "ModelNode(invalid)"; } @@ -939,12 +898,12 @@ QDebug operator<<(QDebug debug, const ModelNode &modelNode) return debug.space(); } -QTextStream& operator<<(QTextStream &stream, const ModelNode &modelNode) +QTextStream &operator<<(QTextStream &stream, const ModelNode &modelNode) { if (modelNode.isValid()) { stream << "ModelNode(" - << "type: " << modelNode.type() << ", " - << "id: " << modelNode.id() << ')'; + << "type: " << modelNode.type() << ", " + << "id: " << modelNode.id() << ')'; } else { stream << "ModelNode(invalid)"; } @@ -974,7 +933,7 @@ void ModelNode::deselectNode() view()->setSelectedModelNodes(selectedNodeList); } -int ModelNode::variantUserType() +int ModelNode::variantTypeId() { return qMetaTypeId<ModelNode>(); } @@ -992,8 +951,7 @@ std::optional<QVariant> ModelNode::auxiliaryData(AuxiliaryDataKeyView key) const return m_internalNode->auxiliaryData(key); } -std::optional<QVariant> ModelNode::auxiliaryData(AuxiliaryDataType type, - Utils::SmallStringView name) const +std::optional<QVariant> ModelNode::auxiliaryData(AuxiliaryDataType type, Utils::SmallStringView name) const { return auxiliaryData({type, name}); } @@ -1306,7 +1264,7 @@ static ModelNode lowestCommonAncestor(const ModelNode &node1, { Q_ASSERT(node1.isValid() && node2.isValid()); - auto depthOfNode = [] (const ModelNode &node) -> int { + auto depthOfNode = [](const ModelNode &node) -> int { int depth = 0; ModelNode parentNode = node; while (!parentNode.isRootNode()) { @@ -1317,9 +1275,8 @@ static ModelNode lowestCommonAncestor(const ModelNode &node1, }; if (node1 == node2) { - depthOfLCA = (depthOfNode1 < 0) - ? ((depthOfNode2 < 0) ? depthOfNode(node1) : depthOfNode2) - : depthOfNode1; + depthOfLCA = (depthOfNode1 < 0) ? ((depthOfNode2 < 0) ? depthOfNode(node1) : depthOfNode2) + : depthOfNode1; return node1; } @@ -1336,7 +1293,7 @@ static ModelNode lowestCommonAncestor(const ModelNode &node1, ModelNode nodeLower = node1; ModelNode nodeHigher = node2; int depthLower = (depthOfNode1 < 0) ? depthOfNode(nodeLower) : depthOfNode1; - int depthHigher = (depthOfNode2 < 0) ? depthOfNode(nodeHigher) :depthOfNode2; + int depthHigher = (depthOfNode2 < 0) ? depthOfNode(nodeHigher) : depthOfNode2; if (depthLower > depthHigher) { std::swap(depthLower, depthHigher); @@ -1383,9 +1340,8 @@ QList<ModelNode> ModelNode::pruneChildren(const QList<ModelNode> &nodes) QList<ModelNode> forwardNodes; QList<ModelNode> backNodes; - auto pushIfIsNotChild = [] (QList<ModelNode> &container, const ModelNode &node) { - bool hasAncestor = Utils::anyOf(container, - [node] (const ModelNode &testNode) -> bool { + auto pushIfIsNotChild = [](QList<ModelNode> &container, const ModelNode &node) { + bool hasAncestor = Utils::anyOf(container, [node](const ModelNode &testNode) -> bool { return testNode.isAncestorOf(node); }); if (!hasAncestor) @@ -1403,7 +1359,7 @@ QList<ModelNode> ModelNode::pruneChildren(const QList<ModelNode> &nodes) return backNodes; } -void ModelNode::setScriptFunctions(const QStringList &scriptFunctionList) +void ModelNode::setScriptFunctions(const QStringList &scriptFunctionList) { if (!isValid()) return; @@ -1411,7 +1367,7 @@ void ModelNode::setScriptFunctions(const QStringList &scriptFunctionList) model()->d->setScriptFunctions(m_internalNode, scriptFunctionList); } -QStringList ModelNode::scriptFunctions() const +QStringList ModelNode::scriptFunctions() const { if (!isValid()) return {}; @@ -1510,8 +1466,7 @@ bool ModelNode::isComponent() const if (metaInfo().isQtQuickLoader()) { if (hasNodeListProperty("component")) { - - /* + /* * The component property should be a NodeProperty, but currently is a NodeListProperty, because * the default property is always implcitly a NodeListProperty. This is something that has to be fixed. */ @@ -1524,7 +1479,8 @@ bool ModelNode::isComponent() const } if (hasNodeProperty("sourceComponent")) { - if (nodeProperty("sourceComponent").modelNode().nodeSourceType() == ModelNode::NodeWithComponentSource) + if (nodeProperty("sourceComponent").modelNode().nodeSourceType() + == ModelNode::NodeWithComponentSource) return true; if (nodeProperty("sourceComponent").modelNode().metaInfo().isFileComponent()) return true; @@ -1542,8 +1498,9 @@ QIcon ModelNode::typeIcon() const if (isValid()) { // if node has no own icon, search for it in the itemlibrary const ItemLibraryInfo *libraryInfo = model()->metaInfo().itemLibraryInfo(); - QList <ItemLibraryEntry> itemLibraryEntryList = libraryInfo->entriesForType( - type(), majorVersion(), minorVersion()); + QList<ItemLibraryEntry> itemLibraryEntryList = libraryInfo->entriesForType(type(), + majorVersion(), + minorVersion()); if (!itemLibraryEntryList.isEmpty()) return itemLibraryEntryList.constFirst().typeIcon(); else if (metaInfo().isValid()) @@ -1561,4 +1518,4 @@ QString ModelNode::behaviorPropertyName() const return m_internalNode->behaviorPropertyName; } -} +} // namespace QmlDesigner diff --git a/src/plugins/qmldesigner/designercore/model/propertycontainer.cpp b/src/plugins/qmldesigner/designercore/model/propertycontainer.cpp index 8cd55cac4b..cd7cebbb73 100644 --- a/src/plugins/qmldesigner/designercore/model/propertycontainer.cpp +++ b/src/plugins/qmldesigner/designercore/model/propertycontainer.cpp @@ -41,7 +41,7 @@ PropertyName PropertyContainer::name() const QVariant PropertyContainer::value() const { - if (m_value.type() == QVariant::String) + if (m_value.typeId() == QVariant::String) m_value = PropertyParser::read(m_type, m_value.toString()); return m_value; } diff --git a/src/plugins/qmldesigner/designercore/model/qmlchangeset.cpp b/src/plugins/qmldesigner/designercore/model/qmlchangeset.cpp index 134c4bf1c2..889a5a3865 100644 --- a/src/plugins/qmldesigner/designercore/model/qmlchangeset.cpp +++ b/src/plugins/qmldesigner/designercore/model/qmlchangeset.cpp @@ -85,7 +85,7 @@ void QmlPropertyChanges::removeProperty(const PropertyName &name) if (name == "name") return; modelNode().removeProperty(name); - if (modelNode().variantProperties().isEmpty() && modelNode().bindingProperties().count() < 2) + if (modelNode().variantProperties().isEmpty() && modelNode().bindingProperties().size() < 2) modelNode().destroy(); } diff --git a/src/plugins/qmldesigner/designercore/model/qmltextgenerator.cpp b/src/plugins/qmldesigner/designercore/model/qmltextgenerator.cpp index bcf22aa3f0..e5721d21c3 100644 --- a/src/plugins/qmldesigner/designercore/model/qmltextgenerator.cpp +++ b/src/plugins/qmldesigner/designercore/model/qmltextgenerator.cpp @@ -50,7 +50,7 @@ inline static QString doubleToString(const PropertyName &propertyName, double d) static QString unicodeEscape(const QString &stringValue) { - if (stringValue.count() == 1) { + if (stringValue.size() == 1) { ushort code = stringValue.at(0).unicode(); bool isUnicode = code <= 127; if (isUnicode) { @@ -118,7 +118,7 @@ QString QmlTextGenerator::toQml(const AbstractProperty &property, int indentDept if (variantProperty.holdsEnumeration()) { return variantProperty.enumeration().toString(); } else { - switch (value.userType()) { + switch (value.typeId()) { case QMetaType::Bool: if (value.toBool()) return QStringLiteral("true"); diff --git a/src/plugins/qmldesigner/designercore/model/rewriterview.cpp b/src/plugins/qmldesigner/designercore/model/rewriterview.cpp index 53a0f4de59..60156ff18e 100644 --- a/src/plugins/qmldesigner/designercore/model/rewriterview.cpp +++ b/src/plugins/qmldesigner/designercore/model/rewriterview.cpp @@ -954,12 +954,12 @@ const QmlJS::Document *RewriterView::document() const return textToModelMerger()->document(); } -static inline QString getUrlFromType(const QString& typeName) +inline static QString getUrlFromType(const QString &typeName) { QStringList nameComponents = typeName.split('.'); QString result; - for (int i = 0; i < (nameComponents.count() - 1); i++) { + for (int i = 0; i < (nameComponents.size() - 1); i++) { result += nameComponents.at(i); } diff --git a/src/plugins/qmldesigner/designercore/model/stylesheetmerger.cpp b/src/plugins/qmldesigner/designercore/model/stylesheetmerger.cpp index 2a6b9f0fbf..90891cbc8c 100644 --- a/src/plugins/qmldesigner/designercore/model/stylesheetmerger.cpp +++ b/src/plugins/qmldesigner/designercore/model/stylesheetmerger.cpp @@ -65,7 +65,7 @@ static void splitIdInBaseNameAndNumber(const QString &id, QString *baseId, int * { int counter = 0; - while (counter < id.count()) { + while (counter < id.size()) { bool canConvertToInteger = false; int newNumber = id.right(counter + 1).toInt(&canConvertToInteger); if (canConvertToInteger) @@ -76,7 +76,7 @@ static void splitIdInBaseNameAndNumber(const QString &id, QString *baseId, int * counter++; } - *baseId = id.left(id.count() - counter); + *baseId = id.left(id.size() - counter); } void StylesheetMerger::syncNodeProperties(ModelNode &outputNode, const ModelNode &inputNode, bool skipDuplicates) diff --git a/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp b/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp index 7328ae01aa..29088dac40 100644 --- a/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp +++ b/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp @@ -165,10 +165,13 @@ bool isHexDigit(ushort c) QString fixEscapedUnicodeChar(const QString &value) //convert "\u2939" { - if (value.count() == 6 && value.at(0) == QLatin1Char('\\') && value.at(1) == QLatin1Char('u') && - isHexDigit(value.at(2).unicode()) && isHexDigit(value.at(3).unicode()) && - isHexDigit(value.at(4).unicode()) && isHexDigit(value.at(5).unicode())) { - return convertUnicode(value.at(2).unicode(), value.at(3).unicode(), value.at(4).unicode(), value.at(5).unicode()); + if (value.size() == 6 && value.at(0) == QLatin1Char('\\') && value.at(1) == QLatin1Char('u') + && isHexDigit(value.at(2).unicode()) && isHexDigit(value.at(3).unicode()) + && isHexDigit(value.at(4).unicode()) && isHexDigit(value.at(5).unicode())) { + return convertUnicode(value.at(2).unicode(), + value.at(3).unicode(), + value.at(4).unicode(), + value.at(5).unicode()); } return value; } @@ -362,8 +365,8 @@ bool compareJavaScriptExpression(const QString &expression1, const QString &expr bool smartVeryFuzzyCompare(const QVariant &value1, const QVariant &value2) { //we ignore slight changes on doubles and only check three digits - const auto type1 = static_cast<QMetaType::Type>(value1.type()); - const auto type2 = static_cast<QMetaType::Type>(value2.type()); + const auto type1 = static_cast<QMetaType::Type>(value1.typeId()); + const auto type2 = static_cast<QMetaType::Type>(value2.typeId()); if (type1 == QMetaType::Double || type2 == QMetaType::Double || type1 == QMetaType::Float @@ -394,7 +397,7 @@ bool smartVeryFuzzyCompare(const QVariant &value1, const QVariant &value2) } bool smartColorCompare(const QVariant &value1, const QVariant &value2) { - if ((value1.type() == QVariant::Color) || (value2.type() == QVariant::Color)) + if ((value1.typeId() == QVariant::Color) || (value2.typeId() == QVariant::Color)) return value1.value<QColor>().rgba() == value2.value<QColor>().rgba(); return false; } @@ -720,7 +723,7 @@ public: { QStringList astValueList = astValue.split(QStringLiteral(".")); - if (astValueList.count() == 2) { + if (astValueList.size() == 2) { //Check for global Qt enums if (astValueList.constFirst() == QStringLiteral("Qt") && globalQtEnums().contains(astValueList.constLast())) diff --git a/src/plugins/qmldesigner/designercore/projectstorage/projectstorage.h b/src/plugins/qmldesigner/designercore/projectstorage/projectstorage.h index 4288cd5cbb..a668f80ee2 100644 --- a/src/plugins/qmldesigner/designercore/projectstorage/projectstorage.h +++ b/src/plugins/qmldesigner/designercore/projectstorage/projectstorage.h @@ -518,9 +518,7 @@ private: auto fetchModuleName(ModuleId id) { - return Sqlite::withDeferredTransaction(database, [&] { - return fetchModuleNameUnguarded(id); - }); + return Sqlite::withDeferredTransaction(database, [&] { return fetchModuleNameUnguarded(id); }); } auto fetchAllModules() const @@ -1039,6 +1037,7 @@ private: }, TypeCompare<PropertyDeclaration>{}); } + template<typename Callable> void relinkPrototypes(Prototypes &relinkablePrototypes, const TypeIds &deletedTypeIds, @@ -1551,10 +1550,10 @@ private: int majorVersion, int minorVersion, ModuleExportedImportId moduleExportedImportId) { - Storage::Synchronization::Import additionImport{ - exportedModuleId, - Storage::Version{majorVersion, minorVersion}, - import.sourceId}; + Storage::Synchronization::Import additionImport{exportedModuleId, + Storage::Version{majorVersion, + minorVersion}, + import.sourceId}; auto exportedImportKind = importKind == Storage::Synchronization::ImportKind::Import ? Storage::Synchronization::ImportKind::ModuleExportedImport diff --git a/src/plugins/qmldesigner/documentwarningwidget.cpp b/src/plugins/qmldesigner/documentwarningwidget.cpp index d7bd70d5e3..49eb5acd46 100644 --- a/src/plugins/qmldesigner/documentwarningwidget.cpp +++ b/src/plugins/qmldesigner/documentwarningwidget.cpp @@ -121,13 +121,13 @@ QString DocumentWarningWidget::generateNavigateLinks() { static const QString link("<a href=\"%1\">%2</a>"); QStringList links; - if (m_messages.count() > 1) { + if (m_messages.size() > 1) { if (m_currentMessage != 0) links << link.arg(QLatin1String("previous"), tr("Previous")); else links << tr("Previous"); - if (m_messages.count() - 1 > m_currentMessage) + if (m_messages.size() - 1 > m_currentMessage) links << link.arg(QLatin1String("next"), tr("Next")); else links << tr("Next"); diff --git a/src/plugins/qmldesigner/generateresource.cpp b/src/plugins/qmldesigner/generateresource.cpp index 439e124b70..be7f536662 100644 --- a/src/plugins/qmldesigner/generateresource.cpp +++ b/src/plugins/qmldesigner/generateresource.cpp @@ -288,7 +288,7 @@ void GenerateResource::generateMenuEntry(QObject *parent) bool found = false; QString compareString = "./" + relativepath.trimmed(); - for (int i = 0; i < fileList.count(); ++i) + for (int i = 0; i < fileList.size(); ++i) if (fileList.at(i).fileName == compareString) { fileList[i].inProject = true; found = true; @@ -424,7 +424,7 @@ void GenerateResource::generateMenuEntry(QObject *parent) bool found = false; QString compareString = "./" + relativepath.trimmed(); - for (int i = 0; i < fileList.count(); ++i) + for (int i = 0; i < fileList.size(); ++i) if (fileList.at(i).fileName == compareString) { fileList[i].inProject = true; found = true; diff --git a/src/plugins/qmldesigner/utils/multifiledownloader.cpp b/src/plugins/qmldesigner/utils/multifiledownloader.cpp index 6a8ac9761e..6a452d6b09 100644 --- a/src/plugins/qmldesigner/utils/multifiledownloader.cpp +++ b/src/plugins/qmldesigner/utils/multifiledownloader.cpp @@ -24,7 +24,7 @@ void MultiFileDownloader::setDownloader(FileDownloader *downloader) QObject::connect(m_downloader, &FileDownloader::progressChanged, this, [this]() { double curProgress = m_downloader->progress() / 100.0; - double totalProgress = (m_nextFile + curProgress) / m_files.count(); + double totalProgress = (m_nextFile + curProgress) / m_files.size(); m_progress = totalProgress * 100; emit progressChanged(); }); diff --git a/src/tools/qml2puppet/instances/nodeinstanceclientproxy.cpp b/src/tools/qml2puppet/instances/nodeinstanceclientproxy.cpp index 7b7628e319..489c8c840b 100644 --- a/src/tools/qml2puppet/instances/nodeinstanceclientproxy.cpp +++ b/src/tools/qml2puppet/instances/nodeinstanceclientproxy.cpp @@ -147,28 +147,28 @@ bool compareCommands(const QVariant &command, const QVariant &controlCommand) static const int debugOutputCommandType = QMetaType::type("DebugOutputCommand"); static const int changeSelectionCommandType = QMetaType::type("ChangeSelectionCommand"); - if (command.userType() == controlCommand.userType()) { - if (command.userType() == informationChangedCommandType) + if (command.typeId() == controlCommand.typeId()) { + if (command.typeId() == informationChangedCommandType) return command.value<InformationChangedCommand>() == controlCommand.value<InformationChangedCommand>(); - else if (command.userType() == valuesChangedCommandType) + else if (command.typeId() == valuesChangedCommandType) return command.value<ValuesChangedCommand>() == controlCommand.value<ValuesChangedCommand>(); - else if (command.userType() == valuesModifiedCommandType) + else if (command.typeId() == valuesModifiedCommandType) return command.value<ValuesModifiedCommand>() == controlCommand.value<ValuesModifiedCommand>(); - else if (command.userType() == pixmapChangedCommandType) + else if (command.typeId() == pixmapChangedCommandType) return command.value<PixmapChangedCommand>() == controlCommand.value<PixmapChangedCommand>(); - else if (command.userType() == childrenChangedCommandType) + else if (command.typeId() == childrenChangedCommandType) return command.value<ChildrenChangedCommand>() == controlCommand.value<ChildrenChangedCommand>(); - else if (command.userType() == statePreviewImageChangedCommandType) + else if (command.typeId() == statePreviewImageChangedCommandType) return command.value<StatePreviewImageChangedCommand>() == controlCommand.value<StatePreviewImageChangedCommand>(); - else if (command.userType() == componentCompletedCommandType) + else if (command.typeId() == componentCompletedCommandType) return command.value<ComponentCompletedCommand>() == controlCommand.value<ComponentCompletedCommand>(); - else if (command.userType() == synchronizeCommandType) + else if (command.typeId() == synchronizeCommandType) return command.value<SynchronizeCommand>() == controlCommand.value<SynchronizeCommand>(); - else if (command.userType() == tokenCommandType) + else if (command.typeId() == tokenCommandType) return command.value<TokenCommand>() == controlCommand.value<TokenCommand>(); - else if (command.userType() == debugOutputCommandType) + else if (command.typeId() == debugOutputCommandType) return command.value<DebugOutputCommand>() == controlCommand.value<DebugOutputCommand>(); - else if (command.userType() == changeSelectionCommandType) + else if (command.typeId() == changeSelectionCommandType) return command.value<ChangeSelectionCommand>() == controlCommand.value<ChangeSelectionCommand>(); } @@ -190,8 +190,8 @@ void NodeInstanceClientProxy::writeCommand(const QVariant &command) } } else if (m_outputIoDevice) { #ifdef NANOTRACE_ENABLED - if (command.userType() != QMetaType::type("PuppetAliveCommand")) { - if (command.userType() == QMetaType::type("SyncNanotraceCommand")) { + if (command.typeId() != QMetaType::type("PuppetAliveCommand")) { + if (command.typeId() == QMetaType::type("SyncNanotraceCommand")) { SyncNanotraceCommand cmd = command.value<SyncNanotraceCommand>(); NANOTRACE_INSTANT_ARGS("Sync", "writeCommand", {"name", cmd.name().toStdString()}, @@ -395,8 +395,8 @@ void NodeInstanceClientProxy::readDataStream() QVariant command = readCommandFromIOStream(m_inputIoDevice, &readCommandCounter, &blockSize); #ifdef NANOTRACE_ENABLED - if (command.userType() != QMetaType::type("EndNanotraceCommand")) { - if (command.userType() == QMetaType::type("SyncNanotraceCommand")) { + if (command.typeId() != QMetaType::type("EndNanotraceCommand")) { + if (command.typeId() == QMetaType::type("SyncNanotraceCommand")) { SyncNanotraceCommand cmd = command.value<SyncNanotraceCommand>(); NANOTRACE_INSTANT_ARGS("Sync", "readCommand", {"name", cmd.name().toStdString()}, @@ -574,7 +574,7 @@ void NodeInstanceClientProxy::dispatchCommand(const QVariant &command) static const int startNanotraceCommandType = QMetaType::type("StartNanotraceCommand"); static const int endNanotraceCommandType = QMetaType::type("EndNanotraceCommand"); - const int commandType = command.userType(); + const int commandType = command.typeId(); if (commandType == inputEventCommandType) inputEvent(command.value<InputEventCommand>()); @@ -624,13 +624,13 @@ void NodeInstanceClientProxy::dispatchCommand(const QVariant &command) } else if (commandType == changeSelectionCommandType) { ChangeSelectionCommand changeSelectionCommand = command.value<ChangeSelectionCommand>(); changeSelection(changeSelectionCommand); - } else if (command.userType() == changeLanguageCommand) { + } else if (command.typeId() == changeLanguageCommand) { changeLanguage(command.value<ChangeLanguageCommand>()); - } else if (command.userType() == changePreviewImageSizeCommand) { + } else if (command.typeId() == changePreviewImageSizeCommand) { changePreviewImageSize(command.value<ChangePreviewImageSizeCommand>()); - } else if (command.userType() == startNanotraceCommandType) { + } else if (command.typeId() == startNanotraceCommandType) { startNanotrace(command.value<StartNanotraceCommand>()); - } else if (command.userType() == endNanotraceCommandType) { + } else if (command.typeId() == endNanotraceCommandType) { NANOTRACE_SHUTDOWN(); } else { Q_ASSERT(false); diff --git a/src/tools/qml2puppet/qml2puppet/editor3d/generalhelper.cpp b/src/tools/qml2puppet/qml2puppet/editor3d/generalhelper.cpp index 52a3f6d74a..bfa2fcb1ae 100644 --- a/src/tools/qml2puppet/qml2puppet/editor3d/generalhelper.cpp +++ b/src/tools/qml2puppet/qml2puppet/editor3d/generalhelper.cpp @@ -520,8 +520,8 @@ void GeneralHelper::storeToolState(const QString &sceneId, const QString &tool, handlePendingToolStateUpdate(); QVariant theState; // Convert JS arrays to QVariantLists for easier handling down the line - // metaType().id() which only exist in Qt6 is the same as userType() - if (state.userType() != QMetaType::QString && state.canConvert(QMetaType::QVariantList)) + // metaType().id() which only exist in Qt6 is the same as typeId() + if (state.typeId() != QMetaType::QString && state.canConvert(QMetaType::QVariantList)) theState = state.value<QVariantList>(); else theState = state; diff --git a/src/tools/qml2puppet/qml2puppet/instances/nodeinstanceserver.cpp b/src/tools/qml2puppet/qml2puppet/instances/nodeinstanceserver.cpp index aff80c62af..3007db7af4 100644 --- a/src/tools/qml2puppet/qml2puppet/instances/nodeinstanceserver.cpp +++ b/src/tools/qml2puppet/qml2puppet/instances/nodeinstanceserver.cpp @@ -1194,7 +1194,7 @@ ValuesChangedCommand NodeInstanceServer::createValuesChangedCommand(const QList< const QList<PropertyName> propertyNames = instance.propertyNames(); for (const PropertyName &propertyName : propertyNames) { QVariant propertyValue = instance.property(propertyName); - if (supportedVariantType(propertyValue.userType())) { + if (supportedVariantType(propertyValue.typeId())) { valueVector.append(PropertyValueContainer(instance.instanceId(), propertyName, propertyValue, PropertyName())); } @@ -1236,13 +1236,13 @@ ValuesChangedCommand NodeInstanceServer::createValuesChangedCommand(const QVecto if (instance.isValid()) { QVariant propertyValue = instance.property(propertyName); - bool isValid = QMetaType::isRegistered(propertyValue.userType()) - && supportedVariantType(propertyValue.type()); - if (!isValid && propertyValue.userType() == 0) { + bool isValid = QMetaType::isRegistered(propertyValue.typeId()) + && supportedVariantType(propertyValue.typeId()); + if (!isValid && propertyValue.typeId() == 0) { // If the property is QVariant type, invalid variant can be a valid value const QMetaObject *mo = instance.internalObject()->metaObject(); const int idx = mo->indexOfProperty(propertyName); - isValid = idx >= 0 && mo->property(idx).userType() == QMetaType::QVariant; + isValid = idx >= 0 && mo->property(idx).typeId() == QMetaType::QVariant; } if (isValid) { valueVector.append(PropertyValueContainer(instance.instanceId(), propertyName, @@ -1265,8 +1265,8 @@ ValuesModifiedCommand NodeInstanceServer::createValuesModifiedCommand( const QVariant propertyValue = property.propertyValue; if (instance.isValid()) { - if (QMetaType::isRegistered(propertyValue.userType()) - && supportedVariantType(propertyValue.type())) { + if (QMetaType::isRegistered(propertyValue.typeId()) + && supportedVariantType(propertyValue.typeId())) { valueVector.append(PropertyValueContainer(instance.instanceId(), propertyName, propertyValue, diff --git a/src/tools/qml2puppet/qml2puppet/instances/objectnodeinstance.cpp b/src/tools/qml2puppet/qml2puppet/instances/objectnodeinstance.cpp index 26999ef2a2..24ac400411 100644 --- a/src/tools/qml2puppet/qml2puppet/instances/objectnodeinstance.cpp +++ b/src/tools/qml2puppet/qml2puppet/instances/objectnodeinstance.cpp @@ -374,7 +374,7 @@ void ObjectNodeInstance::reparent(const ObjectNodeInstance::Pointer &oldParentIn QVariant ObjectNodeInstance::convertSpecialCharacter(const QVariant& value) const { QVariant specialCharacterConvertedValue = value; - if (value.type() == QVariant::String) { + if (value.typeId() == QVariant::String) { QString string = value.toString(); string.replace(QLatin1String("\\n"), QLatin1String("\n")); string.replace(QLatin1String("\\t"), QLatin1String("\t")); @@ -472,7 +472,7 @@ void ObjectNodeInstance::setPropertyVariant(const PropertyName &name, const QVar QVariant oldValue = property.read(); - if (oldValue.type() == QVariant::Url) { + if (oldValue.typeId() == QVariant::Url) { QUrl url = oldValue.toUrl(); QString path = url.toLocalFile(); if (QFileInfo::exists(path) && nodeInstanceServer() && !path.isEmpty()) @@ -489,7 +489,7 @@ void ObjectNodeInstance::setPropertyVariant(const PropertyName &name, const QVar qDebug() << "ObjectNodeInstance.setPropertyVariant: Cannot be written: " << object() << name << adjustedValue; QVariant newValue = property.read(); - if (newValue.type() == QVariant::Url) { + if (newValue.typeId() == QVariant::Url) { QUrl url = newValue.toUrl(); QString path = url.toLocalFile(); if (QFileInfo::exists(path) && nodeInstanceServer() && !path.isEmpty()) @@ -579,7 +579,7 @@ void ObjectNodeInstance::refreshProperty(const PropertyName &name) else property.write(resetValue(name)); - if (oldValue.type() == QVariant::Url) { + if (oldValue.typeId() == QVariant::Url) { QByteArray key = oldValue.toUrl().toEncoded(QUrl::UrlFormattingOption(0x100)); QString pixmapKey = QString::fromUtf8(key.constData(), key.size()); QPixmapCache::remove(pixmapKey); @@ -843,7 +843,7 @@ QObject *ObjectNodeInstance::createComponentWrap(const QString &nodeSource, cons //The component might also be shipped with Creator. //To avoid trouble with import "." we use the component shipped with Creator. -static inline QString fixComponentPathForIncompatibleQt(const QString &componentPath) +inline static QString fixComponentPathForIncompatibleQt(const QString &componentPath) { QString result = componentPath; const QLatin1String importString("/imports/"); diff --git a/src/tools/qml2puppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp b/src/tools/qml2puppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp index 01d5fcd4f6..2f3747ef21 100644 --- a/src/tools/qml2puppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp +++ b/src/tools/qml2puppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp @@ -655,7 +655,7 @@ Qt5InformationNodeInstanceServer::propertyToPropertyValueTriples( QVector<InstancePropertyValueTriple> result; InstancePropertyValueTriple propTriple; - if (variant.type() == QVariant::Vector3D) { + if (variant.typeId() == QVariant::Vector3D) { auto vector3d = variant.value<QVector3D>(); if (vector3d.isNull()) diff --git a/src/tools/qml2puppet/qmlprivategate/qmlprivategate.cpp b/src/tools/qml2puppet/qmlprivategate/qmlprivategate.cpp index 7fd4e75dc2..a8c715c995 100644 --- a/src/tools/qml2puppet/qmlprivategate/qmlprivategate.cpp +++ b/src/tools/qml2puppet/qmlprivategate/qmlprivategate.cpp @@ -110,8 +110,8 @@ PropertyNameList allPropertyNamesInline(QObject *object, inspectedObjects, depth + 1)); } - } else if (QQmlGadgetPtrWrapper *valueType - = QQmlGadgetPtrWrapper::instance(qmlEngine(object), metaProperty.userType())) { + } else if (QQmlGadgetPtrWrapper *valueType = QQmlGadgetPtrWrapper::instance( + qmlEngine(object), metaProperty.typeId())) { valueType->setValue(metaProperty.read(object)); propertyNameList.append(baseName + QQuickDesignerSupport::PropertyName(metaProperty.name())); @@ -224,8 +224,7 @@ static QString qmlDesignerRCPath() QVariant fixResourcePaths(const QVariant &value) { - if (value.type() == QVariant::Url) - { + if (value.typeId() == QVariant::Url) { const QUrl url = value.toUrl(); if (url.scheme() == QLatin1String("qrc")) { const QString path = QLatin1String("qrc:") + url.path(); @@ -246,7 +245,7 @@ QVariant fixResourcePaths(const QVariant &value) } } } - if (value.type() == QVariant::String) { + if (value.typeId() == QVariant::String) { const QString str = value.toString(); if (str.contains(QLatin1String("qrc:"))) { if (!qmlDesignerRCPath().isEmpty()) { diff --git a/tests/auto/qml/qmldesigner/testconnectionmanager.cpp b/tests/auto/qml/qmldesigner/testconnectionmanager.cpp index 0db53e538e..9341d39a45 100644 --- a/tests/auto/qml/qmldesigner/testconnectionmanager.cpp +++ b/tests/auto/qml/qmldesigner/testconnectionmanager.cpp @@ -40,7 +40,7 @@ void TestConnectionManager::dispatchCommand(const QVariant &command, Connection { static const int synchronizeCommandType = QMetaType::type("SynchronizeCommand"); - if (command.userType() == synchronizeCommandType) { + if (command.typeId() == synchronizeCommandType) { SynchronizeCommand synchronizeCommand = command.value<SynchronizeCommand>(); m_synchronizeId = synchronizeCommand.synchronizeId(); } else { |