Qt support for changing 'statuslines' dynamically

Turns out it was nearly as simple as I originally thought.
I just missed one significant detail the first time around.
This leaves DYNAMIC_STATUSLINES as conditionl but now enables
it by default.  Using 'O' to change 'statuslines' from 2 to 3
or vice versa now works for Qt as well as for curses and tty.
This commit is contained in:
PatR
2020-12-22 11:10:32 -08:00
parent 430edb5a74
commit 934808be0e
6 changed files with 19 additions and 21 deletions

View File

@@ -1180,14 +1180,14 @@ void NetHackQtMainWindow::layout()
}
}
#ifdef DYNAMIC_STATUSLINES // leave disabled; this doesn't work as intended
#ifdef DYNAMIC_STATUSLINES
// called when 'statuslines' changes from 2 to 3 or vice versa; simpler to
// destroy and recreate the status window than to adjust existing fields
void NetHackQtMainWindow::redoStatus()
NetHackQtWindow *NetHackQtMainWindow::redoStatus()
{
NetHackQtStatusWindow *oldstatus = this->status;
if (!oldstatus)
return; // not ready yet?
return NULL; // not ready yet?
this->status = new NetHackQtStatusWindow;
if (!qt_compact_mode)
@@ -1195,6 +1195,8 @@ void NetHackQtMainWindow::redoStatus()
delete oldstatus;
ShowIfReady();
return (NetHackQtWindow *) this->status;
}
#endif