diff --git a/source/RobotAPI/libraries/armem_gui/CMakeLists.txt b/source/RobotAPI/libraries/armem_gui/CMakeLists.txt index d90a90aa04a3fcc2c3d891bfab8727a991522f44..46d1d14165082c0699fe074490a3c590e5c86543 100644 --- a/source/RobotAPI/libraries/armem_gui/CMakeLists.txt +++ b/source/RobotAPI/libraries/armem_gui/CMakeLists.txt @@ -24,6 +24,7 @@ set(SOURCES instance/GroupBox.cpp instance/ImageView.cpp instance/InstanceView.cpp + instance/InstanceViewWithToolBar.cpp instance/sanitize_typename.cpp instance/serialize_path.cpp @@ -57,6 +58,7 @@ set(HEADERS instance/GroupBox.h instance/ImageView.h instance/InstanceView.h + instance/InstanceViewWithToolBar.h instance/sanitize_typename.h instance/serialize_path.h diff --git a/source/RobotAPI/libraries/armem_gui/instance/InstanceView.cpp b/source/RobotAPI/libraries/armem_gui/instance/InstanceView.cpp index f7518291e2ad40f6e657af751e54c80644c88364..8e82b4a7e7457a31865f28819888b825ae2806c8 100644 --- a/source/RobotAPI/libraries/armem_gui/instance/InstanceView.cpp +++ b/source/RobotAPI/libraries/armem_gui/instance/InstanceView.cpp @@ -29,6 +29,8 @@ #include <RobotAPI/libraries/armem_gui/instance/tree_builders/DataTreeBuilder.h> #include <RobotAPI/libraries/armem_gui/instance/tree_builders/TypedDataTreeBuilder.h> +#include "InstanceViewWithToolBar.h" + namespace armarx::armem::gui::instance { @@ -126,6 +128,7 @@ namespace armarx::armem::gui::instance update(); } + void InstanceView::update() { if (currentInstance) @@ -142,13 +145,14 @@ namespace armarx::armem::gui::instance void InstanceView::addInstanceView(const wm::EntityInstance& instance, aron::typenavigator::ObjectNavigatorPtr aronType) { - ARMARX_IMPORTANT << "Adding instance view for instance: " << instance.id(); - InstanceView* child = new InstanceView(); - child->setStatusLabel(statusLabel); - child->setUseTypeInfo(useTypeInfo); + ARMARX_IMPORTANT << "Adding instance view with toolbar for instance: " << instance.id(); + InstanceViewWithToolBar* child = new InstanceViewWithToolBar(); + child->view->setStatusLabel(statusLabel); + child->view->setUseTypeInfo(useTypeInfo); + splitter->addWidget(child); - child->update(instance, aronType); + child->view->update(instance, aronType); } diff --git a/source/RobotAPI/libraries/armem_gui/instance/InstanceViewWithToolBar.cpp b/source/RobotAPI/libraries/armem_gui/instance/InstanceViewWithToolBar.cpp new file mode 100644 index 0000000000000000000000000000000000000000..0f0493a23ece7af2a7756e387a367408c3fa5873 --- /dev/null +++ b/source/RobotAPI/libraries/armem_gui/instance/InstanceViewWithToolBar.cpp @@ -0,0 +1,68 @@ +/* +* This file is part of ArmarX. +* +* ArmarX is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +* +* ArmarX is distributed in the hope that it will be useful, but +* WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see <http://www.gnu.org/licenses/>. +* +* @package ArmarX:: +* @author Rainer Kartmann ( rainer dot kartmann at kit dot edu) +* @date 2021 +* @copyright http://www.gnu.org/licenses/gpl-2.0.txt +* GNU General Public License +*/ + +#include "InstanceViewWithToolBar.h" + +#include <QAction> +#include <QHBoxLayout> +#include <QPushButton> +#include <QToolBar> +#include <QVBoxLayout> + +#include <ArmarXCore/core/exceptions/local/ExpressionException.h> + +#include "InstanceView.h" + + +namespace armarx::armem::gui::instance +{ + + InstanceViewWithToolBar::InstanceViewWithToolBar(QWidget* parent) : QWidget(parent) + { + const int margin = 0; + this->setContentsMargins(margin, margin, margin, margin); + + QHBoxLayout* layout = new QHBoxLayout(); + this->setLayout(layout); + layout->setContentsMargins(margin, margin, margin, margin); + layout->setSpacing(0); + + + view = new InstanceView(); + + toolbar = new QToolBar(); + toolbar->setOrientation(Qt::Orientation::Vertical); + toolbar->setContentsMargins(margin, margin, margin, margin); + + QAction* action = toolbar->addAction(QIcon(":/icons/dialog-close.ico"), "Close", [this]() + { + ARMARX_IMPORTANT << "Closing instance view ..."; + this->deleteLater(); + }); + action->setToolTip("Remove this instance view"); + + layout->addWidget(view); + layout->addWidget(toolbar); + } + +} + diff --git a/source/RobotAPI/libraries/armem_gui/instance/InstanceViewWithToolBar.h b/source/RobotAPI/libraries/armem_gui/instance/InstanceViewWithToolBar.h new file mode 100644 index 0000000000000000000000000000000000000000..c486eeee4d1c7c00759a40a69dbc1de47ec96e3b --- /dev/null +++ b/source/RobotAPI/libraries/armem_gui/instance/InstanceViewWithToolBar.h @@ -0,0 +1,73 @@ +/* +* This file is part of ArmarX. +* +* ArmarX is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +* +* ArmarX is distributed in the hope that it will be useful, but +* WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see <http://www.gnu.org/licenses/>. +* +* @package ArmarX:: +* @author Rainer Kartmann ( rainer dot kartmann at kit dot edu) +* @date 2021 +* @copyright http://www.gnu.org/licenses/gpl-2.0.txt +* GNU General Public License +*/ + +#pragma once + +#include <QWidget> + +class QHBoxLayout; +class QVBoxLayout; +class QToolBar; + + +namespace armarx::armem::gui::instance +{ + + class InstanceView; + + class InstanceViewWithToolBar : public QWidget + { + Q_OBJECT + using This = InstanceViewWithToolBar; + + public: + + InstanceViewWithToolBar(QWidget* parent = nullptr); + + + + public slots: + + signals: + + protected slots: + + signals: + + + protected: + + + public: + + InstanceView* view; + + QToolBar* toolbar; + + + private: + + + }; +} + +