Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-125455

Linux: Support WebKitGTK backend

    XMLWordPrintable

Details

    • User Story
    • Resolution: Unresolved
    • Not Evaluated
    • None
    • 5.15, 6.2, 6.5, 6.7
    • WebView
    • None
    • Linux/X11

    Description

      Build the following code:

      #include <QApplication>
      #include <QWidget>
      #include <QWindow>
      
      extern "C" {
      #include <gdk/gdkx.h>
      #include <gtk/gtk.h>
      #include <webkit2/webkit2.h>
      }
      
      int main(int argc, char *argv[]) {
      	QApplication app(argc, argv);
      	gtk_init(nullptr, nullptr);
      	const auto window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
      	const auto webview = webkit_web_view_new();
      	webkit_web_view_load_uri(WEBKIT_WEB_VIEW(webview), "https://google.com");
      	gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(webview));
      	gtk_widget_show_all(window);
      	QWidget::createWindowContainer(QWindow::fromWinId(gdk_x11_window_get_xid(gtk_widget_get_window(window))))->show();
      	return app.exec();
      }
      

      With g++ -o main main.cpp -DQT_NO_KEYWORDS $(pkg-config --cflags --libs Qt6Core Qt6Gui Qt6Widgets webkit2gtk-4.0).

      If I run it on KDE Neon X11, it works just fine: I see Google. If I run it on Ubuntu (GNOME) 22.04 X11, I see only white or black screen. If I move the cursor, it acts like it recognizes the elements on web page. If I right click, I get context menu from webkit. It just doesn't display the content on screen.

      Attachments

        1. image-2024-05-19-02-06-25-523.png
          97 kB
          Ilya Fedin
        2. image-2024-05-22-13-29-43-006.png
          93 kB
          Tor Arne Vestbø

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              stromme Christian
              ilya-fedin Ilya Fedin
              Votes:
              3 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes