Ejemplo n.º 1
0
void NetHackQtLabelledIcon::resizeEvent(QResizeEvent*)
{
    setAlignments();

    //int labw=label ? label->fontMetrics().width(label->text()) : 0;
    int labh=label ? label->fontMetrics().height() : 0;
    int icoh=icon ? icon->height() : 0;
    int h=icoh+labh;
    int icoy=(h>height() ? height()-labh-icoh : height()/2-h/2);
    int laby=icoy+icoh;
    if (icon) {
	icon->setGeometry(0,icoy,width(),icoh);
    }
    if (label) {
	label->setGeometry(0,laby,width(),labh);
    }
}
Ejemplo n.º 2
0
void TileInfo::setTile(std::shared_ptr<MapTile> tile, uint x, uint y) {
    clearText();
    setAlignments(Alignment::Top, Alignment::Left);

    std::stringstream line1, line2, line3, line4, line5;
    line1 << "Map tile at (" << x << ", " << y << ")";
    addLine(line1.str());

    // Blank line
    addLine("");

    line2 << "Temprature: " << tile->temp;
    addLine(line2.str());

    line3 << "Height: " << tile->height;
    addLine(line3.str());

    line4 << "Humidity: " << tile->humidity;
    addLine(line4.str());
}