Krita Source Code Documentation
Loading...
Searching...
No Matches
KisTagLabel Class Reference

#include <KisTagLabel.h>

+ Inheritance diagram for KisTagLabel:

Public Member Functions

QString getText ()
 
 KisTagLabel (QString string, QWidget *parent=nullptr)
 
 ~KisTagLabel ()
 

Protected Member Functions

void paintEvent (QPaintEvent *event) override
 

Private Attributes

QString m_string
 

Detailed Description

Definition at line 14 of file KisTagLabel.h.

Constructor & Destructor Documentation

◆ KisTagLabel()

KisTagLabel::KisTagLabel ( QString string,
QWidget * parent = nullptr )
explicit

Definition at line 15 of file KisTagLabel.cpp.

15 :
16 QWidget(parent)
17{
18 m_string = string;
19
20 QHBoxLayout *layout = new QHBoxLayout(this);
21 layout->setContentsMargins(8, 0, 8, 0);
22 layout->setSpacing(2);
23
24 QLabel *label = new QLabel(parent);
25 label->setText(m_string);
26 label->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
27 layout->addWidget(label);
28
29 setLayout(layout);
30}
QString m_string
Definition KisTagLabel.h:29

References m_string.

◆ ~KisTagLabel()

KisTagLabel::~KisTagLabel ( )

Definition at line 32 of file KisTagLabel.cpp.

33{
34}

Member Function Documentation

◆ getText()

QString KisTagLabel::getText ( )

Definition at line 52 of file KisTagLabel.cpp.

53{
54 return m_string;
55}

References m_string.

◆ paintEvent()

void KisTagLabel::paintEvent ( QPaintEvent * event)
overrideprotected

Definition at line 36 of file KisTagLabel.cpp.

37{
38 QPainter painter(this);
39
40 QColor backGroundColor = qApp->palette().light().color();
41 QColor foregroundColor = qApp->palette().windowText().color();
42
43 QWidget::paintEvent(event);
44 painter.setRenderHint(QPainter::Antialiasing);
45 QPainterPath path;
46 path.addRoundedRect(this->rect(), 6, 6);
47
48 // good color:
49 painter.fillPath(path, qApp->palette().light());
50}

Member Data Documentation

◆ m_string

QString KisTagLabel::m_string
private

Definition at line 29 of file KisTagLabel.h.


The documentation for this class was generated from the following files: