MCPcopy Create free account
hub / github.com/NetHack/NetHack / enableButtons

Method enableButtons

win/Qt/qt_xcmd.cpp:594–611  ·  view source on GitHub ↗

Enable only buttons that match the current prompt string

Source from the content-addressed store, hash-verified

592
593// Enable only buttons that match the current prompt string
594void NetHackQtExtCmdRequestor::enableButtons()
595{
596 QString typedstr = prompt->text().mid(1); // skip the '#'
597 std::size_t len = typedstr.size();
598
599 // This used to look really bad when whole rows became empty: the
600 // grid shrank and the one line prompt area expanded to fill the
601 // vacated vertical space. Hiding whole columns looked bad too,
602 // remaining buttons were widened to take the space. Now the grid is
603 // forced to have fixed layout (via stretch settings in constructor).
604 for (auto b = buttons.begin(); b != buttons.end(); ++b) {
605 const QString &buttext = (*b)->text();
606 bool showit = (buttext.left(len) == typedstr
607 || (buttext.contains("(rest)")
608 && typedstr == rest.left(len)));
609 (*b)->setVisible(showit);
610 }
611}
612
613} // namespace nethack_qt_

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected