winsoft666 / QCefWidget

A Qt widget that can render and interact with webpage.
GNU Lesser General Public License v3.0
263 stars 62 forks source link

使用frameless时,如果border设置为0,鼠标无法拖拽resize #20

Closed hcaihao closed 3 years ago

hcaihao commented 3 years ago

拖拽图标出不来,Chrome_RenderWidgetHostHWND窗口会把WM_NCHITTEST事件吃掉

winsoft666 commented 3 years ago

Yes, this is a bug.

winsoft666 commented 3 years ago

The reason is CEF render window covered the top level widget.

Can call setContentMargin of top level widget to reserve resize region, such as:

hlMain->setContentsMargins(2, 2, 2, 2);

Now QCefWidgetTester has support this feature.

hcaihao commented 3 years ago

之前的版本这样设置就不是无边框窗口了,我测试一下最新的code,感谢~

hcaihao commented 3 years ago

大问题解决了,很赞!

鼠标样式还有点小bug,我做了个动图演示一下:

动画

winsoft666 commented 3 years ago

why bing.com not be opened in your gif?

hcaihao commented 3 years ago

I don't know, build passed. It's a bug?

qt5.12.2+VS2019

QQ截图20210809110804

winsoft666 commented 3 years ago
  1. Update QCefWidget code to latest.
  2. Set CEF version macro:
    SET(CEF_VERSION_MAJOR 91)
    SET(CEF_VERSION_MINOR 1)
    SET(CEF_VERSION_PATCH 22)
hcaihao commented 3 years ago

sure, everything is done.

#
# Build environment
#

# QCefWidget Version
SET(QCEF_VERSION_MAJOR 1)
SET(QCEF_VERSION_MINOR 0)
SET(QCEF_VERSION_PATCH 3)

# The Qt SDK path
set(QT_SDK_DIR "C:/Qt/5.15.2/msvc2019")

# The root dir of the CEF SDK
set(CEF_SDK_DIR "${CMAKE_CURRENT_SOURCE_DIR}/dep/cef_binary_91.1.22+gc67b5dd+chromium-91.0.4472.124_windows32")
#set(CEF_SDK_DIR "${CMAKE_CURRENT_SOURCE_DIR}/dep/cef_binary_76.1.13+gf19c584+chromium-76.0.3809.132_windows32")
#set(CEF_SDK_DIR "${CMAKE_CURRENT_SOURCE_DIR}/dep/cef_binary_3.3626.1895.g7001d56_windows32")

# CEF version
SET(CEF_VERSION_MAJOR 91)
SET(CEF_VERSION_MINOR 1)
SET(CEF_VERSION_PATCH 22)

SET(QCEF_WING_EXE "QCefWing")
SET(QCEF_WIDGET_DLL "QCefWidget")
SET(QCEF_WIDGET_SDK_OUT_DIR "${CMAKE_SOURCE_DIR}/out")
hcaihao commented 3 years ago

I tried lastest code, it works. Thanks!

hcaihao commented 3 years ago

The reason is CEF render window covered the top level widget.

Can call setContentMargin of top level widget to reserve resize region, such as:

hlMain->setContentsMargins(2, 2, 2, 2);

Now QCefWidgetTester has support this feature.

The window cannot drag to resize if:

hlMain->setContentsMargins(0, 0, 0, 0);

I don't want border. How to do?

winsoft666 commented 3 years ago

Hook mouse event