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

namespace qmt {

class AlignLineItem : public QGraphicsItem
{
public:
    enum Direction {
        Horizontal,
        Vertical
    };

    explicit AlignLineItem(Direction direction, QGraphicsItem *parent = nullptr);
    ~AlignLineItem() override;

    void setLine(qreal pos);
    void setLine(qreal pos, qreal otherPos1, qreal otherPos2);

    QRectF boundingRect() const override;
    void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
               QWidget *widget = nullptr) override;

    Direction m_direction = Horizontal;
    QGraphicsLineItem *m_alignLine = nullptr;
    QGraphicsLineItem *m_highlightLine = nullptr;
};

} // namespace qmt