| 74 | } |
| 75 | |
| 76 | int NetHackQtMenuListBox::TotalHeight() const |
| 77 | { |
| 78 | int row, rowheight, height = 0; |
| 79 | |
| 80 | for (row = 0; row < rowCount(); ++row) { |
| 81 | height += rowHeight(row); |
| 82 | } |
| 83 | // 20: arbitrary; should always have at least 1 row so it shouldn't matter |
| 84 | rowheight = (row > 0) ? rowHeight(row - 1) : 20; |
| 85 | |
| 86 | // |
| 87 | // FIXME: |
| 88 | // The core reuses one window for inventory displays and this |
| 89 | // part of sizeHint() is working for the initial size but is |
| 90 | // ineffective for later resizes. |
| 91 | // |
| 92 | |
| 93 | // TEMPORARY: |
| 94 | // in case first inventory menu displayed is a short one pad it |
| 95 | // with blank lines so later long ones won't be far too short |
| 96 | if ((dynamic_cast <NetHackQtMenuWindow *> (parent()))->is_invent) { |
| 97 | if (row < 15) |
| 98 | height += (15 - row) * rowheight; |
| 99 | } |
| 100 | |
| 101 | // include extra height so that there will be a blank gap after the |
| 102 | // last entry to show that there is nothing to scroll forward too |
| 103 | height += rowheight / 2; |
| 104 | return height; |
| 105 | } |
| 106 | |
| 107 | QSize NetHackQtMenuListBox::sizeHint() const |
| 108 | { |