wip
This commit is contained in:
@@ -1,50 +1,66 @@
|
||||
#include <sys/resource.h>
|
||||
|
||||
#include <QApplication>
|
||||
#include <QTranslator>
|
||||
// #include <QApplication>
|
||||
// #include <QTranslator>
|
||||
|
||||
#include "/data/openpilot/system/hardware/hw.h"
|
||||
#include "/data/openpilot/selfdrive/ui/qt/qt_window.h"
|
||||
#include "/data/openpilot/selfdrive/ui/qt/util.h"
|
||||
|
||||
#include <QCommandLineParser>
|
||||
#include <QApplication>
|
||||
#include <QWidget>
|
||||
#include <QTextEdit>
|
||||
#include <QLabel>
|
||||
#include <QProcess>
|
||||
#include <QVBoxLayout>
|
||||
#include <QFont>
|
||||
#include <QScreen>
|
||||
#include <QScrollBar>
|
||||
#include <QGuiApplication>
|
||||
#include <QWebEngineView>
|
||||
#include <QStackedLayout>
|
||||
// #include <QCommandLineParser>
|
||||
// #include <QApplication>
|
||||
// #include <QWidget>
|
||||
// #include <QTextEdit>
|
||||
// #include <QLabel>
|
||||
// #include <QProcess>
|
||||
// #include <QVBoxLayout>
|
||||
// #include <QFont>
|
||||
// #include <QScreen>
|
||||
// #include <QScrollBar>
|
||||
// #include <QGuiApplication>
|
||||
// #include <QWebEngineView>
|
||||
// #include <QStackedLayout>
|
||||
|
||||
|
||||
#include <QApplication>
|
||||
#include <QFrame>
|
||||
#include <QVBoxLayout>
|
||||
#include <QWebEngineView>
|
||||
#include <QWidget>
|
||||
|
||||
class WebViewFrame : public QFrame {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit WebViewFrame(QWidget *parent = nullptr) : QFrame(parent) {
|
||||
QVBoxLayout *layout = new QVBoxLayout(this);
|
||||
QWebEngineView *web_view = new QWebEngineView();
|
||||
web_view->load(QUrl("http://example.com")); // Change URL as needed
|
||||
layout->addWidget(web_view);
|
||||
}
|
||||
};
|
||||
|
||||
class MainWindow : public QWidget {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit MainWindow(QWidget *parent = nullptr) {
|
||||
this->setWindowTitle("Webview in Frame");
|
||||
this->setStyleSheet("background-color: black;");
|
||||
|
||||
WebViewFrame *webViewFrame = new WebViewFrame(this);
|
||||
QVBoxLayout *mainLayout = new QVBoxLayout(this);
|
||||
mainLayout->addWidget(webViewFrame);
|
||||
this->setLayout(mainLayout);
|
||||
this->show();
|
||||
}
|
||||
};
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
setpriority(PRIO_PROCESS, 0, -20);
|
||||
|
||||
initApp(argc, argv);
|
||||
|
||||
QApplication a(argc, argv);
|
||||
|
||||
QWidget window;
|
||||
window.setWindowTitle("Webview");
|
||||
window.setStyleSheet("background-color: black;");
|
||||
|
||||
QVBoxLayout *layout = new QVBoxLayout(&window);
|
||||
// layout->setSpacing(0);
|
||||
// layout->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
// QString url = args.first();
|
||||
QWebEngineView *web_view = new QWebEngineView();
|
||||
web_view->load(QUrl(argv[1]));
|
||||
layout->addWidget(web_view);
|
||||
|
||||
// window.showFullScreen();
|
||||
window.show();
|
||||
|
||||
// a.installEventFilter(&w);
|
||||
return a.exec();
|
||||
QApplication app(argc, argv);
|
||||
MainWindow mainWindow;
|
||||
setMainWindow(&mainWindow);
|
||||
return app.exec();
|
||||
}
|
||||
|
||||
// #include "main.moc"
|
||||
|
||||
Reference in New Issue
Block a user