This commit is contained in:
2026-03-02 23:10:29 +01:00
parent 07004097e9
commit 25ca1ec4a4
24 changed files with 1054 additions and 31 deletions

View File

@@ -0,0 +1,68 @@
#ifndef RKTWEBVIEW_QT_H
#define RKTWEBVIEW_QT_H
#include "rktwebview_qt_global.h"
#include "rktwebview_internal.h"
#include <QApplication>
#include <QWebEngineView>
#include <QMutex>
#include <QThread>
#include <QHash>
#include <QQueue>
#include <QTimer>
class WebViewQt;
class WebviewWindow;
class Command;
class RKTWEBVIEW_QT_EXPORT Rktwebview_qt : public QObject
{
Q_OBJECT
private:
QApplication *_app;
rktwebview_t _current_handle;
QHash<int, WebviewWindow *> _views;
QQueue<Command *> _command_queue;
QTimer _process_commands;
QTimer _quit_event_loop;
Rktwebview_qt **_handler;
int _argc;
char *_argv[1];
public slots:
void processCommands();
void interruptEventLoop();
public:
void removeView(int id);
public:
int nextHandle();
public:
int rktWebViewCreate(int parent = 0); // threadsafe
void rktWebViewClose(int wv);
void rktQuit();
void runJs(rktwebview_t wv, const char *js); // threadsafe
item_t callJs(rktwebview_t wv, const char *js); // threadsafe
void setHtml(rktwebview_t wv, const char *html); // threadsafe
void navigate(rktwebview_t wv, const char *url); // threadsafe
result_t rktSetUrl(rktwebview_t wv, const char *url);
public:
void doEvents();
public:
void runCommandThread();
public:
Rktwebview_qt(Rktwebview_qt **handler);
};
#endif // RKTWEBVIEW_QT_H