blob: b4b96db447e9eea5f00c31b9a88468d9ee5452aa (
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
|
// Copyright (C) 2016 Jochen Becher
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "stereotypesitem.h"
namespace qmt {
StereotypesItem::StereotypesItem(QGraphicsItem *parent)
: QGraphicsSimpleTextItem(parent)
{
}
StereotypesItem::~StereotypesItem()
{
}
void StereotypesItem::setStereotypes(const QList<QString> &stereotypes)
{
setText(format(stereotypes));
}
QString StereotypesItem::format(const QList<QString> &stereotypes)
{
QString text;
if (!stereotypes.isEmpty()) {
text = QString::fromUtf8("«");
bool first = true;
for (const QString &stereotype : stereotypes) {
if (!first)
text += ", ";
text += stereotype;
first = false;
}
text += QString::fromUtf8("»");
}
return text;
}
} // namespace qmt
|