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

QMimeData::html() returns undesirable meta data

XMLWordPrintable

    • Windows
    • 91ef7c19f4 (qt/qtwebengine/dev) 1d87b4c954 (qt/qtwebengine/6.2) 61c32f966f (qt/qtwebengine/6.3) 1d87b4c954 (qt/qtwebengine/6.2) 1d87b4c954 (qt/qtwebengine/6.2) 1d87b4c954 (qt/tqtc-qtwebengine/6.2) 61c32f966f (qt/qtwebengine/6.3.1)

      This hinders copy pasting from a webview. The bug wasn't there in 6.2.2.

      To reproduce, apply the diff below to the MarkDown Editor example. Run the app, select some text from the webview on the right, copy it (Ctrl+C), then select File > New.
      Observe the extra text at the start of the HTML:

      Version:0.9\r\nStartHTML:0000000132\r\nEndHTML:0000000741\r\nStartFragment:0000000168\r\nEndFragment:0000000705\r\nSourceURL:qrc:/index.html\r\n
      
      diff -ur a/mainwindow.cpp b/mainwindow.cpp
      --- a/mainwindow.cpp	2022-02-13 12:49:25.762492986 +1000
      +++ b/mainwindow.cpp	2022-02-13 12:49:25.794492396 +1000
      @@ -59,6 +59,9 @@
       #include <QStatusBar>
       #include <QTextStream>
       #include <QWebChannel>
      +#include <QClipboard>
      +#include <QMimeData>
      
      MainWindow::MainWindow(QWidget *parent) :
           QMainWindow(parent),
      @@ -120,6 +123,8 @@
      
      void MainWindow::onFileNew()
       {
      +    qInfo() << QGuiApplication::clipboard()->mimeData()->html();
      +    return;
           if (isModified()) {
               QMessageBox::StandardButton button = QMessageBox::question(this, windowTitle(),
                                    tr("You have unsaved changes. Do you want to create a new document anyway?"));
      

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

            pvarga Peter Varga
            rumo Georg Meier
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes