From: PatR Date: Thu, 29 Oct 2020 01:07:27 +0000 (-0700) Subject: Qt character selection hackery X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f5a6267b3a856cb20b0db41f42806515f723b626;p=nethack Qt character selection hackery Tweak the Qt character selection widget format a bit. Forcing the 'logo' string to be taller has resulted in stretching the window enough to fit all the roles without a scrollbar. (On my monitor on my OSX system, that is. It won't necessarily be an improvement for anybody else but shouldn't break anything.) The TODO item about making it taller so that role list fits is still there. --- diff --git a/win/Qt/qt_plsel.cpp b/win/Qt/qt_plsel.cpp index a0c76ab4c..85e20ecf6 100644 --- a/win/Qt/qt_plsel.cpp +++ b/win/Qt/qt_plsel.cpp @@ -6,7 +6,8 @@ // // TODO: -// increase height so that no scrolling is needed for role list; +// increase height so that no scrolling is needed for role list [needs +// to be done properly instead of forcing logo string to be taller] // the [Random] button doesn't do anything; // make race first vs role first dynamically selectable (tty allows // gender first and alignment first too); @@ -63,8 +64,10 @@ namespace nethack_qt_ { void centerOnMain( QWidget* w ); // end temporary -static const char nh_attribution[] = "
NetHack %1" - "
by the NetHack DevTeam
"; +// hack: padded with blank lines by inserting breaks above and below in +// order to force window to be tall enough to show all the roles at once +static const char nh_attribution[] = "
NetHack %1" + "
by the NetHack DevTeam

"; class NhPSListViewItem : public QTableWidgetItem { public: @@ -214,9 +217,10 @@ NetHackQtPlayerSelector::NetHackQtPlayerSelector(NetHackQtKeyBuffer& ks UNUSED) this, SLOT(selectName(const QString&))); name->setFocus(); - QGroupBox* genderbox = new QGroupBox("Gender",this); + // changed to move gender and alignment labels inside their boxes (below) + QGroupBox *genderbox = new QGroupBox(); QButtonGroup *gendergroup = new QButtonGroup(this); - QGroupBox* alignbox = new QGroupBox("Alignment",this); + QGroupBox *alignbox = new QGroupBox(); QButtonGroup *aligngroup = new QButtonGroup(this); // these two QVBoxLayout pointers aren't used, the vertical box layouts // being assigned to them are... @@ -280,6 +284,12 @@ NetHackQtPlayerSelector::NetHackQtPlayerSelector(NetHackQtKeyBuffer& ks UNUSED) race->setHorizontalHeaderLabels(QStringList("Race")); race->resizeColumnToContents(0); + // TODO: render the alignment and gender labels smaller to match the + // horizontal header labels for role and race; getting the font from + // race table above and setting it for labels below made no difference + + QLabel *gendlabel = new QLabel("Gender"); + genderbox->layout()->addWidget(gendlabel); gender = new QRadioButton*[ROLE_GENDERS]; for (i=0; ilayout()->addWidget(alignlabel); alignment = new QRadioButton*[ROLE_ALIGNS]; for (i=0; i