silence a Qt complaint

The save file selection widget was issuing a complaint to stderr:
|QLayout: Attempting to add QLayout "" to QDialog "", which already
| has a layout

This shuts that up, but doesn't fix the broken save file selection
so I haven't added a fixes37.0 entry.
This commit is contained in:
PatR
2020-09-17 02:49:37 -07:00
parent 5401d18c4b
commit 82689eb048
2 changed files with 36 additions and 17 deletions

View File

@@ -40,16 +40,21 @@ On the map, ^V is a dead key (at least on OSX; all other ASCII control
characters from ^A through ^U, ^W through ^Z, and ^[, ^\, ^], ^^, ^_
work; no attempt to have ^@ generate NUL has been made).
The save file selection widget at start of game issues a complaint to
stderr about adding a layout to a dialog which already has a layout,
similar to ones that YnDialog used to give for the count widget in
yn#aq dialogs. (That was resolved by inserting count in the middle
instead of trying to append to the end [without figuring out why Qt
was complaining--no doubt a Qt 2/3/4/5 issue], which is not a viable
solution for save file selection.) It also clobbers an existing save
file if you use a different name when starting a new game, then save.
The save file selection widget writes all the file name selection
buttons on top of each other, with the last one added being the only
one visible. Clicking on it seems to be picking the first one instead.
If you pick "new game" and use a different character name then
eventually save, it clobbers the last one in the list (rather, warns
the player that a save file exists and asks whether to overwrite it;
answering yes and then loading the file shows the new character, not
the original one even though the file is still named for that one).
Map column #0, which the core reserves for its own purposes and isn't
intended to be displayed, is displayed (as blank terrain).
3.7 status conditions haven't been implemented.
3.6 status conditions (Stone, Slime, Strngl, Deaf, Lev, Fly, Ride)
have been implemented but need icon artwork (one 40x40 tile for each).
-----

View File

@@ -26,24 +26,31 @@ NetHackQtSavedGameSelector::NetHackQtSavedGameSelector(const char** saved) :
QVBoxLayout *vbl = new QVBoxLayout(this);
QHBoxLayout* hb;
QLabel* logo = new QLabel(this); vbl->addWidget(logo);
#if 0 // this works but don't add it until the rest is working as intended
char cvers[BUFSZ];
QString qvers = QString("NetHack ") + QString(version_string(cvers));
QLabel* vers = new QLabel(qvers, this);
vers->setAlignment(Qt::AlignCenter);
vbl->addWidget(vers);
#endif
QLabel* logo = new QLabel(this);
logo->setAlignment(Qt::AlignCenter);
logo->setPixmap(QPixmap("nhsplash.xpm"));
vbl->addWidget(logo);
QLabel* attr = new QLabel("by the NetHack DevTeam",this);
attr->setAlignment(Qt::AlignCenter);
vbl->addWidget(attr);
vbl->addStretch(2);
/*
QLabel* logo = new QLabel(hb);
hb = new QHBox(this);
vbl->addWidget(hb, Qt::AlignCenter);
logo->setPixmap(QPixmap(nh_icon));
logo->setAlignment(AlignRight|Qt::AlignVCenter);
new QLabel(nh_attribution,hb);
*/
/* With Qt5, this next line triggers a complaint to stderr:
QLayout: Attempting to add QLayout "" to QDialog "", which already has a layout
hb = new QHBoxLayout(this);
*/
hb = new QHBoxLayout((QWidget *) NULL);
vbl->addLayout(hb, Qt::AlignCenter);
QPushButton* q = new QPushButton("Quit",this);
hb->addWidget(q);
connect(q, SIGNAL(clicked()), this, SLOT(reject()));
@@ -52,6 +59,13 @@ NetHackQtSavedGameSelector::NetHackQtSavedGameSelector(const char** saved) :
connect(c, SIGNAL(clicked()), this, SLOT(accept()));
c->setDefault(true);
//
// FIXME!
// The text "Saved Characters" is overwritten by all the
// filename buttons. The last button added is the only one
// visible but clicking on it seems to activate the first
// one instead.
//
QGroupBox* box = new QGroupBox("Saved Characters",this);
QButtonGroup *bg = new QButtonGroup(this);
vbl->addWidget(box);