From a23067c1811576654bc8482748c8b1e3c6247dc2 Mon Sep 17 00:00:00 2001 From: ccolin Date: Sat, 2 Jan 2021 01:51:52 +0100 Subject: add clicking to a collision to seek to it --- src/settings_pane.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/settings_pane.cc') diff --git a/src/settings_pane.cc b/src/settings_pane.cc index f37c14c..4e52d55 100644 --- a/src/settings_pane.cc +++ b/src/settings_pane.cc @@ -18,6 +18,8 @@ SettingsPane::SettingsPane(QWidget *parent) this, &SettingsPane::toggledTrajectories); connect(show_support_lines, &QCheckBox::stateChanged, this, &SettingsPane::toggledSupportLines); + connect(collisions, &QListWidget::itemClicked, + [&](QListWidgetItem *item) { emit collisionClicked(((CollisionItem *) item)->getFrame()); }); QFormLayout *layout = new QFormLayout; layout->addRow("Taille de la sphère de collision", sphere_radius); @@ -29,8 +31,9 @@ SettingsPane::SettingsPane(QWidget *parent) void SettingsPane::addCollision(int idA, int idB, int frame) { - QListWidgetItem *item = new QListWidgetItem(QString::number(frame) + ": " - + QString::number(idA) + " / " + QString::number(idB)); + CollisionItem *item = new CollisionItem(QString::number(frame) + ": " + + QString::number(idA) + " / " + QString::number(idB), + frame); item->setFlags(Qt::ItemIsEnabled | Qt::ItemNeverHasChildren); collisions->addItem(item); } -- cgit v1.2.3-70-g09d2