1 /*************************************************************************** 2 * Copyright (C) 2004-2021 by Pere Constans 3 * constans@molspaces.com 4 * 5 * See the LICENSE file that comes with this distribution. 6 ***************************************************************************/ 7 #ifndef C2BWEBBROWSER_H 8 #define C2BWEBBROWSER_H 9 10 #include <QMenu> 11 #include <QWebEngineView> 12 13 14 class c2bWebBrowser : public QWebEngineView 15 { 16 17 Q_OBJECT 18 19 public: 20 explicit c2bWebBrowser(QWidget* parentw = 0); 21 virtual ~c2bWebBrowser(); 22 23 QAction* viewBackwardAction; 24 QAction* viewForwardAction; 25 QAction* viewHomeAction; 26 QAction* viewReloadAction; 27 QAction* viewZoomInAction; 28 QAction* viewZoomOutAction; 29 30 31 signals: 32 void statusMessage(const QString ms); 33 34 35 public slots: 36 void loadPage(const QString& p_url); 37 void setFixedFont(const QFont& qfont); 38 void setFont(const QFont& qfont); 39 void setHomePage(const QString& hp_url); 40 41 42 protected: 43 virtual QWebEngineView* createWindow(QWebEnginePage::WebWindowType type); 44 45 46 protected slots: 47 void copy(); 48 void home(); 49 void zoomIn(); 50 void zoomOut(); 51 52 53 private: 54 QString _home_page; 55 QString _hovered_link; 56 void showTitle(const QVariant& v); 57 58 59 private slots: 60 void linkHovered(const QString& link); 61 }; 62 63 #endif