Открыть боковую панель
MOS
Исходные коды
mos-vkm
Коммиты
7cf6a773
Коммит
7cf6a773
создал
Янв 24, 2024
по автору
Коул Милена Ричардовна
Просмотр файлов
open links in browser
владелец
b456b774
Изменения
2
Скрыть пробелы
Построчно
Рядом
webEngineWidgets/tabwidget.cpp
Просмотр файла @
7cf6a773
...
@@ -55,6 +55,8 @@
...
@@ -55,6 +55,8 @@
#include
<QMenu>
#include
<QMenu>
#include
<QTabBar>
#include
<QTabBar>
#include
<QWebEngineProfile>
#include
<QWebEngineProfile>
#include
<QTimer>
#include
<QDesktopServices>
TabWidget
::
TabWidget
(
QWebEngineProfile
*
profile
,
QWidget
*
parent
)
TabWidget
::
TabWidget
(
QWebEngineProfile
*
profile
,
QWidget
*
parent
)
:
QTabWidget
(
parent
)
:
QTabWidget
(
parent
)
...
@@ -97,6 +99,15 @@ WebView *TabWidget::createLinkTab()
...
@@ -97,6 +99,15 @@ WebView *TabWidget::createLinkTab()
WebView
*
webView
=
new
WebView
;
WebView
*
webView
=
new
WebView
;
WebPage
*
webPage
=
new
WebPage
(
m_profile
,
webView
);
WebPage
*
webPage
=
new
WebPage
(
m_profile
,
webView
);
webView
->
setPage
(
webPage
);
webView
->
setPage
(
webPage
);
m_webView
=
webView
;
QTimer
::
singleShot
(
500
,
this
,
[
this
]
()
{
QString
new_url
=
m_webView
->
url
().
toDisplayString
();
if
(
new_url
.
startsWith
(
"https://"
))
{
QDesktopServices
::
openUrl
(
QUrl
(
new_url
,
QUrl
::
TolerantMode
));
}
qWarning
()
<<
m_webView
->
url
().
toDisplayString
();
});
return
webView
;
return
webView
;
}
}
...
...
webEngineWidgets/tabwidget.h
Просмотр файла @
7cf6a773
...
@@ -77,6 +77,7 @@ public slots:
...
@@ -77,6 +77,7 @@ public slots:
private:
private:
WebView
*
webView
(
int
index
)
const
;
WebView
*
webView
(
int
index
)
const
;
WebView
*
m_webView
;
QWebEngineProfile
*
m_profile
;
QWebEngineProfile
*
m_profile
;
};
};
...
...
Редактирование
Предварительный просмотр
Поддерживает Markdown
0%
Попробовать снова
или
прикрепить новый файл
.
Отмена
You are about to add
0
people
to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Отмена
Пожалуйста,
зарегистрируйтесь
или
войдите
чтобы прокомментировать