File indexing completed on 2025-01-26 04:57:24

0001 /*
0002    SPDX-FileCopyrightText: 2017-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #include "testselectionchangedwebengine.h"
0008 
0009 #include "webengineview.h"
0010 #include <QApplication>
0011 #include <QDebug>
0012 #include <QTextEdit>
0013 #include <QVBoxLayout>
0014 
0015 TestSelectionChangedEngine::TestSelectionChangedEngine(QWidget *parent)
0016     : QWidget(parent)
0017 {
0018     auto vbox = new QVBoxLayout(this);
0019     auto layout = new QHBoxLayout;
0020     vbox->addLayout(layout);
0021     pageView = new WebEngineViewer::WebEngineView(this);
0022     pageView->load(QUrl(QStringLiteral("http://www.planetkde.org")));
0023     connect(pageView, &WebEngineViewer::WebEngineView::selectionChanged, this, &TestSelectionChangedEngine::slotSelectionChanged);
0024     layout->addWidget(pageView);
0025 
0026     auto edit = new QTextEdit(this);
0027     vbox->addWidget(edit);
0028 }
0029 
0030 TestSelectionChangedEngine::~TestSelectionChangedEngine() = default;
0031 
0032 void TestSelectionChangedEngine::slotSelectionChanged()
0033 {
0034     qDebug() << " void TestSelectionChangedEngine::slotSelectionChanged()";
0035 }
0036 
0037 int main(int argc, char *argv[])
0038 {
0039     QApplication app(argc, argv);
0040     auto testWebEngine = new TestSelectionChangedEngine;
0041     testWebEngine->show();
0042     const int ret = app.exec();
0043     return ret;
0044 }
0045 
0046 #include "moc_testselectionchangedwebengine.cpp"