1 | /* $Id: UIErrorPane.cpp 98103 2023-01-17 14:15:46Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Qt GUI - UIErrorPane class implementation.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2010-2023 Oracle and/or its affiliates.
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox base platform packages, as
|
---|
10 | * available from https://www.virtualbox.org.
|
---|
11 | *
|
---|
12 | * This program is free software; you can redistribute it and/or
|
---|
13 | * modify it under the terms of the GNU General Public License
|
---|
14 | * as published by the Free Software Foundation, in version 3 of the
|
---|
15 | * License.
|
---|
16 | *
|
---|
17 | * This program is distributed in the hope that it will be useful, but
|
---|
18 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
20 | * General Public License for more details.
|
---|
21 | *
|
---|
22 | * You should have received a copy of the GNU General Public License
|
---|
23 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
24 | *
|
---|
25 | * SPDX-License-Identifier: GPL-3.0-only
|
---|
26 | */
|
---|
27 |
|
---|
28 | /* Qt includes: */
|
---|
29 | #include <QTextBrowser>
|
---|
30 | #include <QVBoxLayout>
|
---|
31 |
|
---|
32 | /* GUI includes: */
|
---|
33 | #include "UIErrorPane.h"
|
---|
34 |
|
---|
35 |
|
---|
36 | UIErrorPane::UIErrorPane(QWidget *pParent /* = 0 */)
|
---|
37 | : QWidget(pParent)
|
---|
38 | , m_pBrowserDetails(0)
|
---|
39 | {
|
---|
40 | prepare();
|
---|
41 | }
|
---|
42 |
|
---|
43 | void UIErrorPane::setErrorDetails(const QString &strDetails)
|
---|
44 | {
|
---|
45 | /* Redirect to details browser: */
|
---|
46 | m_pBrowserDetails->setText(strDetails);
|
---|
47 | }
|
---|
48 |
|
---|
49 | void UIErrorPane::prepare()
|
---|
50 | {
|
---|
51 | /* Prepare main layout: */
|
---|
52 | QVBoxLayout *pMainLayout = new QVBoxLayout(this);
|
---|
53 | if (pMainLayout)
|
---|
54 | {
|
---|
55 | pMainLayout->setContentsMargins(0, 0, 0, 0);
|
---|
56 |
|
---|
57 | /* Prepare details browser: */
|
---|
58 | m_pBrowserDetails = new QTextBrowser;
|
---|
59 | if (m_pBrowserDetails)
|
---|
60 | {
|
---|
61 | m_pBrowserDetails->setFocusPolicy(Qt::StrongFocus);
|
---|
62 | m_pBrowserDetails->document()->setDefaultStyleSheet("a { text-decoration: none; }");
|
---|
63 |
|
---|
64 | /* Add into layout: */
|
---|
65 | pMainLayout->addWidget(m_pBrowserDetails);
|
---|
66 | }
|
---|
67 | }
|
---|
68 | }
|
---|