commit b4bebee984b69ef4b76f71b65842e45bad93f28c Author: thomas_lucky13 Date: Mon Jul 11 12:45:10 2022 +0400 TryButtonClick diff --git a/StoreMain.html b/StoreMain.html new file mode 100644 index 0000000..80f115c --- /dev/null +++ b/StoreMain.html @@ -0,0 +1,11 @@ + + + + +

StoreTry

+
+
+
+
+ + diff --git a/StoreTry.pro b/StoreTry.pro new file mode 100644 index 0000000..7758391 --- /dev/null +++ b/StoreTry.pro @@ -0,0 +1,32 @@ +QT += core gui +QT += webenginewidgets +QT += webkitwidgets + +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets + +CONFIG += c++11 + +# You can make your code fail to compile if it uses deprecated APIs. +# In order to do so, uncomment the following line. +#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 + +SOURCES += \ + main.cpp \ + webapp.cpp + +HEADERS += \ + webapp.h + +FORMS += \ + webapp.ui + +# Default rules for deployment. +qnx: target.path = /tmp/$${TARGET}/bin +else: unix:!android: target.path = /opt/$${TARGET}/bin +!isEmpty(target.path): INSTALLS += target + +DISTFILES += \ + StoreMain.html + +RESOURCES += \ + webui.qrc diff --git a/StoreTry.pro.user b/StoreTry.pro.user new file mode 100644 index 0000000..a6b4867 --- /dev/null +++ b/StoreTry.pro.user @@ -0,0 +1,265 @@ + + + + + + EnvironmentId + {d3ce2235-5a86-42bb-bf51-d3a3fc597674} + + + ProjectExplorer.Project.ActiveTarget + 0 + + + ProjectExplorer.Project.EditorSettings + + true + false + true + + Cpp + + CppGlobal + + + + QmlJS + + QmlJSGlobal + + + 2 + UTF-8 + false + 4 + false + 80 + true + true + 1 + false + true + false + 0 + true + true + 0 + 8 + true + false + 1 + true + true + true + *.md, *.MD, Makefile + false + true + + + + ProjectExplorer.Project.PluginSettings + + + true + false + true + true + true + true + + + 0 + true + + true + Builtin.BuildSystem + + true + true + Builtin.DefaultTidyAndClazy + 2 + + + + true + + + + + ProjectExplorer.Project.Target.0 + + Desktop + Desktop + Desktop + {5578b1fb-6d52-4ac4-a50f-a9ed0f47112a} + 0 + 0 + 0 + + 0 + /home/thomas/Programs/StoreProjecct/Tryy/build-StoreTry-Desktop-Debug + /home/thomas/Programs/StoreProjecct/Tryy/build-StoreTry-Desktop-Debug + + + true + QtProjectManager.QMakeBuildStep + false + + + + true + Qt4ProjectManager.MakeStep + + 2 + Сборка + Сборка + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + clean + + 1 + Очистка + Очистка + ProjectExplorer.BuildSteps.Clean + + 2 + false + + false + + Отладка + Qt4ProjectManager.Qt4BuildConfiguration + 2 + + + /home/thomas/Programs/StoreProjecct/Tryy/build-StoreTry-Desktop-Release + /home/thomas/Programs/StoreProjecct/Tryy/build-StoreTry-Desktop-Release + + + true + QtProjectManager.QMakeBuildStep + false + + + + true + Qt4ProjectManager.MakeStep + + 2 + Сборка + Сборка + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + clean + + 1 + Очистка + Очистка + ProjectExplorer.BuildSteps.Clean + + 2 + false + + false + + Выпуск + Qt4ProjectManager.Qt4BuildConfiguration + 0 + 0 + + + 0 + /home/thomas/Programs/StoreProjecct/Tryy/build-StoreTry-Desktop-Profile + /home/thomas/Programs/StoreProjecct/Tryy/build-StoreTry-Desktop-Profile + + + true + QtProjectManager.QMakeBuildStep + false + + + + true + Qt4ProjectManager.MakeStep + + 2 + Сборка + Сборка + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + clean + + 1 + Очистка + Очистка + ProjectExplorer.BuildSteps.Clean + + 2 + false + + false + + Профилирование + Qt4ProjectManager.Qt4BuildConfiguration + 0 + 0 + 0 + + 3 + + + 0 + Развёртывание + Развёртывание + ProjectExplorer.BuildSteps.Deploy + + 1 + + false + ProjectExplorer.DefaultDeployConfiguration + + 1 + + true + true + true + + 2 + + Qt4ProjectManager.Qt4RunConfiguration:/home/thomas/Programs/StoreProjecct/Tryy/StoreTry/StoreTry.pro + /home/thomas/Programs/StoreProjecct/Tryy/StoreTry/StoreTry.pro + false + true + true + false + true + /home/thomas/Programs/StoreProjecct/Tryy/build-StoreTry-Desktop-Debug + + 1 + + + + ProjectExplorer.Project.TargetCount + 1 + + + ProjectExplorer.Project.Updater.FileVersion + 22 + + + Version + 22 + + diff --git a/StoreTry.qrc b/StoreTry.qrc new file mode 100644 index 0000000..3aca847 --- /dev/null +++ b/StoreTry.qrc @@ -0,0 +1,5 @@ + + + resources/StoreMain.html + + diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..aac72fc --- /dev/null +++ b/main.cpp @@ -0,0 +1,15 @@ +#include "webapp.h" +#include +#include +#include +#include +#include + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + WebApp w; + w.setPath(a.applicationDirPath()); + w.show(); + return a.exec(); +} diff --git a/webapp.cpp b/webapp.cpp new file mode 100644 index 0000000..634bc7a --- /dev/null +++ b/webapp.cpp @@ -0,0 +1,39 @@ +#include "webapp.h" +#include "ui_webapp.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +WebApp::WebApp(QWidget *parent) + : QMainWindow(parent) + , ui(new Ui::WebApp) +{ + ui->setupUi(this); +} + +void WebApp::setPath(QString _appPath) +{ + ui->setupUi(this); + appPath = _appPath; + _lastUrl = QUrl::fromLocalFile(appPath+"/StoreMain.html"); + ui->webEngineView->load(_lastUrl); + connect(ui->webEngineView, &QWebEngineView::urlChanged, this, &WebApp::onUrlChanged); +} +void WebApp::SetUrl() +{ + ui->webEngineView->load(_lastUrl); +} +WebApp::~WebApp() +{ + delete ui; +} + + diff --git a/webapp.h b/webapp.h new file mode 100644 index 0000000..63d3d91 --- /dev/null +++ b/webapp.h @@ -0,0 +1,43 @@ +#ifndef WEBAPP_H +#define WEBAPP_H + +#include +#include +#include + +QT_BEGIN_NAMESPACE +namespace Ui { class WebApp; } +QT_END_NAMESPACE + +class WebApp : public QMainWindow +{ + Q_OBJECT + +public: + WebApp(QWidget *parent = nullptr); + void setPath(QString _appPathl); + ~WebApp(); + +private: + Ui::WebApp *ui; + QWebEngineView *mView; + QString appPath; + QUrl _lastUrl; + void SetUrl(); +private Q_SLOTS: + void onUrlChanged(const QUrl & url){ + if (url == QUrl("file://"+appPath+"/but1")) + { + qWarning("Нажал 1"); + SetUrl(); + } + + if (url == QUrl("file://"+appPath+"/but2")) + { + qWarning("Нажал 2"); + SetUrl(); + } + + } +}; +#endif // WEBAPP_H diff --git a/webapp.ui b/webapp.ui new file mode 100644 index 0000000..7a3442e --- /dev/null +++ b/webapp.ui @@ -0,0 +1,54 @@ + + + WebApp + + + + 0 + 0 + 800 + 600 + + + + WebApp + + + + + + 0 + 0 + 831 + 651 + + + + + about:blank + + + + + + + + 0 + 0 + 800 + 36 + + + + + + + + QWebEngineView + QWidget +
QtWebEngineWidgets/QWebEngineView
+
+
+ + +
diff --git a/webui.qrc b/webui.qrc new file mode 100644 index 0000000..fd18015 --- /dev/null +++ b/webui.qrc @@ -0,0 +1,5 @@ + + + StoreMain.html + +