Freeciv21
Develop your civilization from humble roots to a global empire
report_widget.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Freeciv21 and Freeciv contributors
3  * SPDX-FileCopyrightText: Louis Moureaux <m_louis30@yahoo.com>
4  *
5  * SPDX-License-Identifier: GPLv3-or-later
6  */
7 
8 #pragma once
9 
10 // common
11 #include "events.h"
12 
13 // client
14 #include "widgets/decorations.h"
15 
16 class QLabel;
17 
18 namespace freeciv {
19 
20 class report_widget : public fcwidget {
21  Q_OBJECT
22 
23 public:
24  report_widget(const QString &caption, const QString &headline,
25  const QString &lines, QWidget *parent = nullptr);
26  ~report_widget() override = default;
27 
29  QString caption() const { return m_caption; }
30 
32  QString headline() const { return m_headline; }
33 
34  void update_menu() override;
35 
36 protected:
37  void mousePressEvent(QMouseEvent *event) override;
38  void mouseMoveEvent(QMouseEvent *event) override;
39  void mouseReleaseEvent(QMouseEvent *event) override;
40  bool event(QEvent *event) override;
41 
42 private:
44  QPoint m_cursor;
45  QLabel *m_contents;
46 };
47 
48 } // namespace freeciv
Widget used to display the demographics, top 5 cities, and travelers' reports.
Definition: report_widget.h:20
void mouseReleaseEvent(QMouseEvent *event) override
Reimplemented to let the user drag the widget.
report_widget(const QString &caption, const QString &headline, const QString &lines, QWidget *parent=nullptr)
Creates a report widget displaying the provided text.
void mousePressEvent(QMouseEvent *event) override
Reimplemented to let the user drag the widget.
void mouseMoveEvent(QMouseEvent *event) override
Reimplemented to let the user drag the widget.
~report_widget() override=default
void update_menu() override
Called when the close button is pressed.
QString headline() const
Returns back the headline passed to the constructor.
Definition: report_widget.h:32
QString caption() const
Returns back the caption passed to the constructor.
Definition: report_widget.h:29
bool event(QEvent *event) override
Overridden to handle font changes.
Definition: path.cpp:10
char * lines
Definition: packhand.cpp:131