summaryrefslogtreecommitdiff
path: root/src/webengine/webview.cpp
blob: 1aef01e20330bef83dd104424f35e06e6a4bfac3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/* ============================================================
 *     The rekonq project
 * ============================================================
 * SPDX-License-Identifier: GPL-3.0-only
 * Copyright (C) 2022 aqua <aqua@iserlohn-fortress.net>
 * ============================================================
 * Description: Qt WebEngine View
 * ============================================================ */

#include "webview.h"
#include <QVBoxLayout>
#include <QWebEngineView>

WebView::WebView(const QUrl &url, QWidget *parent) : rView(url, parent), view(new QWebEngineView(this))
{
  auto *layout = new QVBoxLayout;
  layout->setContentsMargins(0, 0, 0, 0);
  layout->addWidget(view);
  setLayout(layout);

  connect(view, &QWebEngineView::iconChanged, this, [this](const QIcon &icon) { emit iconChanged(icon); });
  connect(view, &QWebEngineView::urlChanged, this, [this](const QUrl &url) { emit urlChanged(url); });
  connect(view, &QWebEngineView::titleChanged, this, [this](const QString &title) { emit titleChanged(title); });
  view->load(url);
}