-
-
Notifications
You must be signed in to change notification settings - Fork 88
/
Copy pathspinnableawesomebutton.cpp
47 lines (39 loc) · 1.03 KB
/
spinnableawesomebutton.cpp
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
46
47
#include "spinnableawesomebutton.h"
#include "theme.h"
SpinnableAwesomeButton::SpinnableAwesomeButton(QWidget *parent) :
QWidget(parent)
{
setFixedSize(Theme::toolIconSize, Theme::toolIconSize);
m_button = new QPushButton(this);
Theme::initAwesomeButton(m_button);
m_spinner = new WaitingSpinnerWidget(this);
m_spinner->setColor(Theme::white);
m_spinner->setInnerRadius(Theme::toolIconSize / 8);
m_spinner->setLineLength(Theme::toolIconSize / 4);
m_spinner->setNumberOfLines(9);
m_spinner->hide();
}
void SpinnableAwesomeButton::setAwesomeIcon(QChar c)
{
m_button->setText(c);
}
void SpinnableAwesomeButton::showSpinner(bool showSpinner)
{
if (showSpinner) {
m_spinner->start();
m_spinner->show();
m_button->hide();
} else {
m_spinner->stop();
m_spinner->hide();
m_button->show();
}
}
QPushButton *SpinnableAwesomeButton::button()
{
return m_button;
}
bool SpinnableAwesomeButton::isSpinning()
{
return m_spinner->isVisible();
}