warning fixes

unpaid_cost():  'shkp' might be used without being initialized.  That
sort of warning is sometimes wrong but was correct in this instance.

qt_Splash():  the Qt 6.2 warning suggests switching the argument for
setMask() from QBitmap() to fromPixmap() but that doesn't work with
5.11.  However, switching from setMask() to setPixmap() does work,
and results in a crisp splash image instead of the fuzzy one I
recently complained about.  I've no idea what the right QT_VERSION
check ought to be but another QLabel propery is documented as "added
in 4.2" and the pixmap one has no such mention so I picked Qt < 4
for the code that's been in use and Qt >= 4 for the new code.
This commit is contained in:
PatR
2022-01-14 22:42:41 -08:00
parent 689aed55ca
commit f05a9f956c
2 changed files with 8 additions and 1 deletions

View File

@@ -2420,7 +2420,7 @@ unpaid_cost(
boolean include_contents)
{
struct bill_x *bp = (struct bill_x *) 0;
struct monst *shkp;
struct monst *shkp = 0;
char *shop;
long amt = 0L;

View File

@@ -125,7 +125,14 @@ NetHackQtBind::qt_Splash()
vb->addWidget(capt);
capt->setAlignment(Qt::AlignCenter);
lsplash->setFixedSize(pm.size());
#if QT_VERSION < 0x040000
// if used on 5.11, this produces a fuzzy image
lsplash->setMask(QBitmap(pm));
#else
// required for 6.2; on 5.11, this produces a crisp image
lsplash->setPixmap(pm);
#endif
#if QT_VERSION < 0x060000
QSize screensize = QApplication::desktop()->size();