diff --git a/source/RobotAPI/libraries/armem_gui/query_widgets/QueryWidget.cpp b/source/RobotAPI/libraries/armem_gui/query_widgets/QueryWidget.cpp index 9ae5212eb5bed29b1f5b7d9550091fa7b0cc955f..debe6276168a64688c9a14abb8afab396960e942 100644 --- a/source/RobotAPI/libraries/armem_gui/query_widgets/QueryWidget.cpp +++ b/source/RobotAPI/libraries/armem_gui/query_widgets/QueryWidget.cpp @@ -29,8 +29,8 @@ namespace armarx::armem { clear(); - snapshotSelectorWidget = std::make_unique<SnapshotSelectorWidget>(); - addTab(snapshotSelectorWidget->_widget, QString("Entity")); + _snapshotSelectorWidget = new SnapshotSelectorWidget(); + addTab(_snapshotSelectorWidget, QString("Entity")); } @@ -46,7 +46,7 @@ namespace armarx::armem .coreSegments().all() .providerSegments().all() .entities().all() - .snapshots(snapshotSelectorWidget->selector()); + .snapshots(_snapshotSelectorWidget->selector()); return qb.buildQueryInput(); } diff --git a/source/RobotAPI/libraries/armem_gui/query_widgets/QueryWidget.h b/source/RobotAPI/libraries/armem_gui/query_widgets/QueryWidget.h index 976b347df527a49445f341acc5a0895f7cb549d1..61fd198c68c9a7704e29dbada68c468ff2a7146c 100644 --- a/source/RobotAPI/libraries/armem_gui/query_widgets/QueryWidget.h +++ b/source/RobotAPI/libraries/armem_gui/query_widgets/QueryWidget.h @@ -1,7 +1,5 @@ #pragma once -#include <memory> - #include <QTabWidget> #include <RobotAPI/interface/armem/query.h> @@ -50,7 +48,7 @@ namespace armarx::armem private: - std::unique_ptr<SnapshotSelectorWidget> snapshotSelectorWidget; + SnapshotSelectorWidget* _snapshotSelectorWidget; }; diff --git a/source/RobotAPI/libraries/armem_gui/query_widgets/SnapshotSelectorWidget.cpp b/source/RobotAPI/libraries/armem_gui/query_widgets/SnapshotSelectorWidget.cpp index 05b5cc8f6b296b0342ce6437fbeaecf589e7a477..212b098488f010e72daf817c243ef80f520bbfa4 100644 --- a/source/RobotAPI/libraries/armem_gui/query_widgets/SnapshotSelectorWidget.cpp +++ b/source/RobotAPI/libraries/armem_gui/query_widgets/SnapshotSelectorWidget.cpp @@ -26,9 +26,8 @@ namespace armarx::armem SnapshotSelectorWidget::SnapshotSelectorWidget() { - _widget = new QWidget(); _pageLayout = new QVBoxLayout(); - _widget->setLayout(_pageLayout); + setLayout(_pageLayout); connect(this, &This::queryOutdated, this, &This::updateSelector); @@ -55,20 +54,15 @@ namespace armarx::armem // Build and add the forms. _queryForms.clear(); - addForm("All", std::make_unique<SnapshotFormAll>()); - addForm("Single", std::make_unique<SnapshotFormSingle>()); - addForm("Time Range", std::make_unique<SnapshotFormTimeRange>()); - addForm("Index Range", std::make_unique<SnapshotFormIndexRange>()); + addForm("All", new SnapshotFormAll()); + addForm("Single", new SnapshotFormSingle()); + addForm("Time Range", new SnapshotFormTimeRange()); + addForm("Index Range", new SnapshotFormIndexRange()); showSelectedForm(_queryComboBox->currentText()); updateSelector(); } - SnapshotSelectorWidget::~SnapshotSelectorWidget() - { - delete _widget; - } - void SnapshotSelectorWidget::updateSelector() { this->_selector = _queryForms.at(_queryComboBox->currentText())->makeEntitySelector(); @@ -83,11 +77,11 @@ namespace armarx::armem } } - void SnapshotSelectorWidget::addForm(const QString& key, std::unique_ptr<SnapshotForm>&& form) + void SnapshotSelectorWidget::addForm(const QString& key, SnapshotForm* form) { - auto r = _queryForms.emplace(key, std::move(form)); - _pageLayout->addWidget(r.first->second.get()); - connect(r.first->second.get(), &SnapshotForm::queryChanged, this, &This::updateSelector); + auto r = _queryForms.emplace(key, form); + _pageLayout->addWidget(r.first->second); + connect(r.first->second, &SnapshotForm::queryChanged, this, &This::updateSelector); } void SnapshotSelectorWidget::hideAllForms() diff --git a/source/RobotAPI/libraries/armem_gui/query_widgets/SnapshotSelectorWidget.h b/source/RobotAPI/libraries/armem_gui/query_widgets/SnapshotSelectorWidget.h index 8a1a74124668ad48512664fcda63a09c7e4b9467..98bc9927310c1e3c7fbb3b151c0c190c4251f4fe 100644 --- a/source/RobotAPI/libraries/armem_gui/query_widgets/SnapshotSelectorWidget.h +++ b/source/RobotAPI/libraries/armem_gui/query_widgets/SnapshotSelectorWidget.h @@ -25,7 +25,7 @@ namespace armarx::armem * Manages multiple forms which are hidden if not selected * (in order to keep their settings). */ - class SnapshotSelectorWidget : public QObject + class SnapshotSelectorWidget : public QWidget { Q_OBJECT using This = SnapshotSelectorWidget; @@ -33,7 +33,6 @@ namespace armarx::armem public: SnapshotSelectorWidget(); - ~SnapshotSelectorWidget(); armem::DataMode dataMode() const; @@ -62,20 +61,18 @@ namespace armarx::armem private: - void addForm(const QString& key, std::unique_ptr<SnapshotForm>&& form); + void addForm(const QString& key, SnapshotForm* form); public: - /// The parent widget. - QWidget* _widget; QVBoxLayout* _pageLayout; QComboBox* _queryComboBox; QCheckBox* _dataCheckBox; /// The forms for the different query types. Hidden when not selected. - std::map<QString, std::unique_ptr<SnapshotForm>> _queryForms; + std::map<QString, SnapshotForm*> _queryForms; client::query::SnapshotsSelector _selector;