From 7310084692f956e7b904b4f9f1de3dcbade2529b Mon Sep 17 00:00:00 2001 From: PatR Date: Mon, 10 Aug 2020 16:39:30 -0700 Subject: [PATCH] Qt menu tweak An earlier tweak worked to prevent unnecessary line wrapping for ^X output in a menu, but #enhance and '+' both had problems with their last column. This seems to work better but is still based on thrashing about rather than knowledge of how things are supposed to operate. --- win/Qt/qt_menu.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/win/Qt/qt_menu.cpp b/win/Qt/qt_menu.cpp index aad4d5885..53b09d6ff 100644 --- a/win/Qt/qt_menu.cpp +++ b/win/Qt/qt_menu.cpp @@ -242,6 +242,7 @@ int NetHackQtMenuWindow::SelectMenu(int h, MENU_ITEM_P **menu_list) AddRow(i, itemlist[i]); } +#define MENU_WIDTH_SLOP 10 /* this should not be necessary */ // Determine column widths std::vector col_widths; for (std::size_t i = 0; i < (size_t) itemlist.size(); ++i) { @@ -255,8 +256,7 @@ int NetHackQtMenuWindow::SelectMenu(int h, MENU_ITEM_P **menu_list) QTableWidgetItem *twi = table->item(i, 4); if (twi) { QString text = twi->text(); -#define MENU_WIDTH_SLOP 20 /* this should not be necessary */ - WidenColumn(4, fm.width(text) + MENU_WIDTH_SLOP); + WidenColumn(4, fm.width(text)); } continue; } @@ -285,7 +285,7 @@ int NetHackQtMenuWindow::SelectMenu(int h, MENU_ITEM_P **menu_list) } text = columns.join(""); twi->setText(text); - WidenColumn(4, fm.width(text)); + WidenColumn(4, fm.width(text) + MENU_WIDTH_SLOP); } // FIXME: size for compact mode