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
3Pencil2D - Traditional Animation Software
4Copyright (C) 2012-2020 Matthew Chiawen Chang
5
6This program is free software; you can redistribute it and/or
7modify it under the terms of the GNU General Public License
8as published by the Free Software Foundation; version 2 of the License.
9
10This program is distributed in the hope that it will be useful,
11but WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13GNU 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
23ErrorDialog::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
47ErrorDialog::~ErrorDialog()
48{
49 delete ui;
50}
51
52void 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)
Generated on Thu May 8 2025 04:47:53 for Pencil2D by doxygen 1.9.6 based on revision 4513250b1d5b1a3676ec0e67b06b7a885ceaae39