Krita Source Code Documentation
Loading...
Searching...
No Matches
KDcrawIface::RClickLabel Class Reference

#include <rexpanderbox.h>

+ Inheritance diagram for KDcrawIface::RClickLabel:

Signals

void activated ()
 Emitted when activated, by mouse or key press.
 
void leftClicked ()
 Emitted when activated by left mouse click.
 

Public Member Functions

 RClickLabel (const QString &text, QWidget *const parent=0)
 
 RClickLabel (QWidget *const parent=0)
 
 ~RClickLabel () override
 

Protected Member Functions

void keyPressEvent (QKeyEvent *event) override
 
void mousePressEvent (QMouseEvent *event) override
 
void mouseReleaseEvent (QMouseEvent *event) override
 

Detailed Description

Definition at line 53 of file rexpanderbox.h.

Constructor & Destructor Documentation

◆ RClickLabel() [1/2]

KDcrawIface::RClickLabel::RClickLabel ( QWidget *const parent = 0)

Definition at line 51 of file rexpanderbox.cpp.

52 : QLabel(parent)
53{
54 setCursor(Qt::PointingHandCursor);
55}

◆ RClickLabel() [2/2]

KDcrawIface::RClickLabel::RClickLabel ( const QString & text,
QWidget *const parent = 0 )
explicit

Definition at line 57 of file rexpanderbox.cpp.

58 : QLabel(text, parent)
59{
60 setCursor(Qt::PointingHandCursor);
61}

◆ ~RClickLabel()

KDcrawIface::RClickLabel::~RClickLabel ( )
override

Definition at line 63 of file rexpanderbox.cpp.

64{
65}

Member Function Documentation

◆ activated

void KDcrawIface::RClickLabel::activated ( )
signal

Emitted when activated, by mouse or key press.

◆ keyPressEvent()

void KDcrawIface::RClickLabel::keyPressEvent ( QKeyEvent * event)
overrideprotected

Definition at line 93 of file rexpanderbox.cpp.

94{
95 switch (e->key())
96 {
97 case Qt::Key_Down:
98 case Qt::Key_Right:
99 case Qt::Key_Space:
100 Q_EMIT activated();
101 return;
102 default:
103 break;
104 }
105
106 QLabel::keyPressEvent(e);
107}
void activated()
Emitted when activated, by mouse or key press.

References activated().

◆ leftClicked

void KDcrawIface::RClickLabel::leftClicked ( )
signal

Emitted when activated by left mouse click.

◆ mousePressEvent()

void KDcrawIface::RClickLabel::mousePressEvent ( QMouseEvent * event)
overrideprotected

Definition at line 67 of file rexpanderbox.cpp.

68{
69 QLabel::mousePressEvent(event);
70
71 /*
72 * In some contexts, like QGraphicsView, there will be no
73 * release event if the press event was not accepted.
74 */
75 if (event->button() == Qt::LeftButton)
76 {
77 event->accept();
78 }
79}

◆ mouseReleaseEvent()

void KDcrawIface::RClickLabel::mouseReleaseEvent ( QMouseEvent * event)
overrideprotected

Definition at line 81 of file rexpanderbox.cpp.

82{
83 QLabel::mouseReleaseEvent(event);
84
85 if (event->button() == Qt::LeftButton)
86 {
87 Q_EMIT leftClicked();
88 Q_EMIT activated();
89 event->accept();
90 }
91}
void leftClicked()
Emitted when activated by left mouse click.

References activated(), and leftClicked().


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