hivemind 1.0.0
Loading...
Searching...
No Matches
keyframe_list.cpp
Go to the documentation of this file.
1#include "gui/keyframe_list.h"
2
4
5#include <QListWidgetItem>
6#include <QVariant>
7
8namespace Gui
9{
10
12 : QListWidget(parent), m_Layout(new QVBoxLayout(this))
13 {
14 setObjectName("KeyframeList");
15 Update();
16 }
17
18 void
20 {
21 clear();
22 auto& keyframes =
24 for (auto& keyframe : keyframes) {
25 QString itemText =
26 QString("AgentId: %1, TimeStamp: %2, X: %3, Y: %4, Z: %5")
27 .arg(keyframe.AgentId)
28 .arg(keyframe.TimeStamp)
29 .arg(keyframe.Position.X)
30 .arg(keyframe.Position.Y)
31 .arg(keyframe.Position.Z);
32 QListWidgetItem* item = new QListWidgetItem(itemText, this);
33 item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
34 item->setCheckState(Qt::Unchecked);
35 item->setData(Qt::UserRole, QVariant::fromValue(keyframe));
36 }
37 }
38
39 void
41 {
42 for (int i = count() - 1; i >= 0; --i) {
43 QListWidgetItem* itemToCheck = item(i);
44 if (itemToCheck->checkState() == Qt::Checked) {
46 itemToCheck->data(Qt::UserRole).value<Core::Keyframe>());
47 delete takeItem(i);
48 }
49 }
50 Update();
51 }
52
53} // namespace Gui
KeyframeList(QWidget *parent=nullptr)
void RemoveKeyframe(const Core::Keyframe &keyframe)
Removes a keyframe from the keyframe list.
static KeyframeManager & Instance()
Returns the singleton instance of the KeyframeManager.
std::vector< Core::Keyframe > & GetKeyframes()
Returns a reference to the list of keyframes.
Definition: action.h:6
A structure representing an agent's position in cartesian space at a given point in time.
Definition: types.h:69