Enable only buttons that match the current prompt string
| 592 | |
| 593 | // Enable only buttons that match the current prompt string |
| 594 | void 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_ |
nothing calls this directly
no outgoing calls
no test coverage detected