Messagelib

developertoolwidget.cpp
1 /*
2  SPDX-FileCopyrightText: 2020-2024 Laurent Montel <montel@kde.org>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #include "developertoolwidget.h"
8 #include <QVBoxLayout>
9 #include <QWebEnginePage>
10 #include <QWebEngineSettings>
11 #include <QWebEngineView>
12 using namespace WebEngineViewer;
13 DeveloperToolWidget::DeveloperToolWidget(QWidget *parent)
14  : QWidget(parent)
15  , mWebEngineView(new QWebEngineView(this))
16  , mEnginePage(new QWebEnginePage(this))
17 {
18  auto mainLayout = new QVBoxLayout(this);
19  mainLayout->setObjectName(QLatin1StringView("mainLayout"));
20  mainLayout->setContentsMargins({});
21 
22  mWebEngineView->setObjectName(QLatin1StringView("mWebEngineView"));
23  mainLayout->addWidget(mWebEngineView);
24  mEnginePage->setObjectName(QLatin1StringView("mEnginePage"));
25  mEnginePage->settings()->setAttribute(QWebEngineSettings::JavascriptEnabled, true);
26 
27  mWebEngineView->setPage(mEnginePage);
28  connect(mEnginePage, &QWebEnginePage::windowCloseRequested, this, &DeveloperToolWidget::closeRequested);
29 }
30 
31 DeveloperToolWidget::~DeveloperToolWidget() = default;
32 
33 QWebEnginePage *DeveloperToolWidget::enginePage() const
34 {
35  return mEnginePage;
36 }
37 
38 #include "moc_developertoolwidget.cpp"
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Thu Feb 15 2024 03:55:20 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.