Files
dota_factory/src/ui/selection/StatusPill.h

30 lines
885 B
C++

#pragma once
#include <QColor>
#include <QString>
#include <QWidget>
class QLabel;
// The card header's right slot (REQ-UI-SELECTION-CARD): a colored dot with a short
// caption beside it. It carries a building's production status
// (REQ-UI-SELECTION-STATUS), a ship's current behavior (REQ-UI-SHIP-BEHAVIOR), or an
// aggregated selection's object count (REQ-UI-SELECTION-AGGREGATE) -- never more than
// one of them, which is why they share one part.
class StatusPill : public QWidget
{
Q_OBJECT
public:
explicit StatusPill(QWidget* parent = nullptr);
// An invalid dot color leaves the dot off, for the slots that are a plain caption.
// An empty caption hides the pill entirely.
void setStatus(const QColor& dotColor, const QColor& outlineColor,
const QString& caption);
private:
QLabel* m_dotLabel;
QLabel* m_captionLabel;
};