From 959cf82ac14f0b2f9a66119165b8f0db3bea3acd Mon Sep 17 00:00:00 2001 From: Sheen Tian Shen Date: Tue, 29 Aug 2023 19:17:23 +0800 Subject: [PATCH 1/5] Update --- example/QCefViewTest/MainWindow.cpp | 7 +- src/CMakeLists.txt | 5 -- src/QCefView.cpp | 1 + src/details/CCefAppDelegate.cpp | 7 ++ src/details/CCefAppDelegate.h | 2 + src/details/CCefClientDelegate.cpp | 3 +- src/details/QCefViewPrivate.cpp | 114 ++++++++++++++-------------- src/details/QCefViewPrivate.h | 6 +- src/details/QCefWindow.cpp | 69 +++++++++++++++++ src/details/QCefWindow.h | 36 +++++++++ src/details/utils/CommonUtils.cpp | 111 --------------------------- src/details/utils/CommonUtils.h | 6 -- 12 files changed, 177 insertions(+), 190 deletions(-) create mode 100644 src/details/QCefWindow.cpp create mode 100644 src/details/QCefWindow.h diff --git a/example/QCefViewTest/MainWindow.cpp b/example/QCefViewTest/MainWindow.cpp index 7c00c679..6ca8527f 100644 --- a/example/QCefViewTest/MainWindow.cpp +++ b/example/QCefViewTest/MainWindow.cpp @@ -100,16 +100,11 @@ MainWindow::createRightCefView() // create the QCefView widget and add it to the layout container // m_pRightCefViewWidget = new CefViewWidget("https://cefview.github.io/QCefView/", &setting, this); - // this site is for test web events - m_pRightCefViewWidget = new CefViewWidget("", &setting, this); - m_pRightCefViewWidget->navigateToUrl( - "https://www.javatpoint.com/oprweb/test.jsp?filename=javascript-window-close-method1"); - // // m_pRightCefViewWidget = new CefViewWidget("https://mdn.dev/", &setting, this); // this site is for test OSR performance - // m_pRightCefViewWidget = new CefViewWidget("https://www.testufo.com", &setting, this); + m_pRightCefViewWidget = new CefViewWidget("https://www.testufo.com", &setting, this); // this site is test for input devices // m_pRightCefViewWidget = new CefViewWidget("https://devicetests.com", &setting); diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e3c798cc..8c40bd72 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -105,11 +105,6 @@ if(OS_LINUX) BUILD_WITH_INSTALL_RPATH TRUE ) - target_link_libraries(QCefView - PRIVATE - Qt${QT_VERSION_MAJOR}::GuiPrivate - ) - add_custom_command(TARGET QCefView PRE_BUILD diff --git a/src/QCefView.cpp b/src/QCefView.cpp index 0a4df523..2808c79a 100644 --- a/src/QCefView.cpp +++ b/src/QCefView.cpp @@ -289,6 +289,7 @@ QCefView::onNewBrowser(qint64 sourceFrameId, if (!name.isEmpty()) { popup->setWindowTitle(name); } + popup->setAttribute(Qt::WA_DeleteOnClose, true); popup->resize(rect.size()); popup->show(); diff --git a/src/details/CCefAppDelegate.cpp b/src/details/CCefAppDelegate.cpp index 72412a0c..7619abd0 100644 --- a/src/details/CCefAppDelegate.cpp +++ b/src/details/CCefAppDelegate.cpp @@ -1,5 +1,7 @@ #include "CCefAppDelegate.h" +#include + #include #include "QCefContextPrivate.h" @@ -10,6 +12,11 @@ CCefAppDelegate::CCefAppDelegate(QCefContextPrivate* context, CommandLineArgs ar { } +CCefAppDelegate::~CCefAppDelegate() +{ + qDebug() << "CCefAppDelegate is being destructed"; +} + void CCefAppDelegate::onBeforeCommandLineProcessing(const CefString& process_type, CefRefPtr command_line) { diff --git a/src/details/CCefAppDelegate.h b/src/details/CCefAppDelegate.h index 874798ea..28fd351d 100644 --- a/src/details/CCefAppDelegate.h +++ b/src/details/CCefAppDelegate.h @@ -13,6 +13,8 @@ class CCefAppDelegate : public CefViewBrowserAppDelegateInterface public: CCefAppDelegate(QCefContextPrivate* context, CommandLineArgs args); + ~CCefAppDelegate(); + virtual void onBeforeCommandLineProcessing(const CefString& process_type, CefRefPtr command_line) override; diff --git a/src/details/CCefClientDelegate.cpp b/src/details/CCefClientDelegate.cpp index a06f7cb1..fa6f922d 100644 --- a/src/details/CCefClientDelegate.cpp +++ b/src/details/CCefClientDelegate.cpp @@ -1,5 +1,6 @@ #include "CCefClientDelegate.h" +#include #include #include @@ -14,7 +15,7 @@ CCefClientDelegate::CCefClientDelegate(QCefViewPrivate* p) CCefClientDelegate::~CCefClientDelegate() { - return; + qDebug() << "CCefClientDelegate is being destructed"; } void diff --git a/src/details/QCefViewPrivate.cpp b/src/details/QCefViewPrivate.cpp index 8324fefd..3124b2f4 100644 --- a/src/details/QCefViewPrivate.cpp +++ b/src/details/QCefViewPrivate.cpp @@ -85,22 +85,15 @@ QCefViewPrivate::createCefBrowser(QCefView* view, const QString url, const QCefS if (isOSRModeEnabled_) { windowInfo.SetAsWindowless(0); } else { // #else -#if defined(Q_OS_LINUX) - // Don't know why, on Linux platform if we use QCefView's winId() as - // the parent, it will complain about `BadWindow`, - // and the browser window will not be created, this never happens - // on Windows and macOS, so we create a temporal QWindow as the - // parent to create CEF browser window. - QWindow* win = new QWindow(); - CefWindowHandle parent = (CefWindowHandle)win->winId(); -#else - CefWindowHandle parent = (CefWindowHandle)view->winId(); -#endif + // create CEF browser parent window + ncw.qBrowserWindow_ = new QCefWindow(); + ncw.qBrowserWindow_->setFlags(Qt::Window | Qt::FramelessWindowHint); + // use INT_MAX as the width and height to prevent black screen blink #if CEF_VERSION_MAJOR > 85 - windowInfo.SetAsChild(parent, { 0, 0, 0, 0 }); + windowInfo.SetAsChild((CefWindowHandle)ncw.qBrowserWindow_->winId(), { 0, 0, INT_MAX, INT_MAX }); #else - windowInfo.SetAsChild(parent, 0, 0, 0, 0); + windowInfo.SetAsChild((CefWindowHandle)ncw.qBrowserWindow_->winId(), 0, 0, INT_MAX, INT_MAX); #endif } // #endif @@ -142,13 +135,10 @@ QCefViewPrivate::destroyCefBrowser() if (!pClient_) return; - // #if !defined(CEF_USE_OSR) if (!isOSRModeEnabled_) { - // remove parent, or CEF will send close to the parent - // this will lead the top level window to be closed - ncw.qBrowserWindow_->setParent(nullptr); + // remove from children, prevent from being destroyed + ncw.qBrowserWindow_->detachCefWindow(); } - // #endif // clean all browsers pClient_->CloseAllBrowsers(); @@ -223,33 +213,40 @@ QCefViewPrivate::onCefBrowserCreated(CefRefPtr browser, QWindow* win // emit signal q_ptr->nativeBrowserCreated(window); + qDebug() << "CEF Window Native ID:" << window->winId(); + + // adjust size and attach to cef window + ncw.qBrowserWindow_->resize(q_ptr->size()); + ncw.qBrowserWindow_->attachCefWindow(window); + // create QWidget from cef browser widow, this will re-parent the CEF browser window QWidget* browserWidget = QWidget::createWindowContainer( - window, - q_ptr, - Qt::CustomizeWindowHint | Qt::FramelessWindowHint | Qt::WindowTransparentForInput | Qt::WindowDoesNotAcceptFocus); + ncw.qBrowserWindow_, q_ptr, Qt::WindowTransparentForInput | Qt::WindowDoesNotAcceptFocus); + Q_ASSERT_X(browserWidget, "QCefViewPrivateNCW::createBrowser", "Failed to create QWidget from cef browser window"); if (!browserWidget) { - qWarning("Failed to create QWidget from cef browser window"); + qWarning() << "Failed to create QWidget from cef browser window"; browser->GetHost()->CloseBrowser(true); return; } // capture the resource - ncw.qBrowserWindow_ = window; ncw.qBrowserWidget_ = browserWidget; + ncw.qBrowserWidget_->resize(q_ptr->size()); // monitor the focus changed event globally connect(qApp, &QApplication::focusChanged, this, &QCefViewPrivate::onAppFocusChanged); // initialize the layout and add browser widget to the layout - auto* layout = new QGridLayout(); + QGridLayout* layout = new QGridLayout(); layout->setContentsMargins(0, 0, 0, 0); layout->addWidget(ncw.qBrowserWidget_); q_ptr->setLayout(layout); // update mask - UpdateCefWindowMask(ncw.qBrowserWindow_, q_ptr->mask()); + if (ncw.qBrowserWindow_) { + ncw.qBrowserWindow_->setMask(q_ptr->mask()); + } } // #endif } @@ -371,7 +368,8 @@ QCefViewPrivate::onViewScreenChanged(QScreen* screen) pCefBrowser_->GetHost()->NotifyScreenInfoChanged(); } else { // #else Q_Q(QCefView); - UpdateCefWindowMask(ncw.qBrowserWindow_, q->mask()); + if (ncw.qBrowserWindow_) + ncw.qBrowserWindow_->setMask(q->mask()); } // #endif } @@ -489,15 +487,15 @@ QCefViewPrivate::onContextMenuDestroyed(QObject* obj) void QCefViewPrivate::onOsrUpdateViewFrame(const QImage& frame, const QRegion& region) { - // #if defined(QT_DEBUG) - // qint64 elapsedMs = paintTimer_.restart(); - // // qDebug() << "===== CEF view frame update since last frame:" << elapsedMs; - // if (elapsedMs >= 20) - // qDebug() << "===== CEF view frame update stutter detected:" << elapsedMs; - // - // QElapsedTimer updateDurationTimer; - // updateDurationTimer.start(); - // #endif +//#if defined(QT_DEBUG) +// qint64 elapsedMs = paintTimer_.restart(); +// // qDebug() << "===== CEF view frame update since last frame:" << elapsedMs; +// if (elapsedMs >= 20) +// qDebug() << "===== CEF view frame update stutter detected:" << elapsedMs; +// +// QElapsedTimer updateDurationTimer; +// updateDurationTimer.start(); +//#endif if (osr.qCefViewFrame_.size() != frame.size() || osr.transparentPaintingEnabled) { // update full image @@ -513,9 +511,9 @@ QCefViewPrivate::onOsrUpdateViewFrame(const QImage& frame, const QRegion& region } emit updateOsrFrame(); - // #if defined(QT_DEBUG) - // qDebug() << "===== CEF frame update duration:" << elapsedMs; - // #endif +//#if defined(QT_DEBUG) +// qDebug() << "===== CEF frame update duration:" << elapsedMs; +//#endif } void @@ -637,7 +635,6 @@ QCefViewPrivate::eventFilter(QObject* watched, QEvent* event) } #endif - // #if defined(CEF_USE_OSR) if (isOSRModeEnabled_) { // if the parent chain changed, we need to re-connect the screenChanged signal if (et == QEvent::ParentChange) { @@ -662,17 +659,18 @@ QCefViewPrivate::eventFilter(QObject* watched, QEvent* event) return true; } } - } else { // #else - // filter event to the browser window - if (watched == ncw.qBrowserWindow_ && et == QEvent::PlatformSurface) { + } else { + // the surface is about to be destroyed (top-level window is being closed) + if (et == QEvent::PlatformSurface) { auto t = ((QPlatformSurfaceEvent*)event)->surfaceEventType(); if (QPlatformSurfaceEvent::SurfaceAboutToBeDestroyed == t) { - // browser window is being destroyed, need to close the browser window in advance - destroyCefBrowser(); + if (watched == ncw.qBrowserWindow_->cefWindow()) { + // detach the cef window + ncw.qBrowserWindow_->detachCefWindow(); + } } } } - // #endif return QObject::eventFilter(watched, event); } @@ -764,11 +762,6 @@ QCefViewPrivate::onViewVisibilityChanged(bool visible) return; if (visible) { -#if defined(Q_OS_LINUX) - XRemapWindow(ncw.qBrowserWidget_, ncw.qBrowserWindow_); - // BUG-TO-BE-FIXED after remap, the browser window will not resize automatically - // with the QCefView widget -#endif // restore cef window size ncw.qBrowserWidget_->resize(q->frameSize()); } else { @@ -806,7 +799,8 @@ QCefViewPrivate::onViewSizeChanged(const QSize& size, const QSize& oldSize) pCefBrowser_->GetHost()->WasResized(); } else { // #else Q_Q(QCefView); - UpdateCefWindowMask(ncw.qBrowserWindow_, q->mask()); + if (ncw.qBrowserWindow_) + ncw.qBrowserWindow_->setMask(q->mask()); } // #endif } @@ -819,14 +813,16 @@ QCefViewPrivate::onViewKeyEvent(QKeyEvent* event) if (!pCefBrowser_) return; - // qDebug("==== onViewKeyEvent:key=%d, nativeVirtualKey=0x%02x, nativeScanCode=0x%02x, modifiers=0x%08x, " - // "nativeModifiers=0x%08x, text=%s", - // (Qt::Key)(event->key()), - // event->nativeVirtualKey(), - // event->nativeScanCode(), - // (quint32)(event->modifiers()), - // event->nativeModifiers(), - // event->text().toStdString().c_str()); +//#if defined(QT_DEBUG) +// qDebug("==== onViewKeyEvent:key=%d, nativeVirtualKey=0x%02x, nativeScanCode=0x%02x, modifiers=0x%08x, " +// "nativeModifiers=0x%08x, text=%s", +// (Qt::Key)(event->key()), +// event->nativeVirtualKey(), +// event->nativeScanCode(), +// (quint32)(event->modifiers()), +// event->nativeModifiers(), +// event->text().toStdString().c_str()); +//#endif CefKeyEvent e; MapQKeyEventToCefKeyEvent(event, e); diff --git a/src/details/QCefViewPrivate.h b/src/details/QCefViewPrivate.h index 8d7b0241..4d9fb95e 100644 --- a/src/details/QCefViewPrivate.h +++ b/src/details/QCefViewPrivate.h @@ -4,7 +4,6 @@ #include #include #include -#include #if defined(QT_DEBUG) #include @@ -16,10 +15,13 @@ #include "CCefClientDelegate.h" #include "QCefContextPrivate.h" +#include "QCefWindow.h" #include "utils/MenuBuilder.h" #include +class QAutoResizeWindow; + class QCefViewPrivate : public QObject { Q_OBJECT @@ -145,7 +147,7 @@ class QCefViewPrivate : public QObject /// /// /// - QWindow* qBrowserWindow_ = nullptr; + QCefWindow* qBrowserWindow_ = nullptr; /// /// diff --git a/src/details/QCefWindow.cpp b/src/details/QCefWindow.cpp new file mode 100644 index 00000000..608b5be1 --- /dev/null +++ b/src/details/QCefWindow.cpp @@ -0,0 +1,69 @@ +#include "QCefWindow.h" + +#include + +QCefWindow::QCefWindow() + : QWindow() +{ + setFlag(Qt::FramelessWindowHint); +} + +QCefWindow::~QCefWindow() +{ + qDebug() << this << "is being destructed"; +} + +void +QCefWindow::attachCefWindow(QWindow* win) +{ + detachCefWindow(); + cefWindow_ = win; + cefWindow_->setParent(this); +} + +void +QCefWindow::detachCefWindow() +{ + if (cefWindow_) { + cefWindow_->hide(); + cefWindow_->setParent(nullptr); + cefWindow_ = nullptr; + } +} + +QWindow* +QCefWindow::cefWindow() +{ + return cefWindow_; +} + +void +QCefWindow::exposeEvent(QExposeEvent* e) +{ + // + QWindow::exposeEvent(e); +} + +void +QCefWindow::resizeEvent(QResizeEvent* e) +{ + // + if (cefWindow_) { + cefWindow_->resize(e->size()); + } + QWindow::resizeEvent(e); +} + +void +QCefWindow::showEvent(QShowEvent* e) +{ + // + QWindow::showEvent(e); +} + +void +QCefWindow::hideEvent(QHideEvent* e) +{ + // + QWindow::hideEvent(e); +} diff --git a/src/details/QCefWindow.h b/src/details/QCefWindow.h new file mode 100644 index 00000000..1951d880 --- /dev/null +++ b/src/details/QCefWindow.h @@ -0,0 +1,36 @@ +#pragma once +#pragma region qt_headers +#include +#include +#include +#include +#include +#pragma endregion qt_headers + +class QCefWindow : public QWindow +{ +public: + using QWindow::QWindow; + + QCefWindow(); + + ~QCefWindow(); + + void attachCefWindow(QWindow* win); + + void detachCefWindow(); + + QWindow* cefWindow(); + +protected: + virtual void exposeEvent(QExposeEvent* e) override; + + virtual void resizeEvent(QResizeEvent* e) override; + + virtual void showEvent(QShowEvent* e) override; + + virtual void hideEvent(QHideEvent* e) override; + +protected: + QWindow* cefWindow_ = nullptr; +}; diff --git a/src/details/utils/CommonUtils.cpp b/src/details/utils/CommonUtils.cpp index 36f438a2..d6733648 100644 --- a/src/details/utils/CommonUtils.cpp +++ b/src/details/utils/CommonUtils.cpp @@ -1,112 +1 @@ #include "CommonUtils.h" -#include -#include -#include -#include - -#if defined(Q_OS_WINDOWS) || defined(Q_OS_WIN) -#include - -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) -HRGN -QRectToHRGN(const QRect& rc) -{ - return ::CreateRectRgn(rc.left(), rc.top(), rc.right() + 1, rc.bottom() + 1); -} - -HRGN -QRegionToHRGN(const QRegion& region) -{ - if (region.isNull() || region.rectCount() == 0) { - return 0; - } - - HRGN resultRgn = 0; - - QVector rects; -#if (QT_VERSION < QT_VERSION_CHECK(5, 11, 0)) - rects = region.rects(); -#else - std::copy(region.begin(), region.end(), std::back_inserter(rects)); -#endif - - resultRgn = QRectToHRGN(rects.at(0)); - const int size = rects.size(); - for (int i = 1; i < size; i++) { - HRGN tmpRgn = QRectToHRGN(rects.at(i)); - int err = ::CombineRgn(resultRgn, resultRgn, tmpRgn, RGN_OR); - if (err == ERROR) - qWarning("Error combining HRGNs."); - ::DeleteObject(tmpRgn); - } - return resultRgn; -} -#endif -#endif - -#if defined(Q_OS_LINUX) -#include -#include -#include -#include - -Display* -X11GetDisplay(QWidget* widget) -{ - Q_ASSERT_X(widget, "X11GetDisplay", "Invalid parameter widget"); - if (!widget) { - qWarning("Invalid parameter widget"); - return nullptr; - } - - auto platformInterface = QApplication::platformNativeInterface(); - Q_ASSERT_X(platformInterface, "X11GetDisplay", "Failed to get platform native interface"); - if (!platformInterface) { - qWarning("Failed to get platform native interface"); - return nullptr; - } - - auto screen = widget->window()->windowHandle()->screen(); - Q_ASSERT_X(screen, "X11GetDisplay", "Failed to get screen"); - if (!screen) { - qWarning("Failed to get screen"); - return nullptr; - } - - return (Display*)platformInterface->nativeResourceForScreen("display", screen); -} -#endif - -void -UpdateCefWindowMask(QWindow* w, const QRegion& r) -{ - if (w) { - // this doesn't work - // ncw.qBrowserWindow_->setMask(q->mask()); -#if defined(Q_OS_WINDOWS) || defined(Q_OS_WIN) - // for Windows - QPainterPath path; - path.addRegion(r); - QTransform transform = QTransform::fromScale(w->devicePixelRatio(), w->devicePixelRatio()); - QRegion scaledRegion = path.toFillPolygon(transform).toPolygon(); -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) - ::SetWindowRgn((HWND)w->winId(), QRegionToHRGN(scaledRegion), true); -#else - ::SetWindowRgn((HWND)w->winId(), scaledRegion.toHRGN(), true); -#endif -#elif defined(Q_OS_MACOS) - // for macOS -#elif defined(Q_OS_LINUX) - // for Linux -#endif - } -} - -void -XRemapWindow(QWidget* widget, QWindow* window) -{ -#if defined(Q_OS_LINUX) - if (::XMapWindow(X11GetDisplay(widget), window->winId()) <= 0) - qWarning() << "Failed to move input focus"; -#endif -} diff --git a/src/details/utils/CommonUtils.h b/src/details/utils/CommonUtils.h index 1025c7dc..13a52777 100644 --- a/src/details/utils/CommonUtils.h +++ b/src/details/utils/CommonUtils.h @@ -32,9 +32,3 @@ class FunctionLogger #else #define FLog() #endif - -void -UpdateCefWindowMask(QWindow* w, const QRegion& r); - -void -XRemapWindow(QWidget* widget, QWindow* window); From 9a9b55238b3c6f19763ebdb298fff4e612e2857b Mon Sep 17 00:00:00 2001 From: Sheen Tian Shen Date: Wed, 30 Aug 2023 19:08:14 +0800 Subject: [PATCH 2/5] Remove favicon download logic --- CefViewCore | 2 +- src/details/CCefClientDelegate.h | 1 - .../CCefClientDelegate_DisplayHandler.cpp | 22 ------------------- 3 files changed, 1 insertion(+), 24 deletions(-) diff --git a/CefViewCore b/CefViewCore index 8604b2c2..a6969ff3 160000 --- a/CefViewCore +++ b/CefViewCore @@ -1 +1 @@ -Subproject commit 8604b2c2aea4f2996cb2710fdc5e664474c12ae9 +Subproject commit a6969ff3f3438323f1b88fb4d3296d339b163cb0 diff --git a/src/details/CCefClientDelegate.h b/src/details/CCefClientDelegate.h index a03e0d6c..2a4fdfad 100644 --- a/src/details/CCefClientDelegate.h +++ b/src/details/CCefClientDelegate.h @@ -100,7 +100,6 @@ class CCefClientDelegate virtual void addressChanged(CefRefPtr& browser, int64_t frameId, const std::string& url) override; virtual void titleChanged(CefRefPtr& browser, const std::string& title) override; virtual void faviconURLChanged(CefRefPtr browser, const std::vector& icon_urls) override; - virtual void faviconChanged(CefRefPtr image) override; virtual void fullscreenModeChanged(CefRefPtr& browser, bool fullscreen) override; virtual bool tooltipMessage(CefRefPtr& browser, const std::string& text) override; virtual void statusMessage(CefRefPtr& browser, const std::string& value) override; diff --git a/src/details/CCefClientDelegate_DisplayHandler.cpp b/src/details/CCefClientDelegate_DisplayHandler.cpp index 44248066..1c7a4818 100644 --- a/src/details/CCefClientDelegate_DisplayHandler.cpp +++ b/src/details/CCefClientDelegate_DisplayHandler.cpp @@ -130,28 +130,6 @@ CCefClientDelegate::faviconURLChanged(CefRefPtr browser, const std:: pCefViewPrivate_->q_ptr->faviconURLChanged(urls); } -void -CCefClientDelegate::faviconChanged(CefRefPtr image) -{ - QIcon icon; - - int width = 0; - int height = 0; - CefRefPtr data = image->GetAsPNG(1.0, true, width, height); - int bufsize = (int)data->GetSize(); - if (bufsize > 0) { - QByteArray buffer(bufsize + 4, char(0)); - data->GetData(buffer.data(), bufsize, 0); - - QBitmap bitmap; - bitmap.loadFromData(buffer); - - icon = QIcon(bitmap); - } - - pCefViewPrivate_->q_ptr->faviconChanged(icon); -} - void CCefClientDelegate::fullscreenModeChanged(CefRefPtr& browser, bool fullscreen) { From 4d4cea9853d15f6e3de9060b85ccf13bf9ebf686 Mon Sep 17 00:00:00 2001 From: Sheen Tian Shen Date: Wed, 30 Aug 2023 20:51:24 +0800 Subject: [PATCH 3/5] Remove redundant code --- src/details/QCefWindow.cpp | 22 ---------------------- src/details/QCefWindow.h | 8 +------- 2 files changed, 1 insertion(+), 29 deletions(-) diff --git a/src/details/QCefWindow.cpp b/src/details/QCefWindow.cpp index 608b5be1..fe40647c 100644 --- a/src/details/QCefWindow.cpp +++ b/src/details/QCefWindow.cpp @@ -37,33 +37,11 @@ QCefWindow::cefWindow() return cefWindow_; } -void -QCefWindow::exposeEvent(QExposeEvent* e) -{ - // - QWindow::exposeEvent(e); -} - void QCefWindow::resizeEvent(QResizeEvent* e) { - // if (cefWindow_) { cefWindow_->resize(e->size()); } QWindow::resizeEvent(e); } - -void -QCefWindow::showEvent(QShowEvent* e) -{ - // - QWindow::showEvent(e); -} - -void -QCefWindow::hideEvent(QHideEvent* e) -{ - // - QWindow::hideEvent(e); -} diff --git a/src/details/QCefWindow.h b/src/details/QCefWindow.h index 1951d880..ada1b163 100644 --- a/src/details/QCefWindow.h +++ b/src/details/QCefWindow.h @@ -23,14 +23,8 @@ class QCefWindow : public QWindow QWindow* cefWindow(); protected: - virtual void exposeEvent(QExposeEvent* e) override; - virtual void resizeEvent(QResizeEvent* e) override; - virtual void showEvent(QShowEvent* e) override; - - virtual void hideEvent(QHideEvent* e) override; - -protected: +private: QWindow* cefWindow_ = nullptr; }; From 2d070ed881f7b926368dd6829744df7c16087c86 Mon Sep 17 00:00:00 2001 From: Sheen Tian Shen Date: Wed, 30 Aug 2023 21:35:05 +0800 Subject: [PATCH 4/5] Remove useless signal --- include/QCefView.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/include/QCefView.h b/include/QCefView.h index eb768bc0..46feb1c8 100644 --- a/include/QCefView.h +++ b/include/QCefView.h @@ -339,12 +339,6 @@ class QCEFVIEW_EXPORT QCefView : public QWidget /// The urls void faviconURLChanged(const QStringList& urls); - /// - /// Gets called on favicon changed - /// - /// The icon - void faviconChanged(const QIcon& icon); - /// /// Gets called on fullscreen mode changed /// From 5aa07031697955da584381c6880361cb98e68cd6 Mon Sep 17 00:00:00 2001 From: Sheen Tian Shen Date: Wed, 30 Aug 2023 21:39:49 +0800 Subject: [PATCH 5/5] Fix typo --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index fad40d96..0f5ae9de 100644 --- a/readme.md +++ b/readme.md @@ -50,7 +50,7 @@ QCefView supports CEF offscreen rendering mode and this feature is enabled by de config.setWindowlessRenderingEnabled(false) ``` -QCefView currently uses Qt Software Rasterizer as the backend paint engine for best compatibility, thus the rendering performance is not so good to be applied for all business scenarios. If you are going to host WegGL games, video sites or some other Web Apps with high rendering performance, Non OSR mode (Native Child Window mode) is recommended. +QCefView currently uses Qt Software Rasterizer as the backend paint engine for best compatibility, thus the rendering performance is not so good to be applied for all business scenarios. If you want to host WebGL games, video sites or some other Web Apps with high rendering performance, Non OSR mode (Native Child Window mode) is recommended. ## Question ### Why not OpenGL/DirectX/Metal?