aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/modelinglib/qmt/diagram_scene/parts/contextlabelitem.h
blob: 7b033a5f23fcddb10a301f26c9c45ea8f4ddaa0a (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
// Copyright (C) 2016 Jochen Becher
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

#pragma once

#include <QGraphicsSimpleTextItem>

namespace qmt {

class ContextLabelItem : public QGraphicsSimpleTextItem
{
public:
    explicit ContextLabelItem(QGraphicsItem *parent = nullptr);
    ~ContextLabelItem() override;

    void setMaxWidth(double maxWidth);
    void resetMaxWidth();
    void setContext(const QString &context);
    double height() const;

private:
    void update();

    double m_maxWidth = 0.0;
    QString m_context;
};

} // namespace qmt