I am not sure what kind of widget you are using with your QStandardItems but I don't think you want to use a delegate in this situation simply listen for the QListWidget/QTreeWidget/QTableWidget::itemClicked ( QListWidgetItem * item ) signal
(most of the widgets that inherit QAbstractItemView provide a similar signal)
item->setData("www.mylink.com", Qt::UserRole);
...
{
QString mylink
= item
->data
(Qt
::UserRole).
toString();
}
QStandardItem* item = new QStandartItem("my text");
item->setData("www.mylink.com", Qt::UserRole);
...
void onItemClicked(QListWidgetItem * item)
{
QString mylink = item->data(Qt::UserRole).toString();
QDesktopServices::openUrl(QUrl(mylink));
}
To copy to clipboard, switch view to plain text mode
Generally you only need to use an item delegate if you want to display the items differently (like with an icon and on multiple lines etc)
Bookmarks