It wasn't mimeData(), but franz set me a track of where to look. QAbstractItemView::keyPressEvent() handles Ctrl+C:
if (d->model)
variant = d->model->data(currentIndex(), Qt::DisplayRole);
event->accept();
}
if (event == QKeySequence::Copy) {
QVariant variant;
if (d->model)
variant = d->model->data(currentIndex(), Qt::DisplayRole);
if (variant.type() == QVariant::String)
QApplication::clipboard()->setText(variant.toString());
event->accept();
}
To copy to clipboard, switch view to plain text mode
You can see that it gets some string data from currentIndex(), which is a single item: it's not going to handle multiple selected items. So I have to subclass QListWidget and reimplement keyPressEvent() to make this work the way I want.
Bookmarks