This commit is contained in:
2026-03-03 09:39:15 +01:00
parent 769d5681d4
commit 35aae3b707
9 changed files with 136 additions and 40 deletions

View File

@@ -21,22 +21,21 @@ class RKTWEBVIEW_QT_EXPORT Rktwebview_qt : public QObject
{
Q_OBJECT
private:
QApplication *_app;
rktwebview_t _current_handle;
QHash<int, WebviewWindow *> _views;
QApplication *_app;
rktwebview_t _current_handle;
QHash<int, WebviewWindow *> _views;
QHash<int, void(*)(const char *msg)> _view_js_callbacks;
QQueue<Command *> _command_queue;
QTimer _process_commands;
QTimer _quit_event_loop;
QQueue<Command *> _command_queue;
QTimer _process_commands;
Rktwebview_qt **_handler;
Rktwebview_qt **_handler;
int _argc;
char *_argv[1];
public slots:
void processCommands();
void interruptEventLoop();
public:
void removeView(int id);
@@ -44,17 +43,24 @@ public:
public:
int nextHandle();
public:
int rktWebViewCreate(int parent = 0); // threadsafe
int rktWebViewCreate(int parent, void(*js_evt_cb)(const char *msg));
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 runJs(rktwebview_t wv, const char *js);
item_t callJs(rktwebview_t wv, const char *js);
void setHtml(rktwebview_t wv, const char *html); // threadsafe
void navigate(rktwebview_t wv, const char *url); // threadsafe
void setHtml(rktwebview_t wv, const char *html);
void navigate(rktwebview_t wv, const char *url);
result_t rktSetUrl(rktwebview_t wv, const char *url);
public:
// Events for the backend
void pageLoaded(rktwebview_t w, bool ok);
public:
void triggerEvent(rktwebview_t wv, const QString &msg);
public:
void doEvents();