I'm trying to make a web browser but i cant find a good tutorial for bookmarks and tabs in my web browser called RadonNet I'm using PySide6 because i want my software to be open source
I also use QWebEngineView which makes it harder to find tutorials for my browser
Sure. Theres Bookmarks and Tabs Tutorials but they will not work with QWebEngineView
Anything to solve this?
import sys
from PySide6.QtCore import QUrl
from PySide6.QtWidgets import QApplication, QMainWindow, QLineEdit, QToolBar
from PySide6.QtGui import QAction # Corrected import for QAction
from PySide6.QtWebEngineWidgets import QWebEngineView
class Browser(QMainWindow):
def __init__(self):
super().__init__()
self.setWindowTitle('RadonNet')
`your text` self.browser = QWebEngineView()
self.browser.setUrl(QUrl('http://www.google.com'))
# Navigation toolbar
self.nav_bar = QToolBar("Navigation")
self.addToolBar(self.nav_bar)
# Back button
back_btn = QAction('Back', self)
back_btn.triggered.connect(self.browser.back)
self.nav_bar.addAction(back_btn)
# Forward button
forward_btn = QAction('Forward', self)
forward_btn.triggered.connect(self.browser.forward)
self.nav_bar.addAction(forward_btn)
# Refresh button
refresh_btn = QAction('Refresh', self)
refresh_btn.triggered.connect(self.browser.reload)
self.nav_bar.addAction(refresh_btn)
# Home button
home_btn = QAction('Home', self)
home_btn.triggered.connect(self.navigate_home)
self.nav_bar.addAction(home_btn)
# URL bar
self.url_bar = QLineEdit()
self.url_bar.returnPressed.connect(self.navigate_to_url)
self.nav_bar.addWidget(self.url_bar)
self.setCentralWidget(self.browser)
def navigate_home(self):
self.browser.setUrl(QUrl('http://www.google.com'))
def navigate_to_url(self):
url = self.url_bar.text()
self.browser.setUrl(QUrl(url))
if __name__ == '__main__':
app = QApplication(sys.argv)
QApplication.setApplicationName('RadonNet')
window = Browser()
window.show()
sys.exit(app.exec_())
I tried tutorials but none of them are compatible with QWebEngineView.
There are very few posts about bookmarks and tabs for PySides/QT WebEngineView
And none of them work.
So I'm forced to ask stack overflow