diff --git a/GUI/Support/Util/DesignerHelper.cpp b/GUI/Support/Util/DesignerHelper.cpp index 67a9a634dce398c94b810a054fce2300bd139522..8eae952878b99e38352b7724dc95b2135c2f9aff 100644 --- a/GUI/Support/Util/DesignerHelper.cpp +++ b/GUI/Support/Util/DesignerHelper.cpp @@ -13,24 +13,24 @@ // ************************************************************************************************ #include "GUI/Support/Util/DesignerHelper.h" -#include "GUI/Support/Util/StyleUtil.h" +#include "GUI/Support/Util/Style.h" int DesignerHelper::getSectionFontSize() { - return GUI::Util::Style::SystemPointSize() * 1.2; + return GUI::Style::SystemPointSize() * 1.2; } int DesignerHelper::getLabelFontSize() { - return GUI::Util::Style::SystemPointSize() * 0.9; + return GUI::Style::SystemPointSize() * 0.9; } int DesignerHelper::getPortFontSize() { - return GUI::Util::Style::SystemPointSize() * 0.7; + return GUI::Style::SystemPointSize() * 0.7; } int DesignerHelper::getPythonEditorFontSize() { - return GUI::Util::Style::SystemPointSize(); + return GUI::Style::SystemPointSize(); } diff --git a/GUI/Support/Util/QCP_Util.cpp b/GUI/Support/Util/QCP_Util.cpp index ddf3eb168a6692936dc4e43f3b8bd9d4c48edf3b..fffc20a18315cf83923e7d0f0df41fa1441e2b3d 100644 --- a/GUI/Support/Util/QCP_Util.cpp +++ b/GUI/Support/Util/QCP_Util.cpp @@ -13,14 +13,14 @@ // ************************************************************************************************ #include "GUI/Support/Util/QCP_Util.h" -#include "GUI/Support/Util/StyleUtil.h" +#include "GUI/Support/Util/Style.h" #include <qcustomplot.h> namespace { QMargins defaultMargins(const QWidget& widget) { - auto base_size = GUI::Util::Style::SizeOfLetterM(&widget); + auto base_size = GUI::Style::SizeOfLetterM(&widget); int left = static_cast<int>(base_size.width() * 6.0); int top = static_cast<int>(base_size.height() * 1.5); int right = static_cast<int>(base_size.width() * 1.2); diff --git a/GUI/Support/Util/StyleUtil.cpp b/GUI/Support/Util/Style.cpp similarity index 84% rename from GUI/Support/Util/StyleUtil.cpp rename to GUI/Support/Util/Style.cpp index 997e216f0932d9cd61749307444339bb4b860651..e1d70ad64a74509aa86c6b9c4c46ee6e02eefa57 100644 --- a/GUI/Support/Util/StyleUtil.cpp +++ b/GUI/Support/Util/Style.cpp @@ -2,7 +2,7 @@ // // BornAgain: simulate and fit reflection and scattering // -//! @file GUI/Support/Util/StyleUtil.cpp +//! @file GUI/Support/Util/Style.cpp //! @brief Defines GUI::StyleUtils namespace //! //! @homepage http://www.bornagainproject.org @@ -12,7 +12,7 @@ // // ************************************************************************************************ -#include "GUI/Support/Util/StyleUtil.h" +#include "GUI/Support/Util/Style.h" #include "Base/Util/Assert.h" #include "GUI/Support/Util/DesignerHelper.h" #include <QApplication> @@ -42,14 +42,14 @@ QSize DefaultSizeOfLetterM() } // namespace -void GUI::Util::Style::setPropertyStyle(QTreeView* tree) +void GUI::Style::setPropertyStyle(QTreeView* tree) { ASSERT(tree); - tree->setStyleSheet(GUI::Util::Style::propertyTreeStyle()); + tree->setStyleSheet(GUI::Style::propertyTreeStyle()); tree->setAlternatingRowColors(true); } -QString GUI::Util::Style::propertyTreeStyle() +QString GUI::Style::propertyTreeStyle() { QString result; @@ -75,7 +75,7 @@ QString GUI::Util::Style::propertyTreeStyle() return result; } -QFont GUI::Util::Style::sectionFont(bool bold) +QFont GUI::Style::sectionFont(bool bold) { QFont result; result.setPointSize(DesignerHelper::getSectionFontSize()); @@ -84,7 +84,7 @@ QFont GUI::Util::Style::sectionFont(bool bold) return result; } -QFont GUI::Util::Style::labelFont(bool bold) +QFont GUI::Style::labelFont(bool bold) { QFont result; result.setPointSize(DesignerHelper::getLabelFontSize()); @@ -93,9 +93,9 @@ QFont GUI::Util::Style::labelFont(bool bold) return result; } -void GUI::Util::Style::setResizable(QDialog* +void GUI::Style::setResizable(QDialog* #ifdef Q_OS_MAC - dialog + dialog #endif ) { @@ -106,13 +106,13 @@ void GUI::Util::Style::setResizable(QDialog* #endif } -QSize GUI::Util::Style::SizeOfLetterM(const QWidget* widget) +QSize GUI::Style::SizeOfLetterM(const QWidget* widget) { static QSize default_size = DefaultSizeOfLetterM(); return widget ? FindSizeOfLetterM(widget) : default_size; } -int GUI::Util::Style::SystemPointSize() +int GUI::Style::SystemPointSize() { return QApplication::font().pointSize(); } diff --git a/GUI/Support/Util/StyleUtil.h b/GUI/Support/Util/Style.h similarity index 83% rename from GUI/Support/Util/StyleUtil.h rename to GUI/Support/Util/Style.h index 18b1afd2e41dfae1216427717d0a5afe92622cc1..cac5b952e603e2bb3ef979b509114e1887bba638 100644 --- a/GUI/Support/Util/StyleUtil.h +++ b/GUI/Support/Util/Style.h @@ -2,7 +2,7 @@ // // BornAgain: simulate and fit reflection and scattering // -//! @file GUI/Support/Util/StyleUtil.h +//! @file GUI/Support/Util/Style.h //! @brief Defines GUI::StyleUtils namespace //! //! @homepage http://www.bornagainproject.org @@ -12,8 +12,8 @@ // // ************************************************************************************************ -#ifndef BORNAGAIN_GUI_SUPPORT_UTIL_STYLEUTIL_H -#define BORNAGAIN_GUI_SUPPORT_UTIL_STYLEUTIL_H +#ifndef BORNAGAIN_GUI_SUPPORT_UTIL_STYLE_H +#define BORNAGAIN_GUI_SUPPORT_UTIL_STYLE_H #include <QFont> #include <QString> @@ -23,7 +23,7 @@ class QWidget; class QLayout; class QWidget; -namespace GUI::Util::Style { +namespace GUI::Style { //! Sets style for the tree to use in property editors. void setPropertyStyle(QTreeView* tree); @@ -46,6 +46,6 @@ QSize SizeOfLetterM(const QWidget* widget = nullptr); //! Returns size in points of default system font. int SystemPointSize(); -} // namespace GUI::Util::Style +} // namespace GUI::Style -#endif // BORNAGAIN_GUI_SUPPORT_UTIL_STYLEUTIL_H +#endif // BORNAGAIN_GUI_SUPPORT_UTIL_STYLE_H diff --git a/GUI/View/Import/RealDataSelectorWidget.cpp b/GUI/View/Import/RealDataSelectorWidget.cpp index 454fa825d36082baa775ba20641f3db906124700..4c877dbe1b83a46f3c11708be1f6b7b9c8304dda 100644 --- a/GUI/View/Import/RealDataSelectorWidget.cpp +++ b/GUI/View/Import/RealDataSelectorWidget.cpp @@ -19,7 +19,7 @@ #include "GUI/Application/ApplicationSettings.h" #include "GUI/Model/Device/RealItem.h" #include "GUI/Model/Model/RealTreeModel.h" -#include "GUI/Support/Util/StyleUtil.h" +#include "GUI/Support/Util/Style.h" #include "GUI/View/Import/Legacy1dDialog.h" #include "GUI/View/Import/RealDataPropertiesWidget.h" #include "GUI/View/Info/MessageBox.h" @@ -105,7 +105,7 @@ RealDataSelectorWidget::RealDataSelectorWidget(QWidget* parent, ProjectDocument* m_itemTree->setHeaderHidden(true); m_itemTree->setContextMenuPolicy(Qt::CustomContextMenu); m_itemTree->setModel(m_treeModel); - GUI::Util::Style::setPropertyStyle(m_itemTree); + GUI::Style::setPropertyStyle(m_itemTree); auto* splitter = new QSplitter; splitter->setOrientation(Qt::Vertical); diff --git a/GUI/View/Info/OverlayLabelWidget.cpp b/GUI/View/Info/OverlayLabelWidget.cpp index f915a6b30ec929d5861a11c5773fcfcac26418e6..b7b014b8d90d2f38126370378937c2fc89cab004 100644 --- a/GUI/View/Info/OverlayLabelWidget.cpp +++ b/GUI/View/Info/OverlayLabelWidget.cpp @@ -14,7 +14,7 @@ #include "GUI/View/Info/OverlayLabelWidget.h" #include "GUI/Support/Util/DesignerHelper.h" -#include "GUI/Support/Util/StyleUtil.h" +#include "GUI/Support/Util/Style.h" #include <QPainter> OverlayLabelWidget::OverlayLabelWidget(QWidget* parent) @@ -42,7 +42,7 @@ void OverlayLabelWidget::paintEvent(QPaintEvent* event) QFont serifFont("Monospace", DesignerHelper::getSectionFontSize(), QFont::Normal, true); painter.setFont(serifFont); // painter.drawRect(m_bounding_rect); - auto margin = GUI::Util::Style::SizeOfLetterM().width(); + auto margin = GUI::Style::SizeOfLetterM().width(); painter.drawText(m_bounding_rect.marginsRemoved(QMargins(margin, margin, margin, margin)), Qt::AlignCenter, m_text); } diff --git a/GUI/View/Instrument/InstrumentLibraryEditor.cpp b/GUI/View/Instrument/InstrumentLibraryEditor.cpp index 60637cde6b4cea09a6adc876d09636a64ca3551b..9465e89b470ba6d58be8c8713749906cad16731a 100644 --- a/GUI/View/Instrument/InstrumentLibraryEditor.cpp +++ b/GUI/View/Instrument/InstrumentLibraryEditor.cpp @@ -16,7 +16,7 @@ #include "GUI/Application/ApplicationSettings.h" #include "GUI/Model/Device/InstrumentItems.h" #include "GUI/Model/Device/InstrumentLibrary.h" -#include "GUI/Support/Util/StyleUtil.h" +#include "GUI/Support/Util/Style.h" #include "GUI/View/Instrument/DepthprobeInstrumentEditor.h" #include "GUI/View/Instrument/GISASInstrumentEditor.h" #include "GUI/View/Instrument/OffspecInstrumentEditor.h" @@ -63,7 +63,7 @@ InstrumentLibraryEditor::InstrumentLibraryEditor(QWidget* parent, // ensure a current item when widget is shown // setCurrentItem(m_treeModel->topMostItem()); - GUI::Util::Style::setResizable(this); + GUI::Style::setResizable(this); appSettings->loadWindowSizeAndPos(this); } diff --git a/GUI/View/MaterialEditor/MaterialEditorDialog.cpp b/GUI/View/MaterialEditor/MaterialEditorDialog.cpp index a8fe1b9d3ef6623d97404ff339b0c8bb85024b3e..4ff6609845c89fa2d1dcf0280db68a47765d6323 100644 --- a/GUI/View/MaterialEditor/MaterialEditorDialog.cpp +++ b/GUI/View/MaterialEditor/MaterialEditorDialog.cpp @@ -18,7 +18,7 @@ #include "GUI/Model/Sample/MaterialItem.h" #include "GUI/Model/Sample/MaterialModel.h" #include "GUI/Model/Sample/SampleItem.h" -#include "GUI/Support/Util/StyleUtil.h" +#include "GUI/Support/Util/Style.h" #include "GUI/View/MaterialEditor/MaterialEditorModel.h" #include "GUI/View/Numeric/NumberUtil.h" #include "GUI/View/Tool/mainwindow_constants.h" @@ -98,7 +98,7 @@ MaterialEditorDialog::MaterialEditorDialog(SampleItem* sample, QWidget* parent) toolbar->addAction(m_removeMaterialAction); m_ui->mainLayout->insertWidget(0, toolbar); - GUI::Util::Style::setResizable(this); + GUI::Style::setResizable(this); appSettings->loadWindowSizeAndPos(this); connect(m_ui->treeView->selectionModel(), &QItemSelectionModel::currentChanged, this, diff --git a/GUI/View/PlotComparison/HistogramPlot.cpp b/GUI/View/PlotComparison/HistogramPlot.cpp index a18e8022afdd833c71c3913f039110848613c56e..2f9fe46bcb3763e33d0758c170e172bc34fc5a25 100644 --- a/GUI/View/PlotComparison/HistogramPlot.cpp +++ b/GUI/View/PlotComparison/HistogramPlot.cpp @@ -87,7 +87,7 @@ void HistogramPlot::initGraph() m_customPlot->graph()->setPen(pen); m_customPlot->graph()->setBrush(QBrush(QColor(255 / 4, 160, 50, 150))); - auto base_size = GUI::Util::Style::SizeOfLetterM(); + auto base_size = GUI::Style::SizeOfLetterM(); auto* axisRectangle = m_customPlot->axisRect(); axisRectangle->setAutoMargins(QCP::msTop | QCP::msBottom); axisRectangle->setMargins(QMargins(base_size.width() * 4, base_size.height() * 2, diff --git a/GUI/View/PlotUtil/ColorMap.cpp b/GUI/View/PlotUtil/ColorMap.cpp index 6b6ed4895eac94b6e19a4afb9960f99df5638975..8700f20b999496ec56434735d60f676d9337ff0c 100644 --- a/GUI/View/PlotUtil/ColorMap.cpp +++ b/GUI/View/PlotUtil/ColorMap.cpp @@ -200,7 +200,7 @@ void ColorMap::initColorMap() m_colorBarLayout->addElement(0, 0, m_colorScale); m_colorBarLayout->setMinimumSize(colorbar_width_logz, 10); - auto base_size = GUI::Util::Style::SizeOfLetterM(this).width() * 0.5; + auto base_size = GUI::Style::SizeOfLetterM(this).width() * 0.5; m_colorBarLayout->setMargins(QMargins(base_size, 0, base_size, 0)); m_colorScale->axis()->axisRect()->setMargins(QMargins(0, 0, 0, 0)); diff --git a/GUI/View/PlotUtil/PlotConstants.h b/GUI/View/PlotUtil/PlotConstants.h index 0fd7bcca556af535562aca0b474f56ff270876ef..8408c8fa0c166cdb9fafb7244678017abe8dfe79 100644 --- a/GUI/View/PlotUtil/PlotConstants.h +++ b/GUI/View/PlotUtil/PlotConstants.h @@ -15,24 +15,24 @@ #ifndef BORNAGAIN_GUI_VIEW_PLOTUTIL_PLOTCONSTANTS_H #define BORNAGAIN_GUI_VIEW_PLOTUTIL_PLOTCONSTANTS_H -#include "GUI/Support/Util/StyleUtil.h" +#include "GUI/Support/Util/Style.h" #include <QSize> namespace GUI::Constants { inline int plot_tick_label_size() { - return GUI::Util::Style::SystemPointSize() * 0.9; + return GUI::Style::SystemPointSize() * 0.9; } inline int plot_axes_label_size() { - return GUI::Util::Style::SystemPointSize(); + return GUI::Style::SystemPointSize(); } inline int plot_colorbar_size() { - return GUI::Util::Style::SizeOfLetterM().width(); + return GUI::Style::SizeOfLetterM().width(); } } // namespace GUI::Constants diff --git a/GUI/View/PlotUtil/RangeUtil.cpp b/GUI/View/PlotUtil/RangeUtil.cpp index 9c96e56027d95a4d693be6db8fac5a0db052b367..bdb772b071d1924d58c784f9985ce9e5584df731 100644 --- a/GUI/View/PlotUtil/RangeUtil.cpp +++ b/GUI/View/PlotUtil/RangeUtil.cpp @@ -16,7 +16,7 @@ #include "GUI/Model/Axis/AmplitudeAxisItem.h" #include "GUI/Model/Data/IntensityDataItem.h" #include "GUI/Model/Data/SpecularDataItem.h" -#include "GUI/Support/Util/StyleUtil.h" +#include "GUI/Support/Util/Style.h" #include <qcustomplot.h> QCPRange GUI::View::RangeUtil::itemZoomX(const IntensityDataItem* item) diff --git a/GUI/View/PlotUtil/StatusLabel.cpp b/GUI/View/PlotUtil/StatusLabel.cpp index 9875852bc68be9806d197b97c047073aaa66f9a7..73a54509bea4cefd6fec75008cf0f526ac1807d2 100644 --- a/GUI/View/PlotUtil/StatusLabel.cpp +++ b/GUI/View/PlotUtil/StatusLabel.cpp @@ -13,7 +13,7 @@ // ************************************************************************************************ #include "GUI/View/PlotUtil/StatusLabel.h" -#include "GUI/Support/Util/StyleUtil.h" +#include "GUI/Support/Util/Style.h" #include <QColor> #include <QFont> #include <QPainter> @@ -22,11 +22,11 @@ namespace { int default_text_size() { - return GUI::Util::Style::SystemPointSize(); + return GUI::Style::SystemPointSize(); } int default_label_height() { - return GUI::Util::Style::SizeOfLetterM().height() * 1.75; + return GUI::Style::SizeOfLetterM().height() * 1.75; } } // namespace diff --git a/GUI/View/Toplevel/PythonScriptWidget.cpp b/GUI/View/Toplevel/PythonScriptWidget.cpp index b1937a38b9e967f725db5a96505b6c2ca34174a3..793ff3c00bd19849856ae26f569186df4868bd01 100644 --- a/GUI/View/Toplevel/PythonScriptWidget.cpp +++ b/GUI/View/Toplevel/PythonScriptWidget.cpp @@ -16,7 +16,7 @@ #include "GUI/Application/ApplicationSettings.h" #include "GUI/Model/ToCore/SimulationToCore.h" #include "GUI/Support/Util/DesignerHelper.h" -#include "GUI/Support/Util/StyleUtil.h" +#include "GUI/Support/Util/Style.h" #include "GUI/View/Info/CautionSign.h" #include "GUI/View/Info/PythonSyntaxHighlighter.h" #include "GUI/View/Widget/StyledToolbar.h" @@ -73,7 +73,7 @@ PythonScriptWidget::PythonScriptWidget(QWidget* parent) setLayout(mainLayout); setAttribute(Qt::WA_DeleteOnClose, true); - GUI::Util::Style::setResizable(this); + GUI::Style::setResizable(this); appSettings->loadWindowSizeAndPos(this); }