diff options
| -rw-r--r-- | config.hpp | 2 | ||||
| -rw-r--r-- | sb.cpp | 1 | ||||
| -rw-r--r-- | webengine.hpp | 22 |
3 files changed, 24 insertions, 1 deletions
@@ -1,6 +1,6 @@ const bool enable_smooth_scrollig = true; -const char search_engine[] = "https://duckduckgo.com/?q="; +const char search_engine[] = "https://searx.org/?q="; const char dmenu_args[] = "-s 0"; const unsigned scroll_speed = 100; @@ -136,6 +136,7 @@ main(int argc, char **argv) { web = new QWebEngineView(); web->setPage(&page); web->load(QUrl(getenv("WWW_HOME"))); + page.setBackgroundColor(QColor(40, 40, 40)); progressbar.setMaximum(100); progressbar.setMinimum(0); progressbar.setTextVisible(false); diff --git a/webengine.hpp b/webengine.hpp index 08cdbe5..dc73d97 100644 --- a/webengine.hpp +++ b/webengine.hpp @@ -17,6 +17,28 @@ #error "(The moc has changed too much.)" #endif +class WebEnginePage: public QWebEnginePage { +Q_OBJECT +public: + WebEnginePage(QWebEngineProfile *profile) : QWebEnginePage(profile) {}; + virtual ~WebEnginePage() = default; + +protected: + QWebEnginePage *createWindow(WebWindowType){ + WebEnginePage *page = new WebEnginePage(this->profile()); + connect(page, &QWebEnginePage::urlChanged, this, &WebEnginePage::onUrlChanged); + return page; + } + +private: + void onUrlChanged(const QUrl & url){ + if(WebEnginePage *page = qobject_cast<WebEnginePage *>(sender())){ + setUrl(url); + page->deleteLater(); + } + } +}; + QT_BEGIN_MOC_NAMESPACE QT_WARNING_PUSH QT_WARNING_DISABLE_DEPRECATED |