| 1 |
namespace phoenix { |
| 2 |
|
| 3 |
void pCheckItem::setChecked(bool checked) { |
| 4 |
qtAction->setChecked(checked); |
| 5 |
} |
| 6 |
|
| 7 |
void pCheckItem::setText(string text) { |
| 8 |
qtAction->setText(QString::fromUtf8(text)); |
| 9 |
} |
| 10 |
|
| 11 |
void pCheckItem::constructor() { |
| 12 |
qtAction = new QAction(0); |
| 13 |
qtAction->setCheckable(true); |
| 14 |
connect(qtAction, SIGNAL(triggered()), SLOT(onToggle())); |
| 15 |
} |
| 16 |
|
| 17 |
void pCheckItem::destructor() { |
| 18 |
if(action.state.menu) action.state.menu->remove(checkItem); |
| 19 |
delete qtAction; |
| 20 |
qtAction = nullptr; |
| 21 |
} |
| 22 |
|
| 23 |
void pCheckItem::onToggle() { |
| 24 |
checkItem.state.checked = qtAction->isChecked(); |
| 25 |
if(checkItem.onToggle) checkItem.onToggle(); |
| 26 |
} |
| 27 |
|
| 28 |
} |