Changeset View
Changeset View
Standalone View
Standalone View
src/tablesdialog.cpp
Show First 20 Lines • Show All 261 Lines • ▼ Show 20 Line(s) | |||||
262 | } | 262 | } | ||
263 | 263 | | |||
264 | MyTableWidget::MyTableWidget(QWidget* parent) : QTableWidget(parent) | 264 | MyTableWidget::MyTableWidget(QWidget* parent) : QTableWidget(parent) | ||
265 | { | 265 | { | ||
266 | } | 266 | } | ||
267 | 267 | | |||
268 | void MyTableWidget::contextMenuEvent(QContextMenuEvent* event) | 268 | void MyTableWidget::contextMenuEvent(QContextMenuEvent* event) | ||
269 | { | 269 | { | ||
270 | QMenu* menu = new QMenu((QWidget*) sender()); | 270 | QMenu* menu = new QMenu(static_cast<QWidget*>(sender())); | ||
271 | menu->addAction(i18n("&Copy"), this, SLOT(copyToClipboard()), QKeySequence(Qt::Key_C | Qt::CTRL)); | 271 | menu->addAction(i18n("&Copy"), this, SLOT(copyToClipboard()), QKeySequence(Qt::Key_C | Qt::CTRL)); | ||
272 | menu->exec(event->globalPos()); | 272 | menu->exec(event->globalPos()); | ||
273 | } | 273 | } | ||
274 | 274 | | |||
275 | void MyTableWidget::copyToClipboard() | 275 | void MyTableWidget::copyToClipboard() | ||
276 | { | 276 | { | ||
277 | QApplication::clipboard()->setText(currentItem()->data(QTableWidgetItem::Type).toString()); | 277 | QApplication::clipboard()->setText(currentItem()->data(QTableWidgetItem::Type).toString()); | ||
278 | } | 278 | } | ||
279 | 279 | |