Pencil2D Animation
Download
Community
News
Docs
Contribute
Overview
Articles
Code
Class List
Class Index
Class Hierarchy
Class Members
File List
Loading...
Searching...
No Matches
app
src
errordialog.cpp
1
/*
2
3
Pencil2D - Traditional Animation Software
4
Copyright (C) 2012-2020 Matthew Chiawen Chang
5
6
This program is free software; you can redistribute it and/or
7
modify it under the terms of the GNU General Public License
8
as published by the Free Software Foundation; version 2 of the License.
9
10
This program is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
GNU General Public License for more details.
14
15
*/
16
17
#include "errordialog.h"
18
#include "ui_errordialog.h"
19
20
#include <QPushButton>
21
#include <QClipboard>
22
23
ErrorDialog::ErrorDialog(
QString
title,
QString
description,
QString
details,
QWidget
*parent ) :
24
QDialog
( parent ),
25
ui(new Ui::
ErrorDialog
)
26
{
27
ui->
setupUi
(
this
);
28
29
setWindowTitle( title );
30
ui->title->setText(
QString
(
"<h3>%1</h3>"
).arg( title ) );
31
ui->description->setText( description );
32
if
( details.
isEmpty
() )
33
{
34
ui->details->setVisible(
false
);
35
}
36
else
37
{
38
ui->details->setText(
QString
(
"<pre>%1</pre>"
).arg( details ) );
39
}
40
41
QPushButton
* copyToClipboard =
new
QPushButton
(tr(
"Copy to Clipboard"
));
42
ui->buttonBox->addButton(copyToClipboard,
QDialogButtonBox::ActionRole
);
43
44
connect(copyToClipboard, &
QPushButton::clicked
,
this
, &ErrorDialog::onCopyToClipboard);
45
}
46
47
ErrorDialog::~ErrorDialog()
48
{
49
delete
ui;
50
}
51
52
void
ErrorDialog::onCopyToClipboard() {
53
QGuiApplication::clipboard
()->
setText
(ui->details->toPlainText());
54
}
ErrorDialog
Definition:
errordialog.h:28
QAbstractButton::clicked
void clicked(bool checked)
QClipboard::setText
void setText(const QString &text, QClipboard::Mode mode)
QDialog
QDialogButtonBox::ActionRole
ActionRole
QGuiApplication::clipboard
QClipboard * clipboard()
QPushButton
QString
QString::isEmpty
bool isEmpty() const const
QWidget
QWidget::setupUi
void setupUi(QWidget *widget)