| 1228 | } |
| 1229 | |
| 1230 | static QAction *insert_action_after (QWidget *widget, QAction *after, QAction *action) |
| 1231 | { |
| 1232 | QList<QAction *> actions = widget->actions (); |
| 1233 | |
| 1234 | QAction *before = 0; |
| 1235 | if (after == 0) { |
| 1236 | if (! actions.isEmpty ()) { |
| 1237 | before = actions.front (); |
| 1238 | } |
| 1239 | } else { |
| 1240 | int index = actions.indexOf (after); |
| 1241 | if (index >= 0 && index + 1 < actions.size ()) { |
| 1242 | before = actions [index + 1]; |
| 1243 | } |
| 1244 | } |
| 1245 | widget->insertAction (before, action); |
| 1246 | |
| 1247 | return action; |
| 1248 | } |
| 1249 | |
| 1250 | static const std::string s_extras_menu_name ("_extras_menu"); |
| 1251 | |