aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/scxmleditor/plugin_interface/transitionwarningitem.cpp
blob: cea19cc32d3eaf05867d1d788dccbcdaa3c7a4a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0

#include "transitionwarningitem.h"
#include "transitionitem.h"

#include <utils/utilsicons.h>

using namespace ScxmlEditor::PluginInterface;

TransitionWarningItem::TransitionWarningItem(TransitionItem *parent)
    : WarningItem(parent)
    , m_parentItem(parent)
{
    setSeverity(OutputPane::Warning::WarningType);
    setTypeName(tr("Transition"));
    setDescription(tr("Transitions should be connected."));

    setPixmap(Utils::Icons::WARNING.pixmap());
}

void TransitionWarningItem::check()
{
    if (m_parentItem) {
        if (m_parentItem->targetType() == TransitionItem::ExternalNoTarget) {
            setReason(tr("Not connected (%1).").arg(m_parentItem->tagValue("event")));
            setWarningActive(true);
        } else
            setWarningActive(false);
    }
}