aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/modelinglib/qmt/diagram_scene/parts/contextlabelitem.h
blob: d23b2d7e85d59623278922a0a717814dbd8c69a8 (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 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