[webkit-qt] QWebView copy shortcut problem

Harri Pasanen grego at mpaja.com
Tue Apr 26 01:07:12 PDT 2011


Hi,

I posted the below at Qt-Interest, but as it appears to be webkit specific, 
perhaps this is a better place.  If I should file a bug, would it be at webkit 
bugzilla?

For some reason QWebView does not by default have Ctrl+C associated with copy.
But setting it manually does not work either, code follows:

----8<---------8<---------8<---------8<---------8<---------8<---------8<---------8<--------
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QDebug>

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    ui->webView->setHtml("<html><body>Try Ctrl+C copy text, does not 
work</body></html>");

    QAction *act = ui->webView->pageAction(QWebPage::Copy);
    qDebug() << act->shortcut();
    act->setShortcut(QKeySequence::Copy);
    qDebug() << act->shortcut();  // also appears in right click menu, but 
does not work.
}

MainWindow::~MainWindow()
{
    delete ui;
}
----8<---------8<---------8<---------8<---------8<---------8<---------8<---------8<--------


The copy works when invoked through the right click menu on marked region, but 
not when using the set shortcut (which appears in menu).

I tested this on Linux (Kubuntu 10.10 amd64), using QtSDK 1.1 RC for desktop, 
but also tried with homebrew 4.7.2 compiled with Visual C++ 2010.

Am I missing something subtle, or should I file a bug?




Harri
http://mpaja.com/


More information about the webkit-qt mailing list