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:
void EventLabels::displayEvents(QVector<QVector<int>> eventToDisplay)
{
// eventToDisplay:
// Event Position | Event Code
for (int i = 0; i < eventToDisplay.length(); i++)
{
eventCode
->setText
(QString::number(eventToDisplay
[i
][1]));
eventCode->setParent(this);
eventCode->move(eventToDisplay[0][1], 0);
}
}
void EventLabels::displayEvents(QVector<QVector<int>> eventToDisplay)
{
// eventToDisplay:
// Event Position | Event Code
for (int i = 0; i < eventToDisplay.length(); i++)
{
QLabel *eventCode = new QLabel;
eventCode->setText(QString::number(eventToDisplay[i][1]));
eventCode->setParent(this);
eventCode->move(eventToDisplay[0][1], 0);
}
}
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?
Bookmarks