-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcategorybutton.cpp
More file actions
46 lines (35 loc) · 957 Bytes
/
categorybutton.cpp
File metadata and controls
46 lines (35 loc) · 957 Bytes
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
43
44
45
#include "categorybutton.h"
CategoryButton::CategoryButton(const QString& text, QWidget *parent) :
QPushButton(parent)
,m_State(CLOSED)
{
m_IconOpened.addPixmap(QPixmap(":/resources/opened.png"));
m_IconClosed.addPixmap(QPixmap(":/resources/closed.png"));
this->setText(text);
this->setIcon(m_IconClosed);
this->setStyleSheet("text-align: left; padding-left: 5px;");
this->setFixedHeight(24);
connect( this, SIGNAL(clicked()), this, SLOT(SlotClicked()) );
}
CategoryButton::~CategoryButton()
{
}
const CategoryButton::ButtonState& CategoryButton::GetButtonState()
{
return m_State;
}
void CategoryButton::SlotClicked()
{
if(m_State == OPEN)
{
m_State = CLOSED;
this->setIcon(m_IconClosed);
emit SignalButtonState(m_State);
}
else if(m_State == CLOSED)
{
m_State = OPEN;
this->setIcon(m_IconOpened);
emit SignalButtonState(m_State);
}
}