-
Notifications
You must be signed in to change notification settings - Fork 0
/
ViewHeader.h
42 lines (36 loc) · 1.2 KB
/
ViewHeader.h
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
#ifndef VIEWHEADER_H
#define VIEWHEADER_H
#include <MWidgetController>
#include <QGraphicsLinearLayout>
#include <MLabel>
class ViewHeader : public MWidgetController
{
public:
ViewHeader(QGraphicsItem *parent = 0) :
MWidgetController(parent),
linearLayout(0),
titleWidget(0)
{
setObjectName("CommonHeaderPanel");
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
setContentsMargins(0, 0, 0, 0);
linearLayout = new QGraphicsLinearLayout(Qt::Horizontal, this);
linearLayout->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
linearLayout->setContentsMargins(0, 0, 0, 0);
linearLayout->setSpacing(0);
titleWidget = new MLabel(this);
titleWidget->setWordWrap(true);
titleWidget->setStyleName("CommonHeaderInverted");
titleWidget->setAlignment(Qt::AlignVCenter | Qt::AlignLeft);
linearLayout->addItem(titleWidget);
linearLayout->setAlignment(titleWidget, Qt::AlignLeft | Qt::AlignVCenter);
}
void setTitle(const QString &title)
{
titleWidget->setText(title);
}
private:
QGraphicsLinearLayout *linearLayout;
MLabel *titleWidget;
};
#endif