src/uiutilities.cpp

changeset 259
c27612f0eac0
parent 178
a23024fc98e0
child 264
76a025db4948
equal deleted inserted replaced
258:fe094d0687ad 259:c27612f0eac0
15 * You should have received a copy of the GNU General Public License 15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>. 16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */ 17 */
18 18
19 #include <QStyleFactory> 19 #include <QStyleFactory>
20 #include <QWidget>
20 #include "uiutilities.h" 21 #include "uiutilities.h"
21 22
22 QVector<QAction*> uiutilities::collectActions(QObject* subject) 23 std::vector<QAction*> uiutilities::collectActions(QObject* subject)
23 { 24 {
24 QVector<QAction*> actions; 25 std::vector<QAction*> actions;
25 for (QAction* action : subject->findChildren<QAction*>()) 26 for (QAction* action : subject->findChildren<QAction*>())
26 { 27 {
27 if (not action->text().isEmpty() 28 if (not action->text().isEmpty()
28 and action->data().isNull() 29 and action->data().isNull()
29 and not action->objectName().isEmpty()) 30 and not action->objectName().isEmpty())
32 } 33 }
33 } 34 }
34 return actions; 35 return actions;
35 } 36 }
36 37
37 uiutilities::KeySequenceMap uiutilities::makeKeySequenceMap(const QVector<QAction*>& actions) 38 uiutilities::KeySequenceMap uiutilities::makeKeySequenceMap(const std::vector<QAction*>& actions)
38 { 39 {
39 KeySequenceMap result; 40 KeySequenceMap result;
40 for (QAction* action : actions) 41 for (QAction* action : actions)
41 { 42 {
42 result[action->objectName()] = action->shortcut(); 43 result[action->objectName()] = action->shortcut();

mercurial