Add Sensor settings dialog
This commit is contained in:
parent
09f7e55b4e
commit
2fbfd1d458
6 changed files with 221 additions and 0 deletions
|
|
@ -4,6 +4,8 @@
|
|||
#include <QHeaderView>
|
||||
#include <QScroller>
|
||||
|
||||
#include "sensorsettingsdialog.h"
|
||||
|
||||
SensorListWidget::SensorListWidget(const bool showHidden, QWidget *parent): QTableWidget(parent),
|
||||
showHidden_(showHidden)
|
||||
{
|
||||
|
|
@ -15,12 +17,31 @@ SensorListWidget::SensorListWidget(const bool showHidden, QWidget *parent): QTab
|
|||
setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
|
||||
sensorsChanged(std::vector<Sensor>());
|
||||
verticalHeader()->hide();
|
||||
|
||||
connect(this, &QTableWidget::doubleClicked, this, &SensorListWidget::onDoubleClick);
|
||||
}
|
||||
|
||||
SensorListWidget::SensorListWidget(SensorStore& sensorStore, const bool showHidden,
|
||||
QWidget* parent): QTableWidget (parent), showHidden_(showHidden)
|
||||
{
|
||||
sensorsChanged(*(sensorStore.getSensors()));
|
||||
connect(this, &QTableWidget::doubleClicked, this, &SensorListWidget::onDoubleClick);
|
||||
}
|
||||
|
||||
void SensorListWidget::onDoubleClick(const QModelIndex &index)
|
||||
{
|
||||
if(index.isValid())
|
||||
{
|
||||
const Sensor& sensor = getSensorForIndex(index);
|
||||
SensorSettingsDialog diag(sensor, this);
|
||||
if(diag.exec())
|
||||
{
|
||||
Sensor updatedSensor = sensor;
|
||||
updatedSensor.name = diag.getName();
|
||||
updatedSensor.hidden = diag.getHidden();
|
||||
globalSensors.sensorGotState(updatedSensor, SENSOR_UPDATE_USER);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SensorListWidget::sensorsChanged(std::vector<Sensor> sensors)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue