[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Gavin D. Smith |
Date: |
Wed, 30 Nov 2022 13:36:35 -0500 (EST) |
branch: old/qt-info
commit 6f622869951e60df843241e22ae2c44248576ffc
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Sun Apr 7 16:15:46 2019 +0100
give Core object a reference to Ui::MainWindow
---
js/docbrowser/core.cpp | 13 ++++++++-----
js/docbrowser/core.h | 9 ++++++++-
js/docbrowser/mainwindow.cpp | 2 +-
3 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/js/docbrowser/core.cpp b/js/docbrowser/core.cpp
index d14e47c5f3..df7cfd4a1a 100644
--- a/js/docbrowser/core.cpp
+++ b/js/docbrowser/core.cpp
@@ -4,7 +4,9 @@
#include <QCoreApplication>
#include <QDebug>
-Core::Core(QObject *parent) : QObject(parent)
+Core::Core(Ui::MainWindow *ui, QObject *parent)
+ : QObject(parent),
+ ui(ui)
{
}
@@ -13,8 +15,9 @@ Core::external_manual (const QString &url)
{
qDebug() << "sent url" << url;
- // Send it back into the browser.
- // We could set load the new page from the C++ code, but we might want
- // the JavaScript code to track multiple manuals at once.
- emit setUrl (url);
+ // We should send it back into the browser for the JavaScript code to
track
+ // multiple manuals at once.
+ // emit setUrl (url);
+
+ // Repace the file being viewed
}
diff --git a/js/docbrowser/core.h b/js/docbrowser/core.h
index a8ddbeeca8..d31a728600 100644
--- a/js/docbrowser/core.h
+++ b/js/docbrowser/core.h
@@ -3,11 +3,15 @@
#include <QObject>
+namespace Ui {
+class MainWindow;
+}
+
class Core : public QObject
{
Q_OBJECT
public:
- explicit Core(QObject *parent = nullptr);
+ explicit Core(Ui::MainWindow *ui, QObject *parent = nullptr);
signals:
// Signals emitted from the C++ side and received on the HTML client side.
@@ -17,6 +21,9 @@ public slots:
// Signals emitted from the HTML client side and received on the HTML side.
void external_manual (const QString &url);
+private:
+ Ui::MainWindow *ui;
+
};
#endif // CORE_H
diff --git a/js/docbrowser/mainwindow.cpp b/js/docbrowser/mainwindow.cpp
index 982a7b1687..ac91cda6c1 100644
--- a/js/docbrowser/mainwindow.cpp
+++ b/js/docbrowser/mainwindow.cpp
@@ -39,7 +39,7 @@ MainWindow::MainWindow(QWidget *parent) :
QObject::connect(clientWrapper, &WebSocketClientWrapper::clientConnected,
channel, &QWebChannel::connectTo);
- auto *core = new Core(this);
+ auto *core = new Core(ui, this);
channel->registerObject(QStringLiteral("core"), core);
- [no subject], (continued)
- [no subject], Gavin D. Smith, 2022/11/30
- [no subject], Gavin D. Smith, 2022/11/30
- [no subject], Gavin D. Smith, 2022/11/30
- [no subject], Gavin D. Smith, 2022/11/30
- [no subject], Gavin D. Smith, 2022/11/30
- [no subject], Gavin D. Smith, 2022/11/30
- [no subject], Gavin D. Smith, 2022/11/30
- [no subject], Gavin D. Smith, 2022/11/30
- [no subject], Gavin D. Smith, 2022/11/30
- [no subject], Gavin D. Smith, 2022/11/30
- [no subject],
Gavin D. Smith <=
- [no subject], Gavin D. Smith, 2022/11/30
- [no subject], Gavin D. Smith, 2022/11/30
- [no subject], Gavin D. Smith, 2022/11/30
- [no subject], Gavin D. Smith, 2022/11/30
- [no subject], Gavin D. Smith, 2022/11/30
- [no subject], Gavin D. Smith, 2022/11/30
- [no subject], Gavin D. Smith, 2022/11/30
- [no subject], Gavin D. Smith, 2022/11/30
- [no subject], Gavin D. Smith, 2022/11/30
- [no subject], Gavin D. Smith, 2022/11/30