diff options
Diffstat (limited to 'examples/webenginewidgets/simplebrowser')
-rw-r--r-- | examples/webenginewidgets/simplebrowser/data/ninja.png | bin | 0 -> 1671 bytes | |||
-rw-r--r-- | examples/webenginewidgets/simplebrowser/data/simplebrowser.qrc | 1 | ||||
-rw-r--r-- | examples/webenginewidgets/simplebrowser/tabwidget.cpp | 9 |
3 files changed, 10 insertions, 0 deletions
diff --git a/examples/webenginewidgets/simplebrowser/data/ninja.png b/examples/webenginewidgets/simplebrowser/data/ninja.png Binary files differnew file mode 100644 index 000000000..e5d7b6fd7 --- /dev/null +++ b/examples/webenginewidgets/simplebrowser/data/ninja.png diff --git a/examples/webenginewidgets/simplebrowser/data/simplebrowser.qrc b/examples/webenginewidgets/simplebrowser/data/simplebrowser.qrc index ec8716721..d81b08a64 100644 --- a/examples/webenginewidgets/simplebrowser/data/simplebrowser.qrc +++ b/examples/webenginewidgets/simplebrowser/data/simplebrowser.qrc @@ -9,5 +9,6 @@ <file>process-stop.png</file> <file>text-html.png</file> <file>view-refresh.png</file> + <file>ninja.png</file> </qresource> </RCC> diff --git a/examples/webenginewidgets/simplebrowser/tabwidget.cpp b/examples/webenginewidgets/simplebrowser/tabwidget.cpp index 8b458a9af..369bebfd9 100644 --- a/examples/webenginewidgets/simplebrowser/tabwidget.cpp +++ b/examples/webenginewidgets/simplebrowser/tabwidget.cpp @@ -51,6 +51,7 @@ #include "tabwidget.h" #include "webpage.h" #include "webview.h" +#include <QLabel> #include <QMenu> #include <QTabBar> #include <QWebEngineProfile> @@ -75,6 +76,14 @@ TabWidget::TabWidget(QWebEngineProfile *profile, QWidget *parent) setElideMode(Qt::ElideRight); connect(this, &QTabWidget::currentChanged, this, &TabWidget::handleCurrentChanged); + + if (profile->isOffTheRecord()) { + QLabel *icon = new QLabel(this); + QPixmap pixmap(QStringLiteral(":ninja.png")); + icon->setPixmap(pixmap.scaledToHeight(tabBar->height())); + setStyleSheet(QStringLiteral("QTabWidget::tab-bar { left: %1px; }"). + arg(icon->pixmap()->width())); + } } void TabWidget::handleCurrentChanged(int index) |