/*
   SPDX-FileCopyrightText: 2016-2026 Laurent Montel <montel@kde.org>

   SPDX-License-Identifier: LGPL-2.0-or-later
*/

#pragma once

#include "webengineviewer_export.h"
#include <QObject>
#include <QPoint>
#include <memory>
class QWebEnginePage;
namespace WebEngineViewer
{
class WebHitTestResult;
class WebHitTestPrivate;
/*!
 * \class WebEngineViewer::WebHitTest
 * \inmodule WebEngineViewer
 * \inheaderfile WebEngineViewer/WebHitTest
 *
 * \brief The WebHitTest class
 * \author Laurent Montel <montel@kde.org>
 */
class WEBENGINEVIEWER_EXPORT WebHitTest : public QObject
{
    Q_OBJECT
public:
    /*! Constructs a WebHitTest object for the given page at the specified positions. */
    explicit WebHitTest(QWebEnginePage *page, const QPoint &zoomedPos, const QPoint &pos, QObject *parent = nullptr);
    /*! Destroys the WebHitTest object. */
    ~WebHitTest() override;

Q_SIGNALS:
    /*! Emitted when the hit test finishes. */
    void finished(const WebEngineViewer::WebHitTestResult &result);

private Q_SLOTS:
    WEBENGINEVIEWER_NO_EXPORT void handleHitTest(const QVariant &result);

private:
    std::unique_ptr<WebHitTestPrivate> const d;
};
}
