add a toolbar button to invoke command 'name' via function '(*func)()'
| 928 | |
| 929 | // add a toolbar button to invoke command 'name' via function '(*func)()' |
| 930 | void NetHackQtMainWindow::AddToolButton(QToolBar *toolbar, QSignalMapper *sm, |
| 931 | const char *name, int (*func)(void), |
| 932 | QPixmap xpm) |
| 933 | { |
| 934 | char actchar[2]; |
| 935 | uchar key; |
| 936 | |
| 937 | key = (uchar) cmd_from_func(func); |
| 938 | |
| 939 | // if key is valid, add a button for it; otherwise omit the command |
| 940 | // (won't work as intended if a different command is bound to same key) |
| 941 | if (key) { |
| 942 | QToolButton *tb = new SmallToolButton(xpm, QString(name), "Action", |
| 943 | sm, SLOT(map()), toolbar); |
| 944 | actchar[0] = '\0'; |
| 945 | sm->setMapping(tb, strkitten(actchar, (char) key)); |
| 946 | toolbar->addWidget(tb); |
| 947 | } |
| 948 | } |
| 949 | |
| 950 | void NetHackQtMainWindow::zoomMap() |
| 951 | { |
nothing calls this directly
no test coverage detected