Qt screen layout
Simplify a recent change to the screen layout. Qt can calculate the details and the recent code resulted in a slight amount of blank space between the paperdoll and its resize hotspot. Fix an off-by-one bug in the paperdoll resize routine. (The one pixel margin at the top was being overlooked.)
This commit is contained in:
@@ -222,13 +222,13 @@ QSize NetHackQtInvUsageWindow::sizeHint(void) const
|
||||
if (iflags.wc_ascii_map)
|
||||
qt_settings->doll_is_shown = false;
|
||||
if (qt_settings->doll_is_shown) {
|
||||
w = (1 + qt_settings->dollWidth + 1) * 3;
|
||||
h = (1 + qt_settings->dollHeight + 1) * 6;
|
||||
w += (1 + qt_settings->dollWidth + 1) * 3;
|
||||
h += (1 + qt_settings->dollHeight + 1) * 6;
|
||||
}
|
||||
#else
|
||||
if (iflags.wc_tiled_map) {
|
||||
w = (1 + qt_settings->glyphs().width() + 1) * 3;
|
||||
h = (1 + qt_settings->glyphs().height() + 1) * 6;
|
||||
w += (1 + qt_settings->glyphs().width() + 1) * 3;
|
||||
h += (1 + qt_settings->glyphs().height() + 1) * 6;
|
||||
}
|
||||
#endif
|
||||
return QSize(w, h);
|
||||
|
||||
@@ -1140,12 +1140,9 @@ void NetHackQtMainWindow::layout()
|
||||
#endif
|
||||
// reset widths
|
||||
int w = width(); /* of main window */
|
||||
// 10: approximate size of resizing hotspots
|
||||
int d = qt_settings->doll_is_shown ? 10 + invusage->width() + 10 : 10;
|
||||
if (d % 4)
|
||||
d += 4 - d % 4;
|
||||
int d = invusage->width();
|
||||
splittersizes[2] = w / 2 - (d * 1 / 4); // status
|
||||
splittersizes[1] = d - 10; // invusage
|
||||
splittersizes[1] = d; // invusage
|
||||
splittersizes[0] = w / 2 - (d * 3 / 4); // messages
|
||||
hsplitter->setSizes(splittersizes);
|
||||
}
|
||||
@@ -1173,7 +1170,9 @@ void NetHackQtMainWindow::resizePaperDoll(bool showdoll)
|
||||
}
|
||||
|
||||
// Height limit is 48+2 pixels per doll cell plus 1 pixel margin at top;
|
||||
// values greater than 42+2 need taller window which pushes the map down.
|
||||
// values greater than 44+2 need taller window which pushes the map down
|
||||
// (when font size 'Large' is used for messages and status; threshold
|
||||
// may vary by 1 or 2 for other sizes).
|
||||
// FIXME: this doesn't shrink the window back if size is reduced from 45+
|
||||
int oldheight = vsplittersizes[0],
|
||||
newheight = w->height();
|
||||
|
||||
Reference in New Issue
Block a user