CefView / QCefView

A Qt Widget encapsulated CEF view based on QWidget
https://cefview.github.io/QCefView/
GNU Lesser General Public License v2.1
547 stars 144 forks source link

在Mac下使用demo打开网页,发现编辑框不支持command+a/command+c等等 #83

Closed zzstack closed 2 years ago

zzstack commented 2 years ago

在Mac下使用demo打开网页,发现编辑框不支持command+a/command+c等等

tishion commented 2 years ago

什么模式?OSR么?

Get Outlook for Androidhttps://aka.ms/AAb9ysg


From: zzstack @.> Sent: Saturday, April 23, 2022 5:43:30 PM To: CefView/QCefView @.> Cc: Subscribed @.***> Subject: [CefView/QCefView] 在Mac下使用demo打开网页,发现编辑框不支持command+a/command+c等等 (Issue #83)

在Mac下使用demo打开网页,发现编辑框不支持command+a/command+c等等

― Reply to this email directly, view it on GitHubhttps://github.com/CefView/QCefView/issues/83, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABMZC4XQZUBSIF3MYVKJJDLVGPA4FANCNFSM5UEOWLEA. You are receiving this because you are subscribed to this thread.Message ID: @.***>

zzstack commented 2 years ago

不是,非离屏的,04-16 clone的代码,还没试最新的。不过我看最近的commit不像是有相关的改动

tishion commented 2 years ago

最近改动只是OSR模式,你看看是不是你的快捷键设置问题,明天有空我再看一下。

Get Outlook for Androidhttps://aka.ms/AAb9ysg


From: zzstack @.> Sent: Saturday, April 23, 2022 5:58:21 PM To: CefView/QCefView @.> Cc: Sheen Tian @.>; Comment @.> Subject: Re: [CefView/QCefView] 在Mac下使用demo打开网页,发现编辑框不支持command+a/command+c等等 (Issue #83)

不是,非离屏的,04-16 clone的代码,还没试最新的。不过我看最近的commit不像是有相关的改动

― Reply to this email directly, view it on GitHubhttps://github.com/CefView/QCefView/issues/83#issuecomment-1107444784, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABMZC4X2YU5PPLIGLQ2MSILVGPCT3ANCNFSM5UEOWLEA. You are receiving this because you commented.Message ID: @.***>

zzstack commented 2 years ago

应该不是,我用CEF自带的cef simple是正常的,我晚点试试最新代码

zzstack commented 2 years ago

用最新的代码验证了下,有一样的问题。如果你那边不能复现,可能的区别: QT我用的5.14.2; Mac我是M1,编译的X86_64版本

codeIreneFFM commented 2 years ago

各位大神,QT小白请教个问题。MacBook M1,安装了QT CMake。下载了QCefViewTest文件夹,在QTCreator 中打开CMakeLists.txt 文件,在QTCrealtor 里面右键点击QCefViewTest工程(前面有个黄色的三角感叹号),Run Cmake报错。 请问是我打开工程有问题么?怎么才能在Mac上利用QTCreator 跑起来QCefViewTest呢?感谢

tishion commented 2 years ago

用最新的代码验证了下,有一样的问题。如果你那边不能复现,可能的区别: QT我用的5.14.2; Mac我是M1,编译的X86_64版本

mac版本目前无论是OSR还是非OSR都有问题,建议先不要使用了。Windows和Linux的OSR已经全部完成,我会集中精力修复macOS版本。

tishion commented 2 years ago

各位大神,QT小白请教个问题。MacBook M1,安装了QT CMake。下载了QCefViewTest文件夹,在QTCreator 中打开CMakeLists.txt 文件,在QTCrealtor 里面右键点击QCefViewTest工程(前面有个黄色的三角感叹号),Run Cmake报错。 请问是我打开工程有问题么?怎么才能在Mac上利用QTCreator 跑起来QCefViewTest呢?感谢

贴出你的错误。或者不用Qt Creator,如果你熟悉xCode的话,直接运行generate-mac-proj.sh脚本生成xcode工程,然后使用xcode开发。

codeIreneFFM commented 2 years ago

感谢大神,QTCreator 报下面的错。 Running /Users/wangyue/Qt/Tools/CMake/CMake.app/Contents/bin/cmake -S /Users/wangyue/Documents/PCCode/QTCEF/QCefView/example/QCefViewTest -B /Users/wangyue/Documents/PCCode/QTCEF/QCefView/example/build-QCefViewTest-Qt_6_2_4_for_macOS-Debug -DCMAKE_GENERATOR:STRING=Ninja -DCMAKE_BUILD_TYPE:STRING=Debug '-DCMAKE_PROJECT_INCLUDE_BEFORE:FILEPATH=/Users/wangyue/Qt/Qt Creator.app/Contents/Resources/package-manager/auto-setup.cmake' -DQT_QMAKE_EXECUTABLE:FILEPATH=/Users/wangyue/Qt/6.2.4/macos/bin/qmake -DCMAKE_PREFIX_PATH:PATH=/Users/wangyue/Qt/6.2.4/macos -DCMAKE_C_COMPILER:FILEPATH=/usr/bin/clang -DCMAKE_CXX_COMPILER:FILEPATH=/usr/bin/clang++ in /Users/wangyue/Documents/PCCode/QTCEF/QCefView/example/build-QCefViewTest-Qt_6_2_4_for_macOS-Debug. -- The C compiler identification is AppleClang 13.0.0.13000029 -- The CXX compiler identification is AppleClang 13.0.0.13000029 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /usr/bin/clang - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /usr/bin/clang++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Looking for pthread.h -- Looking for pthread.h - found -- Performing Test CMAKE_HAVE_LIBC_PTHREAD -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success -- Found Threads: TRUE
-- Performing Test HAVE_STDATOMIC -- Performing Test HAVE_STDATOMIC - Success -- Found WrapAtomic: TRUE
-- Found OpenGL: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/System/Library/Frameworks/OpenGL.framework
-- Found WrapOpenGL: TRUE
CMake Error at CMakeLists.txt:209 (set_target_properties): set_target_properties Can not find target to add properties to: QCefViewTest

CMake Error at CMakeLists.txt:214 (target_link_libraries): Cannot specify link libraries for target "QCefViewTest" which is not built by this project.

-- Configuring incomplete, errors occurred! See also "/Users/wangyue/Documents/PCCode/QTCEF/QCefView/example/build-QCefViewTest-Qt_6_2_4_for_macOS-Debug/CMakeFiles/CMakeOutput.log". CMake process exited with exit code 1.

Elapsed time: 00:01.

Running /Users/wangyue/Qt/Tools/CMake/CMake.app/Contents/bin/cmake -S /Users/wangyue/Documents/PCCode/QTCEF/QCefView/example/QCefViewTest -B /Users/wangyue/Documents/PCCode/QTCEF/QCefView/example/build-QCefViewTest-Qt_6_2_4_for_macOS-Debug in /Users/wangyue/Documents/PCCode/QTCEF/QCefView/example/build-QCefViewTest-Qt_6_2_4_for_macOS-Debug. -- Configuring incomplete, errors occurred! See also "/Users/wangyue/Documents/PCCode/QTCEF/QCefView/example/build-QCefViewTest-Qt_6_2_4_for_macOS-Debug/CMakeFiles/CMakeOutput.log". CMake Error at CMakeLists.txt:209 (set_target_properties): set_target_properties Can not find target to add properties to: QCefViewTest

CMake Error at CMakeLists.txt:214 (target_link_libraries): Cannot specify link libraries for target "QCefViewTest" which is not built by this project.

CMake process exited with exit code 1.

Elapsed time: 00:00.

我的运行环境:MacBook Pro M1,QTCreator 7.0.0,based on QT 6.2.3 (Clang 13.0,64bit), Kits: Qt 6.2.4 for macOS(default), Cmake: 3.23.0

tishion commented 2 years ago

@codeIreneFFM

Qt Creator打开根目录的CMakeList.txt

codeIreneFFM commented 2 years ago

感谢大神,QTCreator打开根目录的CMakeList, 右健点击QCefView 选择Run Cmake,成功build了工程。在QCefView 目录的同级目录下生成了一个build-QCefView-Qt_6_2_4_for_macOS-Debug 文件夹。 但是我在这个build-QCefView-Qt_6_2_4_for_macOS-Debug 文件夹里没找到QCefViewTest相关的文件和.pro文件, 请问一下大神,我怎么在QTCreator里面跑起来 QCefViewTest这个工程呢?

tishion commented 2 years ago

BUILD_DEMO开关打开,如果你确实很新手,建议先系统学习一下CMake和Qt Creator的使用。

codeIreneFFM commented 2 years ago

好的大神。 另外我通过generate-mac-proj.sh 生成了xcodeproj 文件。 在隐藏目录.build/MacOS里面找到了QCefView.xcodeproj 文件,用Xcode 打开了这个文件。 其中CefViewCore,CefViewWing,都可以Build Succeed。但是运行QCefViewTest这个target的时候Build Failed 了。报了一个问题是: ld: warning: ignoring file /Users/wangyue/Documents/PCCode/QTCEF/QCefView/.build/macOS/CefViewCore/output/Debug/lib/CefViewCore.framework/CefViewCore, building for macOS-arm64 but attempting to link with file built for macOS-x86_64 ld: warning: ignoring file /Users/wangyue/Documents/PCCode/QTCEF/QCefView/.build/macOS/CefViewCore/output/Debug/lib/libcef_dll_wrapper.a, building for macOS-arm64 but attempting to link with file built for macOS-x86_64 ld: warning: ignoring file /Users/wangyue/Documents/PCCode/QTCEF/QCefView/CefViewCore/dep/cef_binary_95.7.12+g99c4ac0+chromium-95.0.4638.54_macosx64/Debug/cef_sandbox.a, building for macOS-arm64 but attempting to link with file built for macOS-x86_64 Undefined symbols for architecture arm64: "CefShutdown()", referenced from: QCefContextPrivate::uninitializeCef() in QCefContextPrivate_mac.o

看问题是我电脑是arm64的,但是程序找的是X86的包,请问怎么调试呢? 对QTCreator 确实不熟,XCode又运行不起来。感谢。

zzstack commented 2 years ago

好的大神。 另外我通过generate-mac-proj.sh 生成了xcodeproj 文件。 在隐藏目录.build/MacOS里面找到了QCefView.xcodeproj 文件,用Xcode 打开了这个文件。 其中CefViewCore,CefViewWing,都可以Build Succeed。但是运行QCefViewTest这个target的时候Build Failed 了。报了一个问题是: ld: warning: ignoring file /Users/wangyue/Documents/PCCode/QTCEF/QCefView/.build/macOS/CefViewCore/output/Debug/lib/CefViewCore.framework/CefViewCore, building for macOS-arm64 but attempting to link with file built for macOS-x86_64 ld: warning: ignoring file /Users/wangyue/Documents/PCCode/QTCEF/QCefView/.build/macOS/CefViewCore/output/Debug/lib/libcef_dll_wrapper.a, building for macOS-arm64 but attempting to link with file built for macOS-x86_64 ld: warning: ignoring file /Users/wangyue/Documents/PCCode/QTCEF/QCefView/CefViewCore/dep/cef_binary_95.7.12+g99c4ac0+chromium-95.0.4638.54_macosx64/Debug/cef_sandbox.a, building for macOS-arm64 but attempting to link with file built for macOS-x86_64 Undefined symbols for architecture arm64: "CefShutdown()", referenced from: QCefContextPrivate::uninitializeCef() in QCefContextPrivate_mac.o

看问题是我电脑是arm64的,但是程序找的是X86的包,请问怎么调试呢? 对QTCreator 确实不熟,XCode又运行不起来。感谢。

快捷点,你直接把xcode工程里面的Architectures改成x86_64,如果不知道怎么改这个,可以按照关键词去搜索下

zzstack commented 2 years ago

或者直接换个非M1的mac 😏

zzstack commented 2 years ago

用最新的代码验证了下,有一样的问题。如果你那边不能复现,可能的区别: QT我用的5.14.2; Mac我是M1,编译的X86_64版本

mac版本目前无论是OSR还是非OSR都有问题,建议先不要使用了。Windows和Linux的OSR已经全部完成,我会集中精力修复macOS版本。

👌 确认问题就好,我研究下

zzstack commented 2 years ago

怀疑是mac版本在消息循环这里处理的有问题,其他也不太可能了

tishion commented 2 years ago

不是消息循环问题,是cmd键消息被窗口接收处理了,没有发送到QCefView,需要做个eventfilter,我还没开始处理这些细枝末节问题,因为现在mac的OSR渲染还有点问题没解决。

Get Outlook for Androidhttps://aka.ms/AAb9ysg


From: zzstack @.> Sent: Wednesday, April 27, 2022 12:17:51 AM To: CefView/QCefView @.> Cc: Sheen Tian @.>; Assign @.> Subject: Re: [CefView/QCefView] 在Mac下使用demo打开网页,发现编辑框不支持command+a/command+c等等 (Issue #83)

怀疑是mac版本在消息循环这里处理的有问题,其他也不太可能了

― Reply to this email directly, view it on GitHubhttps://github.com/CefView/QCefView/issues/83#issuecomment-1109992028, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABMZC4RK2CI7YQNBKNFHUR3VHAJK5ANCNFSM5UEOWLEA. You are receiving this because you were assigned.Message ID: @.***>

zzstack commented 2 years ago

是我们哪里已经有拦截消息事件了吗?因为其他的基于QT/CEF的程序都没有做eventfilter,不过我没试对不对。

tishion commented 2 years ago

@zzstack Fixed https://github.com/CefView/QCefView/commit/3b64efc06f91bab1f807039a7186cc9a47748637

zzstack commented 2 years ago

get

codeIreneFFM commented 2 years ago

@zzstack @tishion 两位大神,真的是找了太多资料后想到了这里有2位大佬获取可以解答一下疑惑。QT在Mac OS上的资料真的太少了,我用QTCreator, MacOS, 想要发送一个https请求,header里面有RSA-SHA1签名。 资料都说用openssl 的RSA,我在terminal上打印, wangyue@Irenes-MacBook-Pro Qt-Secret % openssl version LibreSSL 2.8.3。 是有openssl的。 发送普通的https请求可以成功。现在就是不知道怎么样引入openssl/rsa.h 文件。 请教2位大神能不能指点一下,怎么使用RSA加签?