From a9f4a96637edef72e5f812af4cd6c936daf025e8 Mon Sep 17 00:00:00 2001 From: Gennady Pospelov <g.pospelov@fz-juelich.de> Date: Mon, 8 Jul 2019 18:21:51 +0200 Subject: [PATCH] Placeholders for experimental hamburger-bar --- .../RealDataSelectorHBar.cpp | 40 +++++++++++++++++++ .../ImportDataWidgets/RealDataSelectorHBar.h | 39 ++++++++++++++++++ .../RealDataSelectorWidget.cpp | 3 ++ .../RealDataSelectorWidget.h | 2 + 4 files changed, 84 insertions(+) create mode 100644 GUI/coregui/Views/ImportDataWidgets/RealDataSelectorHBar.cpp create mode 100644 GUI/coregui/Views/ImportDataWidgets/RealDataSelectorHBar.h diff --git a/GUI/coregui/Views/ImportDataWidgets/RealDataSelectorHBar.cpp b/GUI/coregui/Views/ImportDataWidgets/RealDataSelectorHBar.cpp new file mode 100644 index 00000000000..327ba6ab434 --- /dev/null +++ b/GUI/coregui/Views/ImportDataWidgets/RealDataSelectorHBar.cpp @@ -0,0 +1,40 @@ +// ************************************************************************** // +// +// BornAgain: simulate and fit scattering at grazing incidence +// +//! @file GUI/coregui/Views/ImportDataWidgets/RealDataSelectorToolBar.h +//! @brief Defines class RealDataSelectorToolBar +//! +//! @homepage http://www.bornagainproject.org +//! @license GNU General Public License v3 or higher (see COPYING) +//! @copyright Forschungszentrum Jülich GmbH 2018 +//! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS) +// +// ************************************************************************** // + +#include "RealDataSelectorHBar.h" + +namespace { +const int toolbar_icon_size = 32; +} + +RealDataSelectorHBar::RealDataSelectorHBar(RealDataSelectorActions* actions, QWidget* parent) + : QToolBar(parent) + , m_dropDownMenuAction(nullptr) +{ + setIconSize(QSize(toolbar_icon_size, toolbar_icon_size)); + setProperty("_q_custom_style_disabled", QVariant(true)); + + m_dropDownMenuAction = new QAction(QStringLiteral("Add new material"), parent); + m_dropDownMenuAction->setIcon(QIcon(":/images/toolbar32dark_newitem.svg")); + m_dropDownMenuAction->setToolTip(QStringLiteral("Drop down menu with additional actions to import/modify datasets")); + connect(m_dropDownMenuAction, &QAction::triggered, + this, &RealDataSelectorHBar::onDropDownMenuAction); + addAction(m_dropDownMenuAction); + +} + +void RealDataSelectorHBar::onDropDownMenuAction() +{ + +} diff --git a/GUI/coregui/Views/ImportDataWidgets/RealDataSelectorHBar.h b/GUI/coregui/Views/ImportDataWidgets/RealDataSelectorHBar.h new file mode 100644 index 00000000000..d4a20491959 --- /dev/null +++ b/GUI/coregui/Views/ImportDataWidgets/RealDataSelectorHBar.h @@ -0,0 +1,39 @@ +// ************************************************************************** // +// +// BornAgain: simulate and fit scattering at grazing incidence +// +//! @file GUI/coregui/Views/ImportDataWidgets/RealDataSelectorToolBar.h +//! @brief Defines class RealDataSelectorToolBar +//! +//! @homepage http://www.bornagainproject.org +//! @license GNU General Public License v3 or higher (see COPYING) +//! @copyright Forschungszentrum Jülich GmbH 2018 +//! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS) +// +// ************************************************************************** // + +#ifndef REALDATASELECTORHBAR_H +#define REALDATASELECTORHBAR_H + +#include "WinDllMacros.h" +#include <QToolBar> + +class RealDataSelectorActions; +class QToolButton; + +//! Toolbar on top of selector tree with hamburger-like menu button. + +class BA_CORE_API_ RealDataSelectorHBar : public QToolBar +{ + Q_OBJECT +public: + RealDataSelectorHBar(RealDataSelectorActions* actions, QWidget* parent = nullptr); + +private slots: + void onDropDownMenuAction(); + +private: + QAction* m_dropDownMenuAction; +}; + +#endif // REALDATASELECTORHBAR_H diff --git a/GUI/coregui/Views/ImportDataWidgets/RealDataSelectorWidget.cpp b/GUI/coregui/Views/ImportDataWidgets/RealDataSelectorWidget.cpp index 8497771182d..96e696424e5 100644 --- a/GUI/coregui/Views/ImportDataWidgets/RealDataSelectorWidget.cpp +++ b/GUI/coregui/Views/ImportDataWidgets/RealDataSelectorWidget.cpp @@ -19,6 +19,7 @@ #include "minisplitter.h" #include "RealDataSelectorActions.h" #include "RealDataSelectorToolBar.h" +#include "RealDataSelectorHBar.h" #include <QVBoxLayout> #include <QItemSelectionModel> @@ -26,6 +27,7 @@ RealDataSelectorWidget::RealDataSelectorWidget(QWidget* parent) : QWidget(parent) , m_selectorActions(new RealDataSelectorActions(this)) , m_toolBar(new RealDataSelectorToolBar(m_selectorActions, this)) + , m_hamBar(new RealDataSelectorHBar(m_selectorActions, this)) , m_splitter(new Manhattan::MiniSplitter) , m_selectorWidget(new ItemSelectorWidget) , m_propertiesWidget(new RealDataPropertiesWidget) @@ -44,6 +46,7 @@ RealDataSelectorWidget::RealDataSelectorWidget(QWidget* parent) mainLayout->setSpacing(0); mainLayout->setContentsMargins(0, 0, 0, 0); mainLayout->addWidget(m_toolBar); + mainLayout->addWidget(m_hamBar); mainLayout->addWidget(m_splitter); setLayout(mainLayout); diff --git a/GUI/coregui/Views/ImportDataWidgets/RealDataSelectorWidget.h b/GUI/coregui/Views/ImportDataWidgets/RealDataSelectorWidget.h index 72d17051be5..e7d6aa6f2f7 100644 --- a/GUI/coregui/Views/ImportDataWidgets/RealDataSelectorWidget.h +++ b/GUI/coregui/Views/ImportDataWidgets/RealDataSelectorWidget.h @@ -26,6 +26,7 @@ class RealDataModel; class SessionItem; class RealDataSelectorActions; class RealDataSelectorToolBar; +class RealDataSelectorHBar; namespace Manhattan { class MiniSplitter;} //! The RealDataSelectorWidget represents left panel of ImportDataView. Contains a widget to @@ -53,6 +54,7 @@ public slots: private: RealDataSelectorActions* m_selectorActions; RealDataSelectorToolBar* m_toolBar; + RealDataSelectorHBar* m_hamBar; Manhattan::MiniSplitter* m_splitter; ItemSelectorWidget* m_selectorWidget; RealDataPropertiesWidget* m_propertiesWidget; -- GitLab