aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/scxmleditor/plugin_interface/initialstateitem.h
blob: 8f989796c567c5fe151982b1948938acffa23fcd (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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// 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

#pragma once

#include "connectableitem.h"

namespace ScxmlEditor {

namespace PluginInterface {

class InitialWarningItem;

/**
 * @brief The InitialStateItem class represents Initial-state of the SCXML-standard. It is a extended class from the ConnectableItem.
 */
class InitialStateItem : public ConnectableItem
{
public:
    explicit InitialStateItem(const QPointF &pos = QPointF(), BaseItem *parent = nullptr);

    int type() const override
    {
        return InitialStateType;
    }

    void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
    InitialWarningItem *warningItem() const;

    void checkWarnings() override;

protected:
    QVariant itemChange(GraphicsItemChange change, const QVariant &value) override;
    void updatePolygon() override;
    bool canStartTransition(ItemType type) const override;

private:
    void checkWarningItems();
    InitialWarningItem *m_warningItem = nullptr;
    qreal m_size = 1.0;
    QPen m_pen;
};

} // namespace PluginInterface
} // namespace ScxmlEditor