7 std::vector<QAction*>
GetActions(QList<QAction*> acts)
9 std::vector<QAction*> res;
10 QList<QAction*>::iterator it;
12 for(it=acts.begin(); it != acts.end(); ++it)
13 if((*it)->menu() == 0 && !((*it)->text().isEmpty()) && !(*it)->icon().isNull())
20 QAbstractTableModel(parent)
31 return Qt::ItemIsEnabled | Qt::ItemIsUserCheckable;
41 case Qt::TextAlignmentRole:
42 return int(Qt::AlignVCenter | Qt::AlignLeft);
47 QString name = m_actions[index.row()]->objectName();
48 int pos = name.lastIndexOf(
".");
50 return (pos < 0) ? m_actions[index.row()]->text() : name.mid(pos+1);
54 case Qt::DecorationRole:
55 return m_actions[index.row()]->icon();
58 case Qt::CheckStateRole:
59 return (m_actionsActivation[index.row()]) ? Qt::Checked : Qt::Unchecked;
80 return (
int)m_actions.size();
90 if(role == Qt::CheckStateRole)
91 m_actionsActivation[r] = (value.toInt() == Qt::Checked) ?
true :
false;
93 QAction* act = m_actions[r];
94 bool toAdd = m_actionsActivation[r];
96 emit updateAction(act, toAdd);
103 QList<QAction*>::const_iterator it;
105 m_actionsActivation.clear();
106 m_actionsActivation = std::vector<bool>(m_actions.size(),
false);
108 for(it = acts.begin(); it != acts.end(); ++it)
110 for(
size_t i=0; i<m_actions.size(); i++)
111 if((*it) == m_actions[i])
112 m_actionsActivation[i] =
true;
115 #if (QT_VERSION < 0x050000)
125 QList<QAction*> acts = mnuBar->findChildren<QAction*>();
128 m_actionsActivation = std::vector<bool>(m_actions.size(),
false);
130 #if (QT_VERSION < 0x050000)