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

@@ -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);