ScxmlEditor: Code cosmetics

QVector->QList, some namespaces, ...

Change-Id: Ibcc577193249c8410e68981a7f31b1792dc936ae
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
hjk
2025-04-09 15:27:48 +02:00
parent 2f41910f17
commit 6e6a8448c1
39 changed files with 111 additions and 124 deletions

View File

@@ -23,7 +23,7 @@ ColorPicker::ColorPicker(const QString &key, QWidget *parent)
: QFrame(parent)
, m_key(key)
{
const QVector<QRgb> colors = {
const QList<QRgb> colors = {
qRgb(0xed, 0xf7, 0xf2), qRgb(0xdf, 0xd3, 0xb6), qRgb(0x89, 0x72, 0x5b), qRgb(0xff, 0xd3, 0x93), qRgb(0xff, 0x97, 0x4f),
qRgb(0xff, 0x85, 0x0d), qRgb(0xf7, 0xe9, 0x67), qRgb(0xef, 0xc9, 0x4c), qRgb(0xff, 0xe1, 0x1a), qRgb(0xc2, 0xe0, 0x78),
qRgb(0xa2, 0xd7, 0x00), qRgb(0x45, 0xbf, 0x08), qRgb(0x91, 0xe3, 0xd8), qRgb(0x3c, 0xb3, 0xfd), qRgb(0x34, 0x67, 0xba),

View File

@@ -29,7 +29,7 @@ private:
QToolButton *createButton(const QColor &color);
QStringList m_lastUsedColorNames;
QVector<QToolButton*> m_lastUsedColorButtons;
QList<QToolButton*> m_lastUsedColorButtons;
QString m_key;
QHBoxLayout *m_lastUsedColorContainer;

View File

@@ -170,7 +170,7 @@ void ColorThemes::setCurrentColors(const QVariantMap &colorData)
QStringList serializedColors;
QVector<QColor> colors = ColorThemeView::defaultColors();
QList<QColor> colors = ColorThemeView::defaultColors();
for (QVariantMap::const_iterator i = colorData.begin(); i != colorData.end(); ++i) {
const int k = i.key().toInt();
if (k >= 0 && k < colors.count()) {

View File

@@ -7,7 +7,6 @@
#include <QObject>
#include <QPointer>
#include <QVariantMap>
#include <QVector>
QT_FORWARD_DECLARE_CLASS(QAction)
QT_FORWARD_DECLARE_CLASS(QMenu)

View File

@@ -138,11 +138,11 @@ ColorThemeItem *ColorThemeView::createItem(int index, const QColor &color)
return new ColorThemeItem(index, color, this);
}
const QVector<QColor> &ColorThemeView::defaultColors()
const QList<QColor> &ColorThemeView::defaultColors()
{
// Left with hardcoded values for now
if (Utils::creatorTheme()->colorScheme() == Qt::ColorScheme::Dark) {
static const QVector<QColor> colors = {
static const QList<QColor> colors = {
QColor(0x64, 0x64, 0x64),
QColor(0x60, 0x68, 0x59),
QColor(0x6f, 0x6c, 0x58),
@@ -153,7 +153,7 @@ const QVector<QColor> &ColorThemeView::defaultColors()
};
return colors;
}
static const QVector<QColor> colors = {
static const QList<QColor> colors = {
QColor(0xe0, 0xe0, 0xe0),
QColor(0xd3, 0xe4, 0xc3),
QColor(0xeb, 0xe4, 0xba),

View File

@@ -54,7 +54,7 @@ public:
void setColor(int index, const QColor &color);
QColor color(int index) const;
QVariantMap colorData() const;
static const QVector<QColor> &defaultColors();
static const QList<QColor> &defaultColors();
signals:
void colorChanged();
@@ -66,7 +66,7 @@ private:
void updateItemRects();
ColorThemeItem *createItem(int index, const QColor &color);
QVector<ColorThemeItem*> m_themeItems;
QList<ColorThemeItem*> m_themeItems;
};
} // namespace Common

View File

@@ -497,7 +497,7 @@ void MainWidget::addStateView(BaseItem *item)
// Update transitions
auto scene = static_cast<GraphicsScene*>(it->scene());
if (scene) {
QVector<ScxmlTag*> childTransitionTags;
QList<ScxmlTag*> childTransitionTags;
TagUtils::findAllTransitionChildren(it->tag(), childTransitionTags);
for (int i = 0; i < childTransitionTags.count(); ++i) {
BaseItem *item = scene->findItem(childTransitionTags[i]);

View File

@@ -108,8 +108,8 @@ private:
PluginInterface::ScxmlDocument *m_document = nullptr;
PluginInterface::ScxmlUiFactory *m_uiFactory = nullptr;
QVector<QToolButton*> m_toolButtons;
QVector<StateView*> m_views;
QList<QToolButton*> m_toolButtons;
QList<StateView*> m_views;
bool m_autoFit = true;
bool m_windowBlocked = false;
PluginInterface::ActionHandler *m_actionHandler = nullptr;

View File

@@ -36,7 +36,7 @@ private:
void resetModel();
PluginInterface::ScxmlDocument *m_document = nullptr;
QVector<PluginInterface::ScxmlTag*> m_allTags;
QList<PluginInterface::ScxmlTag*> m_allTags;
QString m_strFilter;
};

View File

@@ -40,7 +40,7 @@ private:
void calculateStats(PluginInterface::ScxmlTag *tag);
QStringList m_names;
QVector<int> m_counts;
QList<int> m_counts;
int m_levels = 0;
};

View File

@@ -54,7 +54,7 @@ StructureSortFilterProxyModel::StructureSortFilterProxyModel(QObject *parent)
{
}
void StructureSortFilterProxyModel::setVisibleTags(const QVector<TagType> &visibleTags)
void StructureSortFilterProxyModel::setVisibleTags(const QList<TagType> &visibleTags)
{
m_visibleTags = visibleTags;
if (!m_visibleTags.contains(Scxml))
@@ -102,7 +102,7 @@ Structure::Structure(QWidget *parent)
m_proxyModel->setDynamicSortFilter(false);
// Default set of the visible tags
QVector<TagType> visibleTags;
QList<TagType> visibleTags;
for (int i = 0; i < Finalize; ++i)
visibleTags << TagType(i);
m_proxyModel->setVisibleTags(visibleTags);
@@ -132,7 +132,7 @@ void Structure::addCheckbox(const QString &name, TagType type)
void Structure::updateCheckBoxes()
{
QVector<TagType> visibleTags;
QList<TagType> visibleTags;
for (QCheckBox *box : std::as_const(m_checkboxes)) {
if (box->isChecked()) {
switch (TagType(box->property(Constants::C_SCXMLTAG_TAGTYPE).toInt())) {

View File

@@ -43,11 +43,11 @@ public:
explicit StructureSortFilterProxyModel(QObject *parent = nullptr);
bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override;
void setSourceModel(QAbstractItemModel *sourceModel) override;
void setVisibleTags(const QVector<PluginInterface::TagType> &visibleTags);
void setVisibleTags(const QList<PluginInterface::TagType> &visibleTags);
private:
QPointer<StructureModel> m_sourceModel;
QVector<PluginInterface::TagType> m_visibleTags;
QList<PluginInterface::TagType> m_visibleTags;
};
/**
@@ -80,7 +80,7 @@ private:
StructureModel *m_model;
PluginInterface::ScxmlDocument *m_currentDocument = nullptr;
PluginInterface::GraphicsScene *m_scene = nullptr;
QVector<QCheckBox*> m_checkboxes;
QList<QCheckBox*> m_checkboxes;
TreeItemDelegate *m_customDelegate = nullptr;
QWidget *m_paneInnerFrame = nullptr;

View File

@@ -37,8 +37,8 @@ public:
private:
QIcon m_emptyIcon;
QVector<PluginInterface::TagType> m_iconIndices;
QVector<QIcon> m_icons;
QList<PluginInterface::TagType> m_iconIndices;
QList<QIcon> m_icons;
};
class StructureModel : public QAbstractItemModel

View File

@@ -68,8 +68,8 @@ private:
void buttonClicked(PaneTitleButton *button, bool checked);
void showAlert(OutputPane *pane);
QVector<OutputPane *> m_pages;
QVector<PaneTitleButton *> m_buttons;
QList<OutputPane *> m_pages;
QList<PaneTitleButton *> m_buttons;
QToolBar *m_toolBar = nullptr;
QStackedWidget *m_stackedWidget = nullptr;

View File

@@ -52,7 +52,7 @@ private:
QString severityName(Warning::Severity severity) const;
QIcon severityIcon(Warning::Severity severity) const;
QVector<Warning*> m_warnings;
QList<Warning*> m_warnings;
QMap<int, bool> m_warningVisibilities;
int m_oldCount = 0;
QPointer<QTimer> m_countChecker;

View File

@@ -9,7 +9,7 @@
#include <QAction>
using namespace ScxmlEditor::PluginInterface;
namespace ScxmlEditor::PluginInterface {
ActionHandler::ActionHandler(QObject *parent)
: QObject(parent)
@@ -68,3 +68,5 @@ QAction *ActionHandler::action(ActionType type) const
return nullptr;
}
} // ScxmlEditor::PluginInterface

View File

@@ -9,9 +9,7 @@
QT_FORWARD_DECLARE_CLASS(QAction)
namespace ScxmlEditor {
namespace PluginInterface {
namespace ScxmlEditor::PluginInterface {
class ActionHandler : public QObject
{
@@ -23,8 +21,7 @@ public:
QAction *action(ActionType type) const;
private:
QVector<QAction*> m_actions;
QList<QAction*> m_actions;
};
} // namespace PluginInterface
} // namespace ScxmlEditor
} // namespace ScxmlEditor::PluginInterface

View File

@@ -47,17 +47,17 @@ ConnectableItem::~ConnectableItem()
{
setBlockUpdates(true);
const QVector<ConnectableItem *> overlappedItems = m_overlappedItems;
const QList<ConnectableItem *> overlappedItems = m_overlappedItems;
for (ConnectableItem *item : overlappedItems)
item->removeOverlappingItem(this);
m_overlappedItems.clear();
const QVector<TransitionItem *> outputTransitions = m_outputTransitions;
const QList<TransitionItem *> outputTransitions = m_outputTransitions;
for (TransitionItem *transition : outputTransitions)
transition->disconnectItem(this);
m_outputTransitions.clear();
const QVector<TransitionItem *> inputTransitions = m_inputTransitions;
const QList<TransitionItem *> inputTransitions = m_inputTransitions;
for (TransitionItem *transition : inputTransitions)
transition->disconnectItem(this);
m_inputTransitions.clear();
@@ -741,7 +741,7 @@ void ConnectableItem::removeOverlappingItem(ConnectableItem *item)
void ConnectableItem::checkOverlapping()
{
QVector<ConnectableItem*> overlappedItems;
QList<ConnectableItem*> overlappedItems;
const QList<QGraphicsItem *> items = collidingItems();
for (QGraphicsItem *it : items) {
if (it->type() >= InitialStateType && it->parentItem() == parentItem()) {
@@ -774,12 +774,12 @@ bool ConnectableItem::canStartTransition(ItemType type) const
return true;
}
QVector<TransitionItem*> ConnectableItem::outputTransitions() const
QList<TransitionItem*> ConnectableItem::outputTransitions() const
{
return m_outputTransitions;
}
QVector<TransitionItem*> ConnectableItem::inputTransitions() const
QList<TransitionItem*> ConnectableItem::inputTransitions() const
{
return m_inputTransitions;
}

View File

@@ -38,8 +38,8 @@ public:
void addInputTransition(TransitionItem *transition);
void removeOutputTransition(TransitionItem *transition);
void removeInputTransition(TransitionItem *transition);
QVector<TransitionItem*> outputTransitions() const;
QVector<TransitionItem*> inputTransitions() const;
QList<TransitionItem*> outputTransitions() const;
QList<TransitionItem*> inputTransitions() const;
void setMinimumWidth(int width);
void setMinimumHeight(int height);
@@ -101,10 +101,10 @@ private:
void removeCorners();
void updateShadowClipRegion();
QVector<TransitionItem*> m_outputTransitions;
QVector<TransitionItem*> m_inputTransitions;
QVector<CornerGrabberItem*> m_corners;
QVector<QuickTransitionItem*> m_quickTransitions;
QList<TransitionItem*> m_outputTransitions;
QList<TransitionItem*> m_inputTransitions;
QList<CornerGrabberItem*> m_corners;
QList<QuickTransitionItem*> m_quickTransitions;
HighlightItem *m_highlighItem = nullptr;
TransitionItem *m_newTransition = nullptr;
QPen m_selectedPen;
@@ -118,7 +118,7 @@ private:
QPainterPath m_shadowClipPath;
QPointF m_moveStartPoint;
bool m_moveMacroStarted = false;
QVector<ConnectableItem*> m_overlappedItems;
QList<ConnectableItem*> m_overlappedItems;
};
} // namespace PluginInterface

View File

@@ -66,7 +66,7 @@ void OnEntryExitItem::updateAttributes()
void OnEntryExitItem::finalizeCreation()
{
const QVector<ScxmlTag*> children = tag()->allChildren();
const QList<ScxmlTag*> children = tag()->allChildren();
auto pos = m_eventNameItem->boundingRect().bottomLeft();
for (auto child : children) {
EventItem *item = new EventItem(pos, this);

View File

@@ -179,7 +179,7 @@ void GraphicsScene::cut()
void GraphicsScene::removeSelectedItems()
{
QVector<ScxmlTag*> tags = SceneUtils::findRemovedTags(m_baseItems);
QList<ScxmlTag*> tags = SceneUtils::findRemovedTags(m_baseItems);
if (!tags.isEmpty()) {
m_document->undoStack()->beginMacro(Tr::tr("Remove items"));
@@ -199,9 +199,9 @@ void GraphicsScene::copy()
return;
QPointF minPos;
QVector<ScxmlTag*> tags;
QList<ScxmlTag*> tags;
if (m_document->currentTag()->tagType() == Scxml) {
QVector<BaseItem*> items;
QList<BaseItem*> items;
for (BaseItem *item : std::as_const(m_baseItems)) {
if (!item->parentItem())
items << item;
@@ -349,7 +349,7 @@ void GraphicsScene::runLayoutToSelectedStates()
{
m_document->undoStack()->beginMacro(Tr::tr("Re-layout"));
QVector<BaseItem*> selectedItems;
QList<BaseItem*> selectedItems;
for (BaseItem *node : std::as_const(m_baseItems)) {
if (node->isSelected()) {
int index = 0;
@@ -514,7 +514,7 @@ void GraphicsScene::endTagChange(ScxmlDocument::TagChange change, ScxmlTag *tag,
if (!tag)
break;
QVector<ScxmlTag*> childTransitionTags;
QList<ScxmlTag*> childTransitionTags;
if (tag->tagName(false) == "transition")
childTransitionTags << tag;
@@ -721,7 +721,7 @@ void GraphicsScene::removeItems(const ScxmlTag *tag)
{
if (tag) {
// Find right items
QVector<BaseItem*> items;
QList<BaseItem*> items;
for (BaseItem *it : std::as_const(m_baseItems)) {
if (it->tag() == tag)
items << it;

View File

@@ -57,7 +57,7 @@ public:
void setDocument(ScxmlDocument *document);
void unselectAll();
void unhighlightAll();
void highlightItems(const QVector<ScxmlTag*> &lstIds);
void highlightItems(const QList<ScxmlTag*> &lstIds);
void addConnectableItem(ItemType type, const QPointF &pos, BaseItem *parentItem);
void runAutomaticLayout();
void runLayoutToSelectedStates();
@@ -112,8 +112,8 @@ private:
QPointer<OutputPane::WarningModel> m_warningModel;
QPointer<ScxmlUiFactory> m_uiFactory;
QPointer<ScxmlDocument> m_document;
QVector<BaseItem*> m_baseItems;
QVector<WarningItem*> m_allWarnings;
QList<BaseItem*> m_baseItems;
QList<WarningItem*> m_allWarnings;
int m_pasteCounter = 0;
QPointer<BaseItem> m_lastPasteTargetItem;
SnapLine *m_lineX = nullptr;

View File

@@ -43,7 +43,7 @@ void IdWarningItem::setId(const QString &text)
void IdWarningItem::checkDuplicates(const QString &id)
{
if (scene()) {
QVector<IdWarningItem*> foundItems;
QList<IdWarningItem*> foundItems;
QList<QGraphicsItem*> items = scene()->items();
for (int i = 0; i < items.count(); ++i) {

View File

@@ -45,7 +45,7 @@ void ParallelItem::doLayout(int d)
return;
// 1. Find children items
QVector<StateItem*> children;
QList<StateItem*> children;
const QList<QGraphicsItem *> items = childItems();
for (QGraphicsItem *it : items) {
if (it->type() >= StateType) {
@@ -74,7 +74,7 @@ void ParallelItem::doLayout(int d)
// 3. Relocate children-states
// a) sort list
QVector<StateItem*> sortedList;
QList<StateItem*> sortedList;
while (!children.isEmpty()) {
qreal minTop = children.first()->boundingRect().top();
int minTopIndex = 0;

View File

@@ -123,10 +123,10 @@ bool canDrop(int parentType, int childType)
}
}
QVector<ScxmlTag*> findCopyTags(const QVector<BaseItem*> &items, QPointF &minPos)
QList<ScxmlTag*> findCopyTags(const QList<BaseItem*> &items, QPointF &minPos)
{
QPointF pp(0, 0);
QVector<ScxmlTag*> tags;
QList<ScxmlTag*> tags;
for (BaseItem *it : items) {
if (it->type() >= InitialStateType && it->isSelected()) {
BaseItem *parent = it->parentBaseItem();
@@ -155,10 +155,10 @@ QVector<ScxmlTag*> findCopyTags(const QVector<BaseItem*> &items, QPointF &minPos
return tags;
}
QVector<ScxmlTag*> findRemovedTags(const QVector<BaseItem*> &items)
QList<ScxmlTag*> findRemovedTags(const QList<BaseItem*> &items)
{
// Find right tags
QVector<ScxmlTag*> tags;
QList<ScxmlTag*> tags;
for (BaseItem *it : items) {
if (it->isSelected()) {
// Find the last selected parent

View File

@@ -31,8 +31,8 @@ ConnectableItem *createItem(ItemType type, const QPointF &pos = QPointF());
ConnectableItem *createItemByTagType(TagType type, const QPointF &pos = QPointF());
ScxmlTag *createTag(ItemType type, ScxmlDocument *document);
bool canDrop(int parentType, int childType);
QVector<ScxmlTag*> findCopyTags(const QVector<BaseItem*> &items, QPointF &minPos);
QVector<ScxmlTag*> findRemovedTags(const QVector<BaseItem*> &items);
QList<ScxmlTag*> findCopyTags(const QList<BaseItem*> &items, QPointF &minPos);
QList<ScxmlTag*> findRemovedTags(const QList<BaseItem*> &items);
void layout(const QList<QGraphicsItem*> &items);
bool isSomeSelected(QGraphicsItem *item);
void moveTop(BaseItem *item, GraphicsScene *scene);

View File

@@ -5,7 +5,7 @@
#include "shapeprovider.h"
#include <QVector>
#include <QList>
namespace ScxmlEditor {
@@ -40,7 +40,7 @@ protected:
private:
void init();
QVector<ShapeGroup*> m_groups;
QList<ShapeGroup*> m_groups;
};
} // namespace PluginInterface

View File

@@ -169,7 +169,7 @@ QColor ScxmlDocument::getColor(int depth) const
return m_colors.isEmpty() ? QColor(Qt::gray) : m_colors[depth % m_colors.count()];
}
void ScxmlDocument::setLevelColors(const QVector<QColor> &colors)
void ScxmlDocument::setLevelColors(const QList<QColor> &colors)
{
m_colors = colors;
emit colorThemeChanged();
@@ -294,7 +294,7 @@ bool ScxmlDocument::pasteData(const QByteArray &data, const QPointF &minPos, con
}
m_idMap.clear();
QVector<ScxmlTag*> addedTags;
QList<ScxmlTag*> addedTags;
while (!xml.atEnd()) {
QXmlStreamReader::TokenType token = xml.readNext();
@@ -374,7 +374,7 @@ void ScxmlDocument::printSCXML()
qDebug() << content();
}
QByteArray ScxmlDocument::content(const QVector<ScxmlTag*> &tags) const
QByteArray ScxmlDocument::content(const QList<ScxmlTag*> &tags) const
{
QByteArray result;
if (!tags.isEmpty()) {
@@ -494,7 +494,7 @@ void ScxmlDocument::changeOrder(ScxmlTag *child, int newPos)
}
}
void ScxmlDocument::addTags(ScxmlTag *parent, const QVector<ScxmlTag*> tags)
void ScxmlDocument::addTags(ScxmlTag *parent, const QList<ScxmlTag*> tags)
{
if (m_undoRedoRunning)
return;

View File

@@ -5,11 +5,11 @@
#include <QFileInfo>
#include <QHash>
#include <QList>
#include <QMap>
#include <QObject>
#include <QPointF>
#include <QString>
#include <QVector>
QT_FORWARD_DECLARE_CLASS(QUndoStack)
QT_FORWARD_DECLARE_CLASS(QXmlStreamReader)
@@ -106,7 +106,7 @@ public:
* @param child
*/
void addTag(ScxmlTag *parent, ScxmlTag *child);
void addTags(ScxmlTag *parent, const QVector<ScxmlTag*> tags);
void addTags(ScxmlTag *parent, const QList<ScxmlTag*> tags);
/**
* @brief removeTag - inform views that tag will be removed
@@ -183,7 +183,7 @@ public:
*/
bool hasLayouted() const;
void setLevelColors(const QVector<QColor> &colors);
void setLevelColors(const QList<QColor> &colors);
QColor getColor(int depth) const;
bool hasError() const
@@ -196,7 +196,7 @@ public:
return m_lastError;
}
QByteArray content(const QVector<ScxmlTag*> &tags) const;
QByteArray content(const QList<ScxmlTag*> &tags) const;
QByteArray content(ScxmlTag *tag = nullptr) const;
void clear(bool createRoot = true);
@@ -256,14 +256,14 @@ private:
ScxmlTag *createScxmlTag();
QString m_fileName;
QUndoStack *m_undoStack;
QVector<ScxmlTag*> m_tags;
QList<ScxmlTag*> m_tags;
QHash<QString, int> m_nextIdHash;
QHash<QString, QString> m_idMap;
bool m_hasError = false;
QString m_lastError;
QVector<ScxmlTag*> m_rootTags;
QList<ScxmlTag*> m_rootTags;
QMap<QString, ScxmlNamespace*> m_namespaces;
QVector<QColor> m_colors;
QList<QColor> m_colors;
bool m_hasLayouted = false;
QString m_idDelimiter;
bool m_useFullNameSpace = false;

View File

@@ -476,14 +476,14 @@ ScxmlTag *ScxmlTag::tagForId(const QString &id) const
return nullptr;
}
QVector<ScxmlTag*> ScxmlTag::allChildren() const
QList<ScxmlTag*> ScxmlTag::allChildren() const
{
return m_childTags;
}
QVector<ScxmlTag*> ScxmlTag::children(const QString &name) const
QList<ScxmlTag*> ScxmlTag::children(const QString &name) const
{
QVector<ScxmlTag*> children;
QList<ScxmlTag*> children;
for (ScxmlTag *tag : std::as_const(m_childTags)) {
if (tag->tagName() == name)
children << tag;

View File

@@ -83,8 +83,8 @@ public:
void removeChild(ScxmlTag *child);
void moveChild(int oldPos, int newPos);
int childCount() const;
QVector<ScxmlTag*> allChildren() const;
QVector<ScxmlTag*> children(const QString &name) const;
QList<ScxmlTag*> allChildren() const;
QList<ScxmlTag*> children(const QString &name) const;
ScxmlTag *child(const QString &name) const;
ScxmlTag *child(int row) const;
int childIndex(const ScxmlTag *child) const;
@@ -116,7 +116,7 @@ private:
QStringList m_attributeNames;
QStringList m_attributeValues;
QPointer<ScxmlTag> m_parentTag;
QVector<ScxmlTag*> m_childTags;
QList<ScxmlTag*> m_childTags;
QPointer<ScxmlDocument> m_document;
TagType m_tagType = UnknownTag;
QString m_tagName;

View File

@@ -24,7 +24,7 @@ bool checkPaste(const QString &copiedTagTypes, const ScxmlTag *currentTag)
if (copiedTagTypes.isEmpty() || !currentTag)
return false;
QVector<TagType> tagTypes;
QList<TagType> tagTypes;
for (int i = 0; i < Finalize; ++i) {
if (copiedTagTypes.contains(QLatin1String(scxml_tags[i].name)))
tagTypes << TagType(i);
@@ -35,7 +35,7 @@ bool checkPaste(const QString &copiedTagTypes, const ScxmlTag *currentTag)
if (tagTypes.isEmpty())
return false;
QVector<TagType> childTags = allowedChildTypes(currentTag->tagType());
QList<TagType> childTags = allowedChildTypes(currentTag->tagType());
for (const TagType &type : std::as_const(tagTypes)) {
if (!childTags.contains(type))
return false;
@@ -75,9 +75,9 @@ void createChildMenu(const ScxmlTag *tag, QMenu *menu, bool addRemove)
}
}
QVector<TagType> allowedChildTypes(TagType tagType)
QList<TagType> allowedChildTypes(TagType tagType)
{
QVector<TagType> childTags;
QList<TagType> childTags;
switch (tagType) {
case Scxml:
@@ -161,9 +161,9 @@ QVector<TagType> allowedChildTypes(TagType tagType)
return childTags;
}
QVector<TagType> childTypes(TagType tagType)
QList<TagType> childTypes(TagType tagType)
{
QVector<TagType> childTags;
QList<TagType> childTags;
switch (tagType) {
case Scxml:
@@ -241,7 +241,7 @@ void initChildMenu(TagType tagType, QMenu *menu)
{
menu->setTitle(QLatin1String(scxml_tags[tagType].name));
QVector<TagType> childTags = childTypes(tagType);
QList<TagType> childTags = childTypes(tagType);
if (!childTags.isEmpty()) {
for (int i = 0; i < childTags.count(); ++i) {
@@ -301,7 +301,7 @@ ScxmlTag *findChild(const ScxmlTag *tag, TagType childType)
return nullptr;
}
void findAllChildren(const ScxmlTag *tag, QVector<ScxmlTag*> &children)
void findAllChildren(const ScxmlTag *tag, QList<ScxmlTag*> &children)
{
QTC_ASSERT(tag, return);
@@ -312,7 +312,7 @@ void findAllChildren(const ScxmlTag *tag, QVector<ScxmlTag*> &children)
}
}
void findAllTransitionChildren(const ScxmlTag *tag, QVector<ScxmlTag*> &children)
void findAllTransitionChildren(const ScxmlTag *tag, QList<ScxmlTag*> &children)
{
QTC_ASSERT(tag, return);

View File

@@ -4,14 +4,11 @@
#pragma once
#include "scxmltag.h"
#include <QList>
#include <QMenu>
#include <QVector>
namespace ScxmlEditor {
namespace PluginInterface {
namespace TagUtils {
namespace ScxmlEditor::PluginInterface::TagUtils {
enum MenuAction {
AddChild = 0,
@@ -23,16 +20,14 @@ enum MenuAction {
};
bool checkPaste(const QString &copiedTagType, const ScxmlTag *currentTag);
QVector<TagType> allowedChildTypes(TagType tagType);
QVector<TagType> childTypes(TagType type);
QList<TagType> allowedChildTypes(TagType tagType);
QList<TagType> childTypes(TagType type);
void createChildMenu(const ScxmlTag *tag, QMenu *menu, bool addRemove = true);
void initChildMenu(TagType tagType, QMenu *menu);
ScxmlTag *findChild(const ScxmlTag *tag, TagType childType);
ScxmlTag *metadataTag(ScxmlTag *tag, const QString &tagname, bool blockUpdates = false);
void findAllChildren(const ScxmlTag *tag, QVector<ScxmlTag*> &children);
void findAllTransitionChildren(const ScxmlTag *tag, QVector<ScxmlTag*> &children);
void findAllChildren(const ScxmlTag *tag, QList<ScxmlTag*> &children);
void findAllTransitionChildren(const ScxmlTag *tag, QList<ScxmlTag*> &children);
void modifyPosition(ScxmlTag *tag, const QPointF &minPos, const QPointF &targetPos);
} // namespace TagUtils
} // namespace PluginInterface
} // namespace ScxmlEditor
} // namespace ScxmlEditor::PluginInterface::TagUtils

View File

@@ -3,8 +3,8 @@
#pragma once
#include <QList>
#include <QVariant>
#include <QVector>
namespace ScxmlEditor {

View File

@@ -7,9 +7,7 @@
#include <QObject>
namespace ScxmlEditor {
namespace PluginInterface {
namespace ScxmlEditor::PluginInterface {
class ISCEditor;
class ScxmlDocument;
@@ -41,9 +39,8 @@ public:
private:
void initPlugins();
QVector<ISCEditor*> m_plugins;
QList<ISCEditor*> m_plugins;
QMap<QString, QObject*> m_objects;
};
} // namespace PluginInterface
} // namespace ScxmlEditor
} // namespace ScxmlEditor::PluginInterface

View File

@@ -9,9 +9,7 @@
#include <QObject>
#include <QString>
namespace ScxmlEditor {
namespace PluginInterface {
namespace ScxmlEditor::PluginInterface {
class ShapeProvider : public QObject
{
@@ -36,7 +34,7 @@ public:
}
QString title;
QVector<Shape*> shapes;
QList<Shape*> shapes;
void addShape(Shape *shape)
{
shapes << shape;
@@ -59,5 +57,4 @@ signals:
void changed();
};
} // namespace PluginInterface
} // namespace ScxmlEditor
} // namespace ScxmlEditor::PluginInterface

View File

@@ -190,7 +190,7 @@ void StateItem::updateBoundingRect()
void StateItem::shrink()
{
QRectF trect;
const QVector<TransitionItem *> items = outputTransitions();
const QList<TransitionItem *> items = outputTransitions();
for (TransitionItem *item : items) {
if (item->targetType() == TransitionItem::InternalSameTarget || item->targetType() == TransitionItem::InternalNoTarget) {
trect = trect.united(item->wholeBoundingRect());
@@ -223,7 +223,7 @@ void StateItem::transitionsChanged()
{
QRectF rr = boundingRect();
QRectF rectInternalTransitions;
const QVector<TransitionItem*> internalTransitions = outputTransitions();
const QList<TransitionItem*> internalTransitions = outputTransitions();
for (TransitionItem *item : internalTransitions) {
if (item->targetType() <= TransitionItem::InternalNoTarget) {
QRectF br = mapFromItem(item, item->boundingRect()).boundingRect();

View File

@@ -4,13 +4,13 @@
#pragma once
#include "transitionwarningitem.h"
#include <QGraphicsSceneMouseEvent>
#include <QKeyEvent>
#include <QPen>
#include <QPointF>
#include <QPolygon>
#include <QRectF>
#include <QVector>
namespace ScxmlEditor {
@@ -126,7 +126,7 @@ private:
QPointF calculateTargetFactor(ConnectableItem *item, const QPointF &pos);
QPointF sceneTargetPoint(TransitionPoint p);
QPointF findIntersectionPoint(ConnectableItem *item, const QLineF &line, const QPointF &defaultPoint);
QVector<CornerGrabberItem*> m_cornerGrabbers;
QList<CornerGrabberItem*> m_cornerGrabbers;
CornerGrabberItem *m_selectedCornerGrabber = nullptr;
QPolygonF m_cornerPoints;

View File

@@ -332,7 +332,7 @@ void ChangeFullNameSpaceCommand::makeIdMap(ScxmlTag *tag, QHash<QString, QString
break;
}
const QVector<ScxmlTag *> children = tag->allChildren();
const QList<ScxmlTag *> children = tag->allChildren();
for (ScxmlTag *child : children) {
makeIdMap(child, map, use);
}
@@ -359,7 +359,7 @@ void ChangeFullNameSpaceCommand::updateNameSpace(ScxmlTag *tag, const QHash<QStr
tag->setAttribute(name, map[attr]);
}
const QVector<ScxmlTag *> children = tag->allChildren();
const QList<ScxmlTag *> children = tag->allChildren();
for (ScxmlTag *child : children) {
updateNameSpace(child, map);
}