[Qt-interest] QWebView Ctrl+C keyboard shortcut does not work
Harri Pasanen
grego at mpaja.com
Mon Apr 25 10:29:18 CEST 2011
Hi,
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
now when using the set shortcut (which appears in menu).
I tested this on Linux, using QtSDK 1.1 RC for desktop, 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 Qt-interest-old
mailing list