aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/scxmleditor/common/stateview.h
blob: bae8bae3449061c452252739d2f0a38a7e2790ea (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
46
47
48
49
// 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 "ui_stateview.h"

#include <QWidget>

namespace ScxmlEditor {

namespace PluginInterface {
class GraphicsScene;
class StateItem;
class ScxmlDocument;
class ScxmlUiFactory;
} // namespace PluginInterface

namespace Common {

class StateView : public QWidget
{
    Q_OBJECT

public:
    explicit StateView(PluginInterface::StateItem *state, QWidget *parent = nullptr);
    explicit StateView(QWidget *parent = nullptr);
    ~StateView() override;

    PluginInterface::StateItem *parentState() const;
    PluginInterface::GraphicsScene *scene() const;
    GraphicsView *view() const;
    void setUiFactory(PluginInterface::ScxmlUiFactory *uifactory);
    void setDocument(PluginInterface::ScxmlDocument *doc);
    void clear();

private:
    void closeView();
    void init();
    void initScene();

    PluginInterface::StateItem *m_parentState = nullptr;
    PluginInterface::GraphicsScene *m_scene = nullptr;
    bool m_isMainView;
    Ui::StateView m_ui;
};

} // namespace Common
} // namespace ScxmlEditor