2011-02-27 09:11:01 +00:00
|
|
|
bool pRadioItem::checked() {
|
|
|
|
return qtAction->isChecked();
|
|
|
|
}
|
|
|
|
|
|
|
|
void pRadioItem::setChecked() {
|
|
|
|
locked = true;
|
2012-04-24 13:13:42 +00:00
|
|
|
for(auto &item : radioItem.state.group) {
|
2011-02-27 09:11:01 +00:00
|
|
|
bool checkState = item.p.qtAction == qtAction;
|
|
|
|
item.state.checked = checkState;
|
|
|
|
item.p.qtAction->setChecked(checkState);
|
|
|
|
}
|
|
|
|
locked = false;
|
|
|
|
}
|
|
|
|
|
2012-06-25 12:49:39 +00:00
|
|
|
void pRadioItem::setGroup(const set<RadioItem&> &group) {
|
2011-02-27 09:11:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void pRadioItem::setText(const string &text) {
|
|
|
|
qtAction->setText(QString::fromUtf8(text));
|
|
|
|
}
|
|
|
|
|
|
|
|
void pRadioItem::constructor() {
|
|
|
|
qtAction = new QAction(0);
|
|
|
|
qtGroup = new QActionGroup(0);
|
|
|
|
qtAction->setCheckable(true);
|
|
|
|
qtAction->setActionGroup(qtGroup);
|
|
|
|
qtAction->setChecked(true);
|
2012-04-24 13:13:42 +00:00
|
|
|
connect(qtAction, SIGNAL(triggered()), SLOT(onActivate()));
|
2011-02-27 09:11:01 +00:00
|
|
|
}
|
|
|
|
|
2012-04-24 13:13:42 +00:00
|
|
|
void pRadioItem::destructor() {
|
|
|
|
if(action.state.menu) action.state.menu->remove(radioItem);
|
|
|
|
delete qtAction;
|
|
|
|
}
|
|
|
|
|
|
|
|
void pRadioItem::onActivate() {
|
2011-02-27 09:11:01 +00:00
|
|
|
if(radioItem.state.checked == false) {
|
|
|
|
setChecked();
|
2012-04-24 13:13:42 +00:00
|
|
|
if(locked == false && radioItem.onActivate) radioItem.onActivate();
|
2011-02-27 09:11:01 +00:00
|
|
|
}
|
|
|
|
}
|