From 12a9847ed657e282f26408df3b7c122e56bc320d Mon Sep 17 00:00:00 2001 From: Gennady Pospelov <g.pospelov@fz-juelich.de> Date: Fri, 12 Jan 2018 13:53:00 +0100 Subject: [PATCH] Code beautification in InstrumentWidgets --- GUI/coregui/Views/InstrumentView.cpp | 4 ++-- GUI/coregui/Views/InstrumentWidgets/DetectorMaskDelegate.h | 1 + GUI/coregui/Views/InstrumentWidgets/EnvironmentEditor.h | 1 + GUI/coregui/Views/InstrumentWidgets/ExtendedDetectorDialog.h | 2 +- GUI/coregui/Views/InstrumentWidgets/GISASBeamEditor.h | 1 + GUI/coregui/Views/InstrumentWidgets/GISASDetectorEditor.h | 1 + GUI/coregui/Views/InstrumentWidgets/GISASInstrumentEditor.cpp | 2 +- GUI/coregui/Views/InstrumentWidgets/GISASInstrumentEditor.h | 3 ++- .../Views/InstrumentWidgets/InstrumentEditorWidget.cpp | 1 + GUI/coregui/Views/InstrumentWidgets/InstrumentEditorWidget.h | 4 ++-- .../Views/InstrumentWidgets/InstrumentSelectorWidget.cpp | 3 +-- GUI/coregui/Views/InstrumentWidgets/InstrumentViewToolBar.h | 2 +- .../Views/InstrumentWidgets/PolarizationAnalysisEditor.h | 1 + .../Views/InstrumentWidgets/RectangularDetectorEditor.h | 1 + GUI/coregui/Views/InstrumentWidgets/SphericalDetectorEditor.h | 1 + GUI/coregui/mainwindow/mainwindow_constants.h | 2 +- 16 files changed, 19 insertions(+), 11 deletions(-) diff --git a/GUI/coregui/Views/InstrumentView.cpp b/GUI/coregui/Views/InstrumentView.cpp index 213d251fc7e..e1a9dfd141f 100644 --- a/GUI/coregui/Views/InstrumentView.cpp +++ b/GUI/coregui/Views/InstrumentView.cpp @@ -29,11 +29,11 @@ InstrumentView::InstrumentView(MainWindow* mainWindow) m_instrumentEditor(new ItemStackPresenter<InstrumentEditorWidget>(true)), m_instrumentModel(mainWindow->instrumentModel()) { - QHBoxLayout* horizontalLayout = new QHBoxLayout; + auto horizontalLayout = new QHBoxLayout; horizontalLayout->addWidget(m_instrumentSelector); horizontalLayout->addWidget(m_instrumentEditor, 1); - QVBoxLayout* mainLayout = new QVBoxLayout; + auto mainLayout = new QVBoxLayout; mainLayout->setMargin(0); mainLayout->setSpacing(0); mainLayout->addWidget(m_toolBar); diff --git a/GUI/coregui/Views/InstrumentWidgets/DetectorMaskDelegate.h b/GUI/coregui/Views/InstrumentWidgets/DetectorMaskDelegate.h index d35ec2d0194..685d0454ec3 100644 --- a/GUI/coregui/Views/InstrumentWidgets/DetectorMaskDelegate.h +++ b/GUI/coregui/Views/InstrumentWidgets/DetectorMaskDelegate.h @@ -32,6 +32,7 @@ class DetectorItem; class BA_CORE_API_ DetectorMaskDelegate : public QObject { Q_OBJECT + public: DetectorMaskDelegate(QObject* parent); diff --git a/GUI/coregui/Views/InstrumentWidgets/EnvironmentEditor.h b/GUI/coregui/Views/InstrumentWidgets/EnvironmentEditor.h index 5e825b25441..3ee62f1e224 100644 --- a/GUI/coregui/Views/InstrumentWidgets/EnvironmentEditor.h +++ b/GUI/coregui/Views/InstrumentWidgets/EnvironmentEditor.h @@ -28,6 +28,7 @@ class ColumnResizer; class BA_CORE_API_ EnvironmentEditor : public SessionItemWidget { Q_OBJECT + public: EnvironmentEditor(ColumnResizer* columnResizer, QWidget* parent = nullptr); ~EnvironmentEditor(); diff --git a/GUI/coregui/Views/InstrumentWidgets/ExtendedDetectorDialog.h b/GUI/coregui/Views/InstrumentWidgets/ExtendedDetectorDialog.h index 5109d51884b..965096b12a1 100644 --- a/GUI/coregui/Views/InstrumentWidgets/ExtendedDetectorDialog.h +++ b/GUI/coregui/Views/InstrumentWidgets/ExtendedDetectorDialog.h @@ -29,7 +29,7 @@ class ExtendedDetectorDialog : public QDialog Q_OBJECT public: - ExtendedDetectorDialog(QWidget* parent = 0); + ExtendedDetectorDialog(QWidget* parent = nullptr); public slots: void setDetectorContext(InstrumentModel* instrumentModel, DetectorItem* detectorItem); diff --git a/GUI/coregui/Views/InstrumentWidgets/GISASBeamEditor.h b/GUI/coregui/Views/InstrumentWidgets/GISASBeamEditor.h index eac64103c38..33dffd90c66 100644 --- a/GUI/coregui/Views/InstrumentWidgets/GISASBeamEditor.h +++ b/GUI/coregui/Views/InstrumentWidgets/GISASBeamEditor.h @@ -28,6 +28,7 @@ class ColumnResizer; class BA_CORE_API_ GISASBeamEditor : public SessionItemWidget { Q_OBJECT + public: explicit GISASBeamEditor(ColumnResizer* columnResizer, QWidget* parent = nullptr); ~GISASBeamEditor(); diff --git a/GUI/coregui/Views/InstrumentWidgets/GISASDetectorEditor.h b/GUI/coregui/Views/InstrumentWidgets/GISASDetectorEditor.h index 68e6eeb08aa..1cc21d1b68e 100644 --- a/GUI/coregui/Views/InstrumentWidgets/GISASDetectorEditor.h +++ b/GUI/coregui/Views/InstrumentWidgets/GISASDetectorEditor.h @@ -28,6 +28,7 @@ class GISASInstrumentItem; class BA_CORE_API_ GISASDetectorEditor : public SessionItemWidget { Q_OBJECT + public: GISASDetectorEditor(QWidget* parent = nullptr); diff --git a/GUI/coregui/Views/InstrumentWidgets/GISASInstrumentEditor.cpp b/GUI/coregui/Views/InstrumentWidgets/GISASInstrumentEditor.cpp index b08c4491215..1bf968d1e02 100644 --- a/GUI/coregui/Views/InstrumentWidgets/GISASInstrumentEditor.cpp +++ b/GUI/coregui/Views/InstrumentWidgets/GISASInstrumentEditor.cpp @@ -51,7 +51,7 @@ void GISASInstrumentEditor::subscribeToItem() } void GISASInstrumentEditor::addEditor(QVBoxLayout* layout, QWidget* widget, const QString& name, - bool expanded) + bool expanded) { auto detailsWidget = new Utils::DetailsWidget; detailsWidget->setSummaryText(name); diff --git a/GUI/coregui/Views/InstrumentWidgets/GISASInstrumentEditor.h b/GUI/coregui/Views/InstrumentWidgets/GISASInstrumentEditor.h index c6e40bbfe14..a0a9fd9afcf 100644 --- a/GUI/coregui/Views/InstrumentWidgets/GISASInstrumentEditor.h +++ b/GUI/coregui/Views/InstrumentWidgets/GISASInstrumentEditor.h @@ -28,8 +28,9 @@ class QVBoxLayout; class BA_CORE_API_ GISASInstrumentEditor : public SessionItemWidget { Q_OBJECT + public: - GISASInstrumentEditor(QWidget* parent = 0); + GISASInstrumentEditor(QWidget* parent = nullptr); protected: void subscribeToItem(); diff --git a/GUI/coregui/Views/InstrumentWidgets/InstrumentEditorWidget.cpp b/GUI/coregui/Views/InstrumentWidgets/InstrumentEditorWidget.cpp index f14338739c1..12f2f090e9a 100644 --- a/GUI/coregui/Views/InstrumentWidgets/InstrumentEditorWidget.cpp +++ b/GUI/coregui/Views/InstrumentWidgets/InstrumentEditorWidget.cpp @@ -33,6 +33,7 @@ InstrumentEditorWidget::InstrumentEditorWidget(QWidget* parent) setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); auto mainLayout = new QVBoxLayout; + mainLayout->setContentsMargins(0, 20, 0, 20); mainLayout->addLayout(createTopLayout()); auto scrollArea = new AdjustingScrollArea; diff --git a/GUI/coregui/Views/InstrumentWidgets/InstrumentEditorWidget.h b/GUI/coregui/Views/InstrumentWidgets/InstrumentEditorWidget.h index e7d64b4f8a9..29e5bc41a75 100644 --- a/GUI/coregui/Views/InstrumentWidgets/InstrumentEditorWidget.h +++ b/GUI/coregui/Views/InstrumentWidgets/InstrumentEditorWidget.h @@ -31,7 +31,7 @@ class BA_CORE_API_ InstrumentEditorWidget : public QWidget Q_OBJECT public: - InstrumentEditorWidget(QWidget* parent = 0); + InstrumentEditorWidget(QWidget* parent = nullptr); QSize sizeHint() const; @@ -44,7 +44,7 @@ public slots: void onChangedEditor(const QString&); private: - QLayout* create_NameAndTypeLayout(); + QLayout* createTopLayout(); void updateWidgets(); QLineEdit* m_nameLineEdit; diff --git a/GUI/coregui/Views/InstrumentWidgets/InstrumentSelectorWidget.cpp b/GUI/coregui/Views/InstrumentWidgets/InstrumentSelectorWidget.cpp index 55bf68ac6f6..6e261354f3d 100644 --- a/GUI/coregui/Views/InstrumentWidgets/InstrumentSelectorWidget.cpp +++ b/GUI/coregui/Views/InstrumentWidgets/InstrumentSelectorWidget.cpp @@ -38,8 +38,7 @@ InstrumentSelectorWidget::InstrumentSelectorWidget(InstrumentModel* model, QWidg " selection-background-color : rgb(98,100,105); \n" " selection-color: rgb(255,255,255);\n" " border: 1px solid rgb(98,100,105);\n" - "}\n" - "")); + "}\n")); setModel(model); layout()->setMargin(10); diff --git a/GUI/coregui/Views/InstrumentWidgets/InstrumentViewToolBar.h b/GUI/coregui/Views/InstrumentWidgets/InstrumentViewToolBar.h index 05048f0ae0d..2bdcbb5d504 100644 --- a/GUI/coregui/Views/InstrumentWidgets/InstrumentViewToolBar.h +++ b/GUI/coregui/Views/InstrumentWidgets/InstrumentViewToolBar.h @@ -30,7 +30,7 @@ class BA_CORE_API_ InstrumentViewToolBar : public StyledToolBar Q_OBJECT public: - explicit InstrumentViewToolBar(InstrumentViewActions* actions, QWidget* parent = 0); + explicit InstrumentViewToolBar(InstrumentViewActions* actions, QWidget* parent = nullptr); private slots: void onAddInstrument(); diff --git a/GUI/coregui/Views/InstrumentWidgets/PolarizationAnalysisEditor.h b/GUI/coregui/Views/InstrumentWidgets/PolarizationAnalysisEditor.h index eb4d90d0d71..976ed7605f9 100644 --- a/GUI/coregui/Views/InstrumentWidgets/PolarizationAnalysisEditor.h +++ b/GUI/coregui/Views/InstrumentWidgets/PolarizationAnalysisEditor.h @@ -29,6 +29,7 @@ class ColumnResizer; class BA_CORE_API_ PolarizationAnalysisEditor : public SessionItemWidget { Q_OBJECT + public: PolarizationAnalysisEditor(ColumnResizer* columnResizer, QWidget* parent = nullptr); ~PolarizationAnalysisEditor(); diff --git a/GUI/coregui/Views/InstrumentWidgets/RectangularDetectorEditor.h b/GUI/coregui/Views/InstrumentWidgets/RectangularDetectorEditor.h index 867ede3dba7..e3ea8cb06be 100644 --- a/GUI/coregui/Views/InstrumentWidgets/RectangularDetectorEditor.h +++ b/GUI/coregui/Views/InstrumentWidgets/RectangularDetectorEditor.h @@ -23,6 +23,7 @@ class QGridLayout; class BA_CORE_API_ RectangularDetectorEditor : public SessionItemWidget { Q_OBJECT + public: RectangularDetectorEditor(QWidget* parent = nullptr); diff --git a/GUI/coregui/Views/InstrumentWidgets/SphericalDetectorEditor.h b/GUI/coregui/Views/InstrumentWidgets/SphericalDetectorEditor.h index 8a01009a25d..65673e5d208 100644 --- a/GUI/coregui/Views/InstrumentWidgets/SphericalDetectorEditor.h +++ b/GUI/coregui/Views/InstrumentWidgets/SphericalDetectorEditor.h @@ -23,6 +23,7 @@ class QGridLayout; class BA_CORE_API_ SphericalDetectorEditor : public SessionItemWidget { Q_OBJECT + public: SphericalDetectorEditor(QWidget* parent = nullptr); diff --git a/GUI/coregui/mainwindow/mainwindow_constants.h b/GUI/coregui/mainwindow/mainwindow_constants.h index aa74ec70223..37afc0d337c 100644 --- a/GUI/coregui/mainwindow/mainwindow_constants.h +++ b/GUI/coregui/mainwindow/mainwindow_constants.h @@ -56,7 +56,7 @@ const unsigned int REALTIME_WIDGET_WIDTH_HINT = 480; const unsigned int FIT_ACTIVITY_PANEL_HEIGHT = 380; const unsigned int FIT_SUITE_WIDGET_HEIGHT= 330; const unsigned int RUN_FIT_CONTROL_WIDGET_HEIGHT = 50; -const unsigned int ITEM_SELECTOR_WIDGET_WIDTH = 128; +const unsigned int ITEM_SELECTOR_WIDGET_WIDTH = 96; const unsigned int ITEM_SELECTOR_WIDGET_HEIGHT = 765; const unsigned int hint_panel_width = 230; -- GitLab