forked from qt-creator/qt-creator
ScxmlEditor: Modernize
modernize-* Change-Id: I72a72cf5e9327956fdc0e5fc6f552bfc03d2122c Reviewed-by: Marco Benelli <marco.benelli@qt.io>
This commit is contained in:
@@ -29,7 +29,6 @@ using namespace ScxmlEditor::PluginInterface;
|
||||
|
||||
AttributeItemDelegate::AttributeItemDelegate(QObject *parent)
|
||||
: QStyledItemDelegate(parent)
|
||||
, m_tag(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ void AttributeItemModel::setTag(ScxmlTag *tag)
|
||||
{
|
||||
beginResetModel();
|
||||
m_tag = tag;
|
||||
m_document = m_tag ? m_tag->document() : 0;
|
||||
m_document = m_tag ? m_tag->document() : nullptr;
|
||||
endResetModel();
|
||||
emit layoutChanged();
|
||||
emit dataChanged(QModelIndex(), QModelIndex());
|
||||
|
||||
@@ -333,7 +333,7 @@ bool BaseItem::isActiveScene() const
|
||||
|
||||
ScxmlUiFactory *BaseItem::uiFactory() const
|
||||
{
|
||||
return m_scene ? m_scene->uiFactory() : 0;
|
||||
return m_scene ? m_scene->uiFactory() : nullptr;
|
||||
}
|
||||
|
||||
GraphicsScene *BaseItem::graphicsScene() const
|
||||
|
||||
@@ -451,7 +451,7 @@ void ConnectableItem::releaseFromParent()
|
||||
setOpacity(0.5);
|
||||
m_releasedIndex = tag()->index();
|
||||
m_releasedParent = parentItem();
|
||||
tag()->document()->changeParent(tag(), 0, !m_releasedParent ? m_releasedIndex : -1);
|
||||
tag()->document()->changeParent(tag(), nullptr, !m_releasedParent ? m_releasedIndex : -1);
|
||||
setZValue(503);
|
||||
|
||||
for (int i = 0; i < m_quickTransitions.count(); ++i)
|
||||
@@ -468,7 +468,8 @@ void ConnectableItem::connectToParent(BaseItem *parentItem)
|
||||
for (int i = 0; i < m_corners.count(); ++i)
|
||||
m_corners[i]->setVisible(true);
|
||||
|
||||
tag()->document()->changeParent(tag(), parentItem ? parentItem->tag() : 0, parentItem == m_releasedParent ? m_releasedIndex : -1);
|
||||
tag()->document()->changeParent(tag(), parentItem ? parentItem->tag() : nullptr,
|
||||
parentItem == m_releasedParent ? m_releasedIndex : -1);
|
||||
|
||||
setZValue(0);
|
||||
m_releasedIndex = -1;
|
||||
@@ -564,7 +565,7 @@ void ConnectableItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *o
|
||||
|
||||
void ConnectableItem::updateUIProperties()
|
||||
{
|
||||
if (tag() != 0 && isActiveScene()) {
|
||||
if (tag() && isActiveScene()) {
|
||||
Serializer s;
|
||||
s.append(pos());
|
||||
s.append(boundingRect());
|
||||
|
||||
@@ -70,7 +70,7 @@ void GraphicsScene::unselectAll()
|
||||
foreach (QGraphicsItem *it, selectedItems)
|
||||
it->setSelected(false);
|
||||
if (m_document)
|
||||
m_document->setCurrentTag(0);
|
||||
m_document->setCurrentTag(nullptr);
|
||||
}
|
||||
|
||||
void GraphicsScene::unhighlightAll()
|
||||
@@ -209,7 +209,7 @@ void GraphicsScene::removeSelectedItems()
|
||||
m_document->setCurrentTag(tags[i]);
|
||||
m_document->removeTag(tags[i]);
|
||||
}
|
||||
m_document->setCurrentTag(0);
|
||||
m_document->setCurrentTag(nullptr);
|
||||
m_document->undoStack()->endMacro();
|
||||
}
|
||||
}
|
||||
@@ -305,7 +305,7 @@ void GraphicsScene::setEditorInfo(const QString &key, const QString &value)
|
||||
void GraphicsScene::setDocument(ScxmlDocument *document)
|
||||
{
|
||||
if (m_document)
|
||||
disconnect(m_document, 0, this, 0);
|
||||
disconnect(m_document, nullptr, this, nullptr);
|
||||
|
||||
m_document = document;
|
||||
|
||||
@@ -361,7 +361,7 @@ void GraphicsScene::init()
|
||||
}
|
||||
|
||||
m_initializing = false;
|
||||
warningVisibilityChanged(0, 0);
|
||||
warningVisibilityChanged(0, nullptr);
|
||||
emit selectedStateCountChanged(0);
|
||||
emit selectedBaseItemCountChanged(0);
|
||||
}
|
||||
@@ -556,7 +556,7 @@ void GraphicsScene::endTagChange(ScxmlDocument::TagChange change, ScxmlTag *tag,
|
||||
auto transition = new TransitionItem;
|
||||
addItem(transition);
|
||||
transition->setStartItem(qgraphicsitem_cast<ConnectableItem*>(parentItem));
|
||||
transition->init(childTag, 0, false, false);
|
||||
transition->init(childTag, nullptr, false, false);
|
||||
transition->updateAttributes();
|
||||
} else {
|
||||
childItem = SceneUtils::createItemByTagType(childTag->tagType(), QPointF());
|
||||
@@ -745,7 +745,7 @@ void GraphicsScene::removeItems(const ScxmlTag *tag)
|
||||
|
||||
// Then delete them
|
||||
for (int i = items.count(); i--;) {
|
||||
items[i]->setTag(0);
|
||||
items[i]->setTag(nullptr);
|
||||
delete items[i];
|
||||
}
|
||||
}
|
||||
@@ -911,7 +911,7 @@ void GraphicsScene::addChild(BaseItem *item)
|
||||
void GraphicsScene::removeChild(BaseItem *item)
|
||||
{
|
||||
if (item)
|
||||
disconnect(item, 0, this, 0);
|
||||
disconnect(item, nullptr, this, nullptr);
|
||||
m_baseItems.removeAll(item);
|
||||
|
||||
selectionChanged(false);
|
||||
@@ -943,7 +943,7 @@ void GraphicsScene::checkInitialState()
|
||||
void GraphicsScene::clearAllTags()
|
||||
{
|
||||
foreach (BaseItem *it, m_baseItems) {
|
||||
it->setTag(0);
|
||||
it->setTag(nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ bool SCAttributeItemModel::setData(const QModelIndex &index, const QVariant &val
|
||||
|
||||
bool bEditable = m_tag->tagType() <= MetadataItem;
|
||||
|
||||
if (index.row() >= 0 && m_document != 0) {
|
||||
if (index.row() >= 0 && m_document) {
|
||||
if (!bEditable) {
|
||||
if (index.row() < m_tag->info()->n_attributes)
|
||||
m_document->setValue(m_tag, index.row(), value.toString());
|
||||
|
||||
@@ -185,7 +185,7 @@ QVector<ScxmlTag*> findRemovedTags(const QVector<BaseItem*> &items)
|
||||
// Find the last selected parent
|
||||
BaseItem *parent = it->parentBaseItem();
|
||||
BaseItem *lastSelectedParent = it;
|
||||
while (parent != 0) {
|
||||
while (parent) {
|
||||
if (parent->isSelected())
|
||||
lastSelectedParent = parent;
|
||||
parent = parent->parentBaseItem();
|
||||
@@ -330,7 +330,7 @@ void layout(const QList<QGraphicsItem*> &items)
|
||||
|
||||
bool isChild(const QGraphicsItem *parent, const QGraphicsItem *child)
|
||||
{
|
||||
while (child != 0) {
|
||||
while (child) {
|
||||
if (parent == child)
|
||||
return true;
|
||||
child = child->parentItem();
|
||||
@@ -341,7 +341,7 @@ bool isChild(const QGraphicsItem *parent, const QGraphicsItem *child)
|
||||
|
||||
bool isSomeSelected(QGraphicsItem *item)
|
||||
{
|
||||
while (item != 0) {
|
||||
while (item) {
|
||||
if (item->isSelected())
|
||||
return true;
|
||||
item = item->parentItem();
|
||||
|
||||
@@ -649,7 +649,7 @@ void TransitionItem::connectToTopItem(const QPointF &pos, TransitionPoint tp, It
|
||||
removeGrabbers();
|
||||
if (m_startItem == m_endItem && cornerPoints == 2) {
|
||||
setTagValue("type", "internal");
|
||||
setEndItem(0);
|
||||
setEndItem(nullptr);
|
||||
m_targetType = InternalNoTarget;
|
||||
}
|
||||
|
||||
@@ -1169,7 +1169,7 @@ void TransitionItem::storeValues(bool block)
|
||||
|
||||
void TransitionItem::updateUIProperties()
|
||||
{
|
||||
if (tag() != 0 && isActiveScene())
|
||||
if (tag() && isActiveScene())
|
||||
storeValues();
|
||||
}
|
||||
|
||||
@@ -1180,9 +1180,9 @@ void TransitionItem::updateTargetType()
|
||||
|
||||
TransitionTargetType type = ExternalTarget;
|
||||
|
||||
if (m_startItem != 0 && m_startItem == m_endItem)
|
||||
if (m_startItem && m_startItem == m_endItem)
|
||||
type = InternalSameTarget;
|
||||
else if (m_startItem != 0 && !m_endItem) {
|
||||
else if (m_startItem && !m_endItem) {
|
||||
if (m_movingLastPoint) {
|
||||
type = ExternalNoTarget;
|
||||
} else {
|
||||
|
||||
@@ -70,7 +70,7 @@ QRectF WarningItem::boundingRect() const
|
||||
|
||||
void WarningItem::mousePressEvent(QGraphicsSceneMouseEvent *e)
|
||||
{
|
||||
QToolTip::showText(e->screenPos(), toolTip(), 0);
|
||||
QToolTip::showText(e->screenPos(), toolTip(), nullptr);
|
||||
QGraphicsObject::mousePressEvent(e);
|
||||
}
|
||||
|
||||
@@ -162,7 +162,7 @@ void WarningItem::setPixmap(const QPixmap &pixmap)
|
||||
|
||||
ScxmlTag *WarningItem::tag() const
|
||||
{
|
||||
return m_parentItem ? m_parentItem->tag() : 0;
|
||||
return m_parentItem ? m_parentItem->tag() : nullptr;
|
||||
}
|
||||
|
||||
ScxmlEditor::OutputPane::Warning *WarningItem::warning() const
|
||||
|
||||
Reference in New Issue
Block a user