marble
Go to the documentation of this file.
11 #include <QApplication>
13 #include <QContextMenuEvent>
20 m_contextMenu(new QMenu(this)),
21 m_copyAction(new QAction(this))
23 m_copyAction->setText(tr(
"Copy"));
24 m_copyAction->setIcon(QIcon(
":/icons/edit-copy.png"));
25 m_copyAction->setIconVisibleInMenu(
true);
26 m_copyAction->setToolTip(tr(
"Copy selected content"));
27 connect(m_copyAction, SIGNAL(triggered()),
28 this, SLOT(copySelectedText()));
29 m_contextMenu->addAction(m_copyAction);
30 setContextMenuPolicy(Qt::DefaultContextMenu);
35 m_copyAction->setEnabled(!selectedText().isEmpty());
36 m_contextMenu->exec(event->globalPos());
39 void MarbleWebView::copySelectedText()
41 const QString text = selectedText();
42 if (!text.isEmpty()) {
43 QClipboard *clipboard = QApplication::clipboard();
44 clipboard->setText(text);
50 if(event->modifiers() == Qt::ControlModifier &&
event->key() == Qt::Key_C) {
55 QWebView::keyPressEvent(event);
58 #include "MarbleWebView.moc"
void keyPressEvent(QKeyEvent *event)
void contextMenuEvent(QContextMenuEvent *event)
MarbleWebView(QWidget *parent=0)
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:38:51 by
doxygen 1.8.7 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.