From f05a9f956cb9de8b6949821de2d4e35d63eda07f Mon Sep 17 00:00:00 2001 From: PatR Date: Fri, 14 Jan 2022 22:42:41 -0800 Subject: [PATCH] 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. --- src/shk.c | 2 +- win/Qt/qt_bind.cpp | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/shk.c b/src/shk.c index 3b8dfc953..a33bf46ee 100644 --- a/src/shk.c +++ b/src/shk.c @@ -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; diff --git a/win/Qt/qt_bind.cpp b/win/Qt/qt_bind.cpp index ac1d91ade..3557cec4b 100644 --- a/win/Qt/qt_bind.cpp +++ b/win/Qt/qt_bind.cpp @@ -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();