Hello,
I am designing an interface with Qt and I would like to have a list of elements (alerts). From what I have seen, the way to go would be a QListWidget with QListWidgetItems. To design the UI, I have used a custom subclass of QAbstractItemDelegate and I have reimplemented the paint method. What I have for now is this:

Screenshot 2016-09-27 15.18.01.png

with the following code:

AlertListDelegate.cpp:

Qt Code:
  1. void AlertListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const
  2. {
  3. QRect r = option.rect;
  4.  
  5. QString title = index.data(Qt::DisplayRole).toString();
  6. QString description = index.data(Qt::UserRole).toString();
  7.  
  8. int imageSpace = 10;
  9.  
  10. //TITLE
  11. r = option.rect.adjusted(imageSpace, 0, -10, -30);
  12. painter->setFont(QFont( "Lucida Grande", 12, QFont::Normal));
  13. painter->drawText(r.left(), r.top(), r.width(), r.height(), Qt::AlignBottom|Qt::AlignLeft, title, &r);
  14.  
  15. //DESCRIPTION
  16. r = option.rect.adjusted(imageSpace, 30, -10, 0);
  17. painter->setFont(QFont("Lucida Grande", 10, QFont::Normal));
  18. painter->drawText(r.left(), r.top(), r.width(), r.height(), Qt::AlignLeft, description, &r);
  19. }
To copy to clipboard, switch view to plain text mode 

mainwindow.cpp:

Qt Code:
  1. QListWidget* myListWidget = new QListWidget();
  2. myListWidget->setItemDelegate(new AlertListDelegate(myListWidget));
  3.  
  4. item->setData(Qt::DisplayRole, "Title");
  5. item->setData(Qt::UserRole, "Description");
  6. myListWidget->addItem(item);
  7.  
  8. item2->setData(Qt::DisplayRole, "Title2");
  9. item2->setData(Qt::UserRole, "Description2");
  10. myListWidget->addItem(item2);
  11.  
  12. item3->setData(Qt::DisplayRole, "Title3");
  13. item3->setData(Qt::UserRole, "Description3");
  14. myListWidget->addItem(item3);
To copy to clipboard, switch view to plain text mode 

Now comes my problem: I would like to add some actions buttons into the interface (pushButtons for each alert that you can click). However I don't really see how to achieve this from the documentation or various examples. Maybe the paint method is not the way to do this but then how can I do it?

Also, I would like to have more elements in my Alert model (like a date, a time or some more details) and it seems like there are no "right" Qt roles to do it. Should I create a custom role enum to do it? I have not seen much examples about this.
Thank you for your help!