MCPcopy Create free account
hub / github.com/KangLin/RabbitRemoteControl / CFrmPopup

Method CFrmPopup

Plugins/WebBrowser/FrmPopup.cpp:13–50  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11
12static Q_LOGGING_CATEGORY(log, "WebBrowser.Widget.Popup")
13CFrmPopup::CFrmPopup(QWebEngineProfile *profile, CFrmWebBrowser* pWebBrowser, QWidget *parent)
14 : QWidget{parent}
15 , m_pleUrl(nullptr)
16 , m_pFavAction(nullptr)
17 , m_pView(nullptr)
18{
19 qDebug(log) << Q_FUNC_INFO;
20 bool check = false;
21 setAttribute(Qt::WA_DeleteOnClose);
22 setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
23
24 this->resize(pWebBrowser->size());
25
26 QVBoxLayout *layout = new QVBoxLayout;
27 layout->setContentsMargins(0, 0, 0, 0);
28 setLayout(layout);
29 m_pleUrl = new QLineEdit(this);
30 m_pFavAction = new QAction(this);
31 layout->addWidget(m_pleUrl);
32 m_pView = new CFrmWebView(pWebBrowser, this);
33 layout->addWidget(m_pView);
34 m_pView->setPage(new QWebEnginePage(profile, m_pView));
35 m_pView->setFocus();
36 m_pleUrl->setReadOnly(true);
37 m_pleUrl->addAction(m_pFavAction, QLineEdit::LeadingPosition);
38 check = connect(m_pView, &CFrmWebView::titleChanged, this, &QWidget::setWindowTitle);
39 Q_ASSERT(check);
40 check = connect(m_pView, &CFrmWebView::urlChanged, [this](const QUrl& url){
41 m_pleUrl->setText(url.toDisplayString());
42 });
43 Q_ASSERT(check);
44 check = connect(m_pView, &CFrmWebView::favIconChanged, m_pFavAction, &QAction::setIcon);
45 Q_ASSERT(check);
46 check = connect(m_pView->page(), &QWebEnginePage::geometryChangeRequested, this, &CFrmPopup::slotHandleGeometryChangeRequested);
47 Q_ASSERT(check);
48 check = connect(m_pView->page(), &QWebEnginePage::windowCloseRequested, this, &QWidget::close);
49 Q_ASSERT(check);
50}
51
52CFrmPopup::~CFrmPopup()
53{

Callers

nothing calls this directly

Calls 1

setPageMethod · 0.80

Tested by

no test coverage detected