diff options
| author | Nathan Reiner <nathan@nathanreiner.xyz> | 2023-01-25 10:07:28 +0100 |
|---|---|---|
| committer | Nathan Reiner <nathan@nathanreiner.xyz> | 2023-01-25 10:07:28 +0100 |
| commit | 41652d5f074943cd5fecb4396edec0a8c22f7c7c (patch) | |
| tree | 5bd1eb7e3c3a792ff5ff3c53965edbad1de3d61c | |
| parent | 0321da112a7ea32f89849a0abc532fecafa3ee14 (diff) | |
move WebEnginePage to headerfile
| -rw-r--r-- | sb.cpp | 25 |
1 files changed, 1 insertions, 24 deletions
@@ -19,7 +19,7 @@ #include <QShortcut> #include <QVBoxLayout> - +#include "webengine.hpp" bool is_valid_url(const std::string & url); void open_url(const std::string & url); @@ -44,29 +44,6 @@ QWebEngineView * web; QMainWindow * view; Display * dpy; -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(); - } - } -}; - -#include "webengine.hpp" std::string read_from_dmenu() { std::string output; |