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

Method UpdateCountColumn

win/Qt/qt_menu.cpp:456–484  ·  view source on GitHub ↗

got a bigger count than previously; might need to widen column 0 (or possibly had all counts removed and need to shrink column 0)

Source from the content-addressed store, hash-verified

454// got a bigger count than previously; might need to widen column 0
455// (or possibly had all counts removed and need to shrink column 0)
456void NetHackQtMenuWindow::UpdateCountColumn(long newcount)
457{
458 if (newcount < 0L) {
459 // this will happen if user clicks on [all],[none],[invert] buttons;
460 // they clear all pending counts while selecting or unselecting
461 biggestcount = 0L;
462 countdigits = 0;
463 table->setColumnWidth(0, 0);
464 WidenColumn(0, MENU_WIDTH_SLOP);
465 } else {
466 biggestcount = std::max(biggestcount, newcount);
467 QString num;
468 num = nh_qsprintf("%*ld", std::max(countdigits, 1), biggestcount);
469 int numlen = (int) num.length();
470 if (numlen % 2)
471 ++numlen;
472 if (numlen <= countdigits)
473 return;
474 countdigits = numlen;
475 // FIXME: neither adjusting the table size (below) nor the
476 // menu widget size (also below) is making the menu widget
477 // bigger after the count column has been expanded
478 }
479
480 PadMenuColumns(false);
481
482 MenuResize();
483 table->repaint();
484}
485
486void NetHackQtMenuWindow::SetTwiAttr(QTableWidgetItem *twi, int color, int attr)
487{

Callers

nothing calls this directly

Calls 2

nh_qsprintfFunction · 0.85
repaintMethod · 0.60

Tested by

no test coverage detected