[education/rkward] rkward/windows: Replace the Qt5 workaround for showing xhtml pages
Thomas Friedrichsmeier
null at kde.org
Mon Nov 9 20:40:01 GMT 2026
Git commit 963a3ac4637d5cffc36b0f0ce642dc54859fd90b by Thomas Friedrichsmeier.
Committed on 09/11/2026 at 20:39.
Pushed by tfry into branch 'master'.
Replace the Qt5 workaround for showing xhtml pages
The old bug now seems fixed, but QWebEnginePage does not report xhtml as
being supported, despite being able to show it *if* it is set via
openUrl(), rather than setHTML().
M +7 -13 rkward/windows/rkhtmlwindow.cpp
M +2 -1 rkward/windows/rkqwebenginewidget.cpp
https://invent.kde.org/education/rkward/-/commit/963a3ac4637d5cffc36b0f0ce642dc54859fd90b
diff --git a/rkward/windows/rkhtmlwindow.cpp b/rkward/windows/rkhtmlwindow.cpp
index f87715231..184483192 100644
--- a/rkward/windows/rkhtmlwindow.cpp
+++ b/rkward/windows/rkhtmlwindow.cpp
@@ -343,6 +343,7 @@ bool RKHTMLWindow::openURL(const QUrl &url) {
if (url == current_url) restore_position = page->scrollPosition();
QMimeType mtype = QMimeDatabase().mimeTypeForUrl(url);
+ RK_DEBUG(APP, DL_DEBUG, "openURL %s, mime type %s", qPrintable(url.toString()), qPrintable(mtype.name()));
if (window_mode == HTMLOutputWindow) {
if (url != current_url) {
// output window should not change url after initialization open any links in new windows
@@ -366,19 +367,12 @@ bool RKHTMLWindow::openURL(const QUrl &url) {
QFileInfo out_file(url.toLocalFile());
bool ok = out_file.exists();
if (ok) {
- if (!mtype.inherits(QStringLiteral("text/html"))) {
- RK_DEBUG(APP, DL_WARNING, "Applying workaround for https://bugs.kde.org/show_bug.cgi?id=405386");
- QFile f(url.toLocalFile());
- RK_ASSERT(f.open(QIODevice::ReadOnly));
- page->setHTML(QString::fromUtf8(f.readAll()), url.adjusted(QUrl::RemoveFilename));
- f.close();
- } else {
- // NOTE: Quirk in Qt 6.7: When first loading a page, the window is somehow brought to the front, again. In preview windows
- // (initially hidden), this leads to a strange pulsing effect. Delay the actual page load until the window is
- // actually shown (showEvent(), below).
- // With this, the flicker is still there, but feels more "natural"
- if (isVisible()) page->load(url);
- }
+ // NOTE: Quirk in Qt 6.7: When first loading a page, the window is somehow brought to the front, again. In preview windows
+ // (initially hidden), this leads to a strange pulsing effect. Delay the actual page load until the window is
+ // actually shown (showEvent(), below).
+ // With this, the flicker is still there, but feels more "natural"
+ if (isVisible()) page->load(url);
+
if (!restore_position.isNull()) page->setScrollPosition(restore_position, true);
} else {
RK_DEBUG(APP, DL_WARNING, "Attempt to open non-existant local file %s", qPrintable(url.toLocalFile()));
diff --git a/rkward/windows/rkqwebenginewidget.cpp b/rkward/windows/rkqwebenginewidget.cpp
index 45a85dbcf..37e74c581 100644
--- a/rkward/windows/rkqwebenginewidget.cpp
+++ b/rkward/windows/rkqwebenginewidget.cpp
@@ -319,7 +319,8 @@ void RKQWebEngineWidget::zoomOut() {
bool RKQWebEngineWidget::supportsContentType(const QString &mimename) {
RK_TRACE(APP);
- return page->supportsContentType(mimename);
+ // QWebEnginge 6.12 will not report application/xhtml+xml as supported, but does open it...
+ return page->supportsContentType(mimename) || mimename.contains(u"html"_s);
}
void RKQWebEngineWidget::print() {
More information about the rkward-tracker
mailing list