#pragma once #include #include #include class QLabel; // A caption with its value hard right and a horizontal fill bar beneath it. One part for // the three things the panel shows as a proportion: a construction site's progress, a // building's production cycle, and the HP of a ship, a station or the HQ // (REQ-UI-PRODUCTION-PROGRESS, REQ-UI-SHIP-STATS-PANEL, REQ-UI-STATION-STATS-PANEL, // REQ-UI-HQ-PANEL). // // The caption may be left empty, for a bar whose meaning is already given by the section // it sits in. class BarRow : public QWidget { Q_OBJECT public: explicit BarRow(const QString& caption, QWidget* parent = nullptr); // fraction is clamped to [0, 1]; valueText is shown beside the caption as-is, so a // bar can read "72%" or "340 / 500" as its meaning requires. void setValue(double fraction, const QString& valueText); // Overrides the fill color, which defaults to the palette's highlight. void setFillColor(const QColor& color); private: class Bar; QLabel* m_captionLabel; QLabel* m_valueLabel; Bar* m_bar; };