MCPcopy Index your code
hub / github.com/NetHack/NetHack / AddToolButton

Method AddToolButton

win/Qt/qt_main.cpp:930–948  ·  view source on GitHub ↗

add a toolbar button to invoke command 'name' via function '(*func)()'

Source from the content-addressed store, hash-verified

928
929// add a toolbar button to invoke command 'name' via function '(*func)()'
930void 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
950void NetHackQtMainWindow::zoomMap()
951{

Callers

nothing calls this directly

Calls 2

cmd_from_funcFunction · 0.85
strkittenFunction · 0.85

Tested by

no test coverage detected