Closed opiater closed 9 months ago
@shenlebantongying can you check on this? Is this related with the following code https://github.com/xiaoyifang/goldendict/blob/eb1206945bab3b91fe8cf811a5c42fe82383ab63/article_maker.cc#L164-L166
闪现白色背景的问题在更新版本中依然存在。
Goldendict 23.02.07-alpha.230309.37e3df05 macos darwin 19.6.0 Qt 6.4.2 x86_64-little_endian-lp64 Clang 13.0.0 (clang-1300.0.29.30) Flags: MAKE_ZIM_SUPPORT MAKE_CHINESE_CONVERSION_SUPPORT
会不会是词典本身里面设置了白色背景
会不会是词典本身里面设置了白色背景
没有,也检查了配置文件夹里的qt-style.css和所用“附加样式”的article-style.css,没有或删除背景设置后,依然闪现白色背景。 你和其他用户没有这个问题吗?
It looks like we should also set background via https://doc.qt.io/qt-6/qwebenginepage.html#backgroundColor-prop
It looks like we should also set background via https://doc.qt.io/qt-6/qwebenginepage.html#backgroundColor-prop
I have tried this method, has not solved the white flash.
https://github.com/xiaoyifang/goldendict/tree/fix/darkmode-white-flash
I began to suspect that the white background flash is not caused by dark reader mode
.
This issue is only more significant in dark reader mode
I think the changes in the PR above is unrelated. Articleview.cc is a QFrame
while the doc that I linked is a QWebEnginePage
. This is yet another confusing "same method name but used for different class".
The setBackground should be used withArticleWebPage
.
Sadly, I tried and it does not work. Only the initial background is changed, and the white flash still exist when searching new words. It only removes the white flash when opening a new tab.
I think I figured out the actual problem, but I don't have a fix.
It is unrelated to Qt.
The white flash comes from Chromium when opening a new page. In chrome, you will get a similar white flash when navigating to a page on a different domain (We don't even change domain?? Maybe we can trick chromium to think we are on the same domain???).
When a search is initiated by a user, the code will end up at ArticleView::showDefinition
This req's url will be gdlookup://something
and will be loaded like opening a new webpage in chrome.
Here the "white flash" happens! It is the embedded chromium that shows white when open a new page.
Google those things will show some generic solutions:
Also see https://github.com/darkreader/darkreader/issues/3811
A fix if we cannot figure out something else: hide the ArticleView before loading a new page and show it up after the page is loaded)
Another fix: instead of reusing the same QWebEnginePage and QWebEnginePage::load, we can create a new page with setbackground(black) for every search, and swap out the existing one with QWebEngineView::setPage? This will destroy a page's history.
this extension can be installed in the chrome to enable the dark reader mode
I think the changes in the PR above is unrelated. Articleview.cc is a
QFrame
I think you have pointed the right place . I will try again to set this QFrame translucent background
no luck
Chrome with the Dark Reader extension doesn't solve the "white flash". Using a light theme, chrome will have the same kind of white flash. So there is no solution within chromium.
The QWebEnginePage.setBackground() only changes the initial background, and it does not affect the Chromium's background when loading a page.
So, I think hiding when the articleview during page loading is the best fix.
这个和深色模式没关系,只要背景不是白的就会闪一下白色,比如文章显示风格
换为经典
也是会闪白色。
Bot detected the issue body's language is not English, translate it automatically.
This has nothing to do with the dark mode, as long as the background is not white, it will flash white. For example, if the "article display style" is changed to "classic", it will also flash white.
Any update to this? Having the same issue as #957.
use the latest pre-release version . the possibility of white-flash has been reduced.
That fixed the issue for me. Thank you.
版本信息: Goldendict 23.02.07-alpha.230225.da004ee9 macos darwin 19.6.0 Qt 6.4.2 x86_64-little_endian-lp64 Clang 13.0.0 (clang-1300.0.29.30) Flags: MAKE_ZIM_SUPPORT MAKE_CHINESE_CONVERSION_SUPPORT
也就是说,未完全加载完前,会显示软件界面更下层的白色底色。 新增加的内置深色模式总体效果很好,不过这个闪现白底色的问题比较影响观感。