Hi!

I have a very quick question.

To make things simple, the data my users will load will have some sort of events at specific time.
Each of this event is associated with a code.
I'm already able to draw a vertical line at the time of the event, and now, I want to display those codes on top of my plot at the specified time, above the lines.

Here's what I have for now:
Qt Code:
  1. void EventLabels::displayEvents(QVector<QVector<int>> eventToDisplay)
  2. {
  3. // eventToDisplay:
  4. // Event Position | Event Code
  5.  
  6. for (int i = 0; i < eventToDisplay.length(); i++)
  7. {
  8. QLabel *eventCode = new QLabel;
  9. eventCode->setText(QString::number(eventToDisplay[i][1]));
  10.  
  11. eventCode->setParent(this);
  12.  
  13. eventCode->move(eventToDisplay[0][1], 0);
  14. }
  15. }
To copy to clipboard, switch view to plain text mode 

I have to note that this function is a slot that receive data from another class. As the user can change the displayed data, the codes will change too each time the user push a button.
From what I find, this seems to be the best solution to precisely place QWidgets at specific position.
Did I miss something or is there a better way to do it?