Crossfire Server, Trunk
CREReportDisplay.cpp
Go to the documentation of this file.
1 /*
2  * Crossfire -- cooperative multi-player graphical RPG and adventure game
3  *
4  * Copyright (c) 2022 the Crossfire Development Team
5  *
6  * Crossfire is free software and comes with ABSOLUTELY NO WARRANTY. You are
7  * welcome to redistribute it under certain conditions. For details, please
8  * see COPYING and LICENSE.
9  *
10  * The authors can be reached via e-mail at <crossfire@metalforge.org>.
11  */
12 
13 #include "CREReportDisplay.h"
14 #include <QtWidgets>
15 
16 CREReportDisplay::CREReportDisplay(const QString& report, const QString& title)
17 {
18  myReport = report;
19 
20  setWindowTitle(title);
21 
22  QVBoxLayout* layout = new QVBoxLayout(this);
23 
24  QTextEdit* view = new QTextEdit(this);
25  view->setReadOnly(true);
26  view->setText(report);
27  layout->addWidget(view);
28 
29  QHBoxLayout* buttons = new QHBoxLayout();
30  layout->addLayout(buttons);
31 
32  QPushButton* copy = new QPushButton(tr("Copy (HTML)"), this);
33  buttons->addWidget(copy);
34  connect(copy, SIGNAL(clicked(bool)), this, SLOT(copyClicked(bool)));
35 
36  QPushButton* close = new QPushButton(tr("Close"), this);
37  buttons->addWidget(close);
38  connect(close, SIGNAL(clicked(bool)), this, SLOT(closeClicked(bool)));
39 
40  setSizeGripEnabled(true);
41 }
42 
44 {
45  QApplication::clipboard()->setText(myReport);
46 }
47 
49 {
50  accept();
51 }
layout
Definition: main.cpp:84
report.report
def report(pl)
Definition: report.py:6
CREReportDisplay::myReport
QString myReport
Definition: CREReportDisplay.h:31
CREReportDisplay::closeClicked
void closeClicked(bool)
Definition: CREReportDisplay.cpp:48
CREReportDisplay.h
title
Definition: readable.cpp:108
CREReportDisplay::copyClicked
void copyClicked(bool)
Definition: CREReportDisplay.cpp:43
report
Definition: report.py:1
CREReportDisplay::CREReportDisplay
CREReportDisplay(const QString &report, const QString &title)
Definition: CREReportDisplay.cpp:16
connect
Definition: connect.py:1
altar_valkyrie.accept
def accept(description)
Definition: altar_valkyrie.py:22