Changeset View
Changeset View
Standalone View
Standalone View
src/irc/modebutton.cpp
Show All 18 Lines | |||||
19 | { | 19 | { | ||
20 | id=newId; | 20 | id=newId; | ||
21 | on=false; | 21 | on=false; | ||
22 | setText(label); | 22 | setText(label); | ||
23 | setCheckable(true); | 23 | setCheckable(true); | ||
24 | connect(this, &ModeButton::clicked, this, &ModeButton::wasClicked); | 24 | connect(this, &ModeButton::clicked, this, &ModeButton::wasClicked); | ||
25 | } | 25 | } | ||
26 | 26 | | |||
27 | ModeButton::~ModeButton() | 27 | ModeButton::~ModeButton() = default; | ||
28 | { | | |||
29 | } | | |||
30 | 28 | | |||
31 | void ModeButton::setOn(bool state) | 29 | void ModeButton::setOn(bool state) | ||
32 | { | 30 | { | ||
33 | on=state; | 31 | on=state; | ||
34 | QToolButton::setChecked(state); | 32 | QToolButton::setChecked(state); | ||
35 | } | 33 | } | ||
36 | 34 | | |||
37 | void ModeButton::wasClicked() | 35 | void ModeButton::wasClicked() | ||
38 | { | 36 | { | ||
39 | emit clicked(id,!on); | 37 | emit clicked(id,!on); | ||
40 | // Keep button in old state, since we don't know if mode change will | 38 | // Keep button in old state, since we don't know if mode change will | ||
41 | // eventually work. If we aren't channel operator, it won't. | 39 | // eventually work. If we aren't channel operator, it won't. | ||
42 | setOn(on); | 40 | setOn(on); | ||
43 | } | 41 | } | ||
44 | 42 | | |||
45 | 43 | |