MCPcopy Create free account
hub / github.com/NetHack/NetHack / layout

Method layout

win/Qt/qt_main.cpp:1191–1245  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1189}
1190
1191void NetHackQtMainWindow::layout()
1192{
1193#if 0
1194 if ( qt_compact_mode )
1195 return;
1196 if (message && map && status) {
1197 QSize maxs=map->Widget()->maximumSize();
1198 int maph=std::min(height()*2/3,maxs.height());
1199
1200 QWidget* c = centralWidget();
1201 int h=c->height();
1202 int toph=h-maph;
1203 int iuw=3*qt_settings->glyphs().width();
1204 int topw=(c->width()-iuw)/2;
1205
1206 message->Widget()->setGeometry(0,0,topw,toph);
1207 invusage->setGeometry(topw,0,iuw,toph);
1208 status->Widget()->setGeometry(topw+iuw,0,topw,toph);
1209 map->Widget()->setGeometry(std::max(0,(c->width()-maxs.width())/2),
1210 toph,c->width(),maph);
1211 }
1212#endif
1213
1214 if (qt_settings && !qt_compact_mode
1215 && map && message && status && invusage) {
1216 // For the initial PaperDoll sizing, message window
1217 // and/or status window might still be empty;
1218 // widen them before changing PaperDoll to use saved settings.
1219 QList<int> splittersizes = hsplitter->sizes();
1220#define MIN_WIN_WIDTH 400
1221 if (splittersizes[0] < MIN_WIN_WIDTH
1222 || splittersizes[2] < MIN_WIN_WIDTH) {
1223 if (splittersizes[0] < MIN_WIN_WIDTH)
1224 splittersizes[0] = MIN_WIN_WIDTH;
1225#ifndef ENHANCED_PAPERDOLL
1226 if (splittersizes[1] < 6) // TILEWMIN
1227 splittersizes[1] = 16; // 16x16
1228#endif
1229 if (splittersizes[2] < MIN_WIN_WIDTH)
1230 splittersizes[2] = MIN_WIN_WIDTH;
1231 hsplitter->setSizes(splittersizes);
1232 }
1233#ifdef ENHANCED_PAPERDOLL
1234 // call resizePaperDoll() indirectly...
1235 qt_settings->resizeDoll();
1236#endif
1237 // reset widths
1238 int w = width(); /* of main window */
1239 int d = invusage->width();
1240 splittersizes[2] = w / 2 - (d * 1 / 4); // status
1241 splittersizes[1] = d; // invusage
1242 splittersizes[0] = w / 2 - (d * 3 / 4); // messages
1243 hsplitter->setSizes(splittersizes);
1244 }
1245}
1246
1247#ifdef DYNAMIC_STATUSLINES
1248// called when 'statuslines' changes from 2 to 3 or vice versa; simpler to

Callers 1

qt_plsel.cppFile · 0.45

Calls 4

resizeDollMethod · 0.80
WidgetMethod · 0.45
heightMethod · 0.45
widthMethod · 0.45

Tested by

no test coverage detected