Freeciv21
Develop your civilization from humble roots to a global empire
city_icon_widget.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2023 Louis Moureaux <m_louis30@yahoo.com>
3  *
4  * SPDX-License-Identifier: GPLv3-or-later
5  */
6 
7 #pragma once
8 
9 #include <QWidget>
10 
11 namespace freeciv {
12 
13 class city_icon_widget : public QWidget {
14  Q_OBJECT;
15 
16 public:
17  explicit city_icon_widget(QWidget *parent = nullptr);
18 
19  void set_city(int city_id);
20 
21  QSize sizeHint() const override;
22  QSize minimumSizeHint() const override;
23 
24 protected:
25  void paintEvent(QPaintEvent *event) override;
26  bool event(QEvent *event) override;
27 
28 private:
29  int m_city = -1;
30 };
31 
32 } // namespace freeciv
Displays an icon representing a city.
void set_city(int city_id)
Changes the city displayed by this widget.
bool event(QEvent *event) override
Reimplemented to handle tileset changes.
QSize sizeHint() const override
Reimplemented to pick the size from the tileset.
QSize minimumSizeHint() const override
Reimplemented to allow for tiny tileset.
void paintEvent(QPaintEvent *event) override
Reimplemented to draw the widget.
city_icon_widget(QWidget *parent=nullptr)
Constructor.
Definition: path.cpp:10