From 4d5fa01767097663de286d7abb3acfb2f869c56c Mon Sep 17 00:00:00 2001 From: Ludwig Jaeck <ludwig.jaeck@outlook.de> Date: Wed, 11 Jan 2023 14:39:01 +0100 Subject: [PATCH] Updated stylesheet --- GUI/Application/ApplicationSettings.cpp | 50 +- GUI/Application/ApplicationSettings.h | 17 +- .../IO/AbstractDataLoaderResultModel.cpp | 2 +- GUI/View/Common/DocksController.cpp | 17 +- GUI/View/Common/StyledToolbar.cpp | 4 + GUI/View/Common/StyledToolbar.h | 3 + GUI/View/Import/RealDataTreeModel.cpp | 4 +- GUI/View/Instrument/InstrumentView.cpp | 93 ++-- GUI/View/Instrument/InstrumentView.h | 12 +- GUI/View/Instrument/InstrumentsTreeModel.cpp | 4 +- GUI/View/Main/ActionManager.cpp | 45 +- .../MaterialEditor/MaterialEditorDialog.cpp | 4 +- GUI/View/SampleDesigner/SampleView.cpp | 18 +- GUI/gui.qrc | 5 + GUI/images/caret-up.svg | 57 +++ GUI/images/checkbox-checked.svg | 80 +++ GUI/images/dock-close.svg | 80 +++ GUI/images/dock-float.svg | 83 ++++ GUI/images/radio-checked.svg | 81 +++ GUI/styles/Base.stylesheet | 466 +++++++++++++----- GUI/styles/Dark.stylesheet | 83 ++-- GUI/styles/Light.stylesheet | 55 ++- GUI/styles/Native.stylesheet | 51 +- 23 files changed, 963 insertions(+), 351 deletions(-) create mode 100644 GUI/images/caret-up.svg create mode 100644 GUI/images/checkbox-checked.svg create mode 100644 GUI/images/dock-close.svg create mode 100644 GUI/images/dock-float.svg create mode 100644 GUI/images/radio-checked.svg diff --git a/GUI/Application/ApplicationSettings.cpp b/GUI/Application/ApplicationSettings.cpp index f60de465825..8b352d3c4e5 100644 --- a/GUI/Application/ApplicationSettings.cpp +++ b/GUI/Application/ApplicationSettings.cpp @@ -18,8 +18,8 @@ #include <QFile> #include <QSettings> #include <QStandardPaths> +#include <QStyle> #include <QWidget> - namespace { const QString S_CREATE_NEW_PROJECT_ON_STARTUP = "CreateNewProjectOnStartup"; @@ -160,51 +160,33 @@ void ApplicationSettings::loadStyle(ApplicationSettings::Style style) } m_currentStyle = style; + m_styleSheetPalette = qApp->style()->standardPalette(); // -- init palette for later usage; could be improved by parsing the stylesheet switch (m_currentStyle) { case ApplicationSettings::Style::light: { - m_styleSheetPalette.text = Qt::black; - m_styleSheetPalette.headlineText = QColor(48, 113, 145); - m_styleSheetPalette.headlineBackground = QColor(222, 232, 237); - m_styleSheetPalette.windowBackground = QColor(255, 255, 255); - m_styleSheetPalette.windowBackgroundAlterantive = - m_styleSheetPalette.windowBackground.darker(105); - m_styleSheetPalette.windowBackgroundDarker = - m_styleSheetPalette.windowBackground.darker(120); - m_styleSheetPalette.componentBorder = m_styleSheetPalette.windowBackground.darker(110); - m_styleSheetPalette.componentBackground = Qt::white; - m_styleSheetPalette.buttonBackground = m_styleSheetPalette.windowBackgroundAlterantive; + m_styleSheetPalette.setColor(QPalette::Text, Qt::black); + m_styleSheetPalette.setColor(QPalette::WindowText, Qt::black); + m_styleSheetPalette.setColor(QPalette::Base, Qt::white); + m_styleSheetPalette.setColor(QPalette::AlternateBase, QColor(255, 255, 255).darker(105)); + m_styleSheetPalette.setColor(QPalette::Dark, QColor(255, 255, 255).darker(110)); break; } case ApplicationSettings::Style::dark: { - m_styleSheetPalette.text = QColor(213, 220, 223); - m_styleSheetPalette.headlineText = QColor(213, 220, 223); - m_styleSheetPalette.headlineBackground = QColor(29, 39, 44); - m_styleSheetPalette.windowBackground = QColor(43, 50, 54); - m_styleSheetPalette.windowBackgroundAlterantive = - m_styleSheetPalette.windowBackground.lighter(150); - m_styleSheetPalette.windowBackgroundDarker = - m_styleSheetPalette.windowBackground.darker(120); - m_styleSheetPalette.componentBorder = m_styleSheetPalette.windowBackground.lighter(180); - m_styleSheetPalette.componentBackground = Qt::black; - m_styleSheetPalette.buttonBackground = m_styleSheetPalette.windowBackground.lighter(120); + m_styleSheetPalette.setColor(QPalette::Text, QColor(213, 220, 223)); + m_styleSheetPalette.setColor(QPalette::WindowText, QColor(213, 220, 223)); + m_styleSheetPalette.setColor(QPalette::Base, QColor(43, 50, 54)); + m_styleSheetPalette.setColor(QPalette::AlternateBase, QColor(43, 50, 54).darker(130)); + m_styleSheetPalette.setColor(QPalette::Dark, QColor(43, 50, 54).darker(120)); break; } default: { - m_styleSheetPalette.headlineText = Qt::black; - m_styleSheetPalette.headlineBackground = QColor(250, 250, 250); + m_styleSheetPalette = qApp->style()->standardPalette(); break; } } - stylesheet.replace("@text", m_styleSheetPalette.text.name()); - stylesheet.replace("@windowBackgroundAlternative", - m_styleSheetPalette.windowBackgroundAlterantive.name()); - stylesheet.replace("@windowBackgroundDarker", - m_styleSheetPalette.windowBackgroundDarker.name()); - stylesheet.replace("@windowBackground", m_styleSheetPalette.windowBackground.name()); - stylesheet.replace("@componentBoder", m_styleSheetPalette.componentBorder.name()); - stylesheet.replace("@componentBackground", m_styleSheetPalette.componentBackground.name()); + QApplication::setPalette(m_styleSheetPalette); + qApp->setStyleSheet(""); qApp->setStyleSheet(stylesheet); } @@ -213,7 +195,7 @@ ApplicationSettings::Style ApplicationSettings::currentStyle() return m_currentStyle; } -const ApplicationSettings::Palette& ApplicationSettings::styleSheetPalette() const +const QPalette& ApplicationSettings::styleSheetPalette() const { return m_styleSheetPalette; } diff --git a/GUI/Application/ApplicationSettings.h b/GUI/Application/ApplicationSettings.h index 33cecd2c8cc..6e185de0876 100644 --- a/GUI/Application/ApplicationSettings.h +++ b/GUI/Application/ApplicationSettings.h @@ -16,6 +16,7 @@ #define BORNAGAIN_GUI_APPLICATION_APPLICATIONSETTINGS_H #include <QColor> +#include <QPalette> class QWidget; class QVariant; @@ -54,23 +55,11 @@ public: void loadStyle(ApplicationSettings::Style style); ApplicationSettings::Style currentStyle(); - struct Palette { - QColor text; - QColor headlineText; - QColor headlineBackground; - QColor windowBackground; - QColor windowBackgroundAlterantive; - QColor windowBackgroundDarker; - QColor componentBorder; - QColor componentBackground; - QColor buttonBackground; - }; - - const Palette& styleSheetPalette() const; + const QPalette& styleSheetPalette() const; private: ApplicationSettings::Style m_currentStyle; - Palette m_styleSheetPalette; + QPalette m_styleSheetPalette; }; extern ApplicationSettings* appSettings; //!< global pointer to the single instance diff --git a/GUI/Support/IO/AbstractDataLoaderResultModel.cpp b/GUI/Support/IO/AbstractDataLoaderResultModel.cpp index 56e37d8734a..07c2fbdbe47 100644 --- a/GUI/Support/IO/AbstractDataLoaderResultModel.cpp +++ b/GUI/Support/IO/AbstractDataLoaderResultModel.cpp @@ -90,7 +90,7 @@ QVariant AbstractDataLoaderResultModel::data(const QModelIndex& index, if (role == Qt::ForegroundRole) { if (colType == ColumnType::fileContent && rowIsSkipped(index)) return Palette::skippedLineTextColor; - return QVariant(); + return QColor(0, 0, 0); } if (role == Qt::DisplayRole) { diff --git a/GUI/View/Common/DocksController.cpp b/GUI/View/Common/DocksController.cpp index f63cffa9f02..f2d63da1fa3 100644 --- a/GUI/View/Common/DocksController.cpp +++ b/GUI/View/Common/DocksController.cpp @@ -17,12 +17,15 @@ #include "GUI/Util/Error.h" #include <QAbstractItemView> #include <QAction> +#include <QCheckBox> #include <QDockWidget> #include <QEvent> #include <QMainWindow> #include <QMenu> +#include <QRadioButton> #include <QSettings> #include <QTimer> +#include <QWidgetAction> namespace { @@ -243,8 +246,18 @@ void DocksController::addDockActionsToMenu(QMenu* menu) < stripAccelerator(action2->text()).toLower(); }); - foreach (QAction* action, actions) - menu->addAction(action); + foreach (QAction* action, actions) { + if (action->isCheckable()) { + auto* widgetAction = new QWidgetAction(menu); + widgetAction->setCheckable(true); + auto* checkBox = new QCheckBox(action->text(), menu); + checkBox->setChecked(action->isChecked()); + connect(checkBox, &QCheckBox::toggled, action, &QAction::trigger); + widgetAction->setDefaultWidget(checkBox); + menu->addAction(widgetAction); + } else + menu->addAction(action); + } } void DocksController::saveSettings(QSettings* settings) const diff --git a/GUI/View/Common/StyledToolbar.cpp b/GUI/View/Common/StyledToolbar.cpp index 274631ff645..e67b2b4bbdc 100644 --- a/GUI/View/Common/StyledToolbar.cpp +++ b/GUI/View/Common/StyledToolbar.cpp @@ -53,3 +53,7 @@ void StyledToolbar::contextMenuEvent(QContextMenuEvent*) { // Context menu reimplemented to suppress the default one } +void StyledToolbar::paintEvent(QPaintEvent* event) +{ + // Paint event reimplemented to suppress drawing the MacOs Menu +} diff --git a/GUI/View/Common/StyledToolbar.h b/GUI/View/Common/StyledToolbar.h index 5bd5ddf972c..29329626e0e 100644 --- a/GUI/View/Common/StyledToolbar.h +++ b/GUI/View/Common/StyledToolbar.h @@ -28,6 +28,9 @@ public: void addSpacing(int width = 2); void addStyledExpand(); +protected: + void paintEvent(QPaintEvent* event) override; + protected: void contextMenuEvent(QContextMenuEvent*) override; }; diff --git a/GUI/View/Import/RealDataTreeModel.cpp b/GUI/View/Import/RealDataTreeModel.cpp index fdf70ce5683..309254b6af8 100644 --- a/GUI/View/Import/RealDataTreeModel.cpp +++ b/GUI/View/Import/RealDataTreeModel.cpp @@ -216,10 +216,10 @@ QVariant RealDataTreeModel::data(const QModelIndex& index, int role) const return QVariant(Qt::AlignLeft | Qt::AlignVCenter); case Qt::BackgroundRole: - return appSettings->styleSheetPalette().headlineBackground; + return appSettings->styleSheetPalette().color(QPalette::Base); case Qt::ForegroundRole: - return appSettings->styleSheetPalette().headlineText; + return appSettings->styleSheetPalette().color(QPalette::Text); default: return QVariant(); diff --git a/GUI/View/Instrument/InstrumentView.cpp b/GUI/View/Instrument/InstrumentView.cpp index 858aa849c7b..560e4d832b3 100644 --- a/GUI/View/Instrument/InstrumentView.cpp +++ b/GUI/View/Instrument/InstrumentView.cpp @@ -65,38 +65,6 @@ InstrumentView::InstrumentView(QWidget* parent, ProjectDocument* document) createWidgetsForCurrentInstrument(); updateSingleInstrumentMode(); - const auto f = m_document->functionalities(); - m_gisasCheck = new QCheckBox("GISAS instrument", nullptr); - m_gisasCheck->setChecked(f.testFlag(ProjectDocument::Gisas)); - connect(m_gisasCheck, &QCheckBox::stateChanged, this, &InstrumentView::onFunctionalityChanged); - m_gisasAction = new QWidgetAction(nullptr); - m_gisasAction->setToolTip("GISAS instrument"); - m_gisasAction->setDefaultWidget(m_gisasCheck); - - m_offspecCheck = new QCheckBox("Off-specular instrument", nullptr); - m_offspecCheck->setChecked(f.testFlag(ProjectDocument::Offspec)); - connect(m_offspecCheck, &QCheckBox::stateChanged, this, - &InstrumentView::onFunctionalityChanged); - m_offspecAction = new QWidgetAction(nullptr); - m_offspecAction->setToolTip("Off-specular instrument"); - m_offspecAction->setDefaultWidget(m_offspecCheck); - - m_reflectometryCheck = new QCheckBox("Specular instrument", nullptr); - m_reflectometryCheck->setChecked(f.testFlag(ProjectDocument::Specular)); - connect(m_reflectometryCheck, &QCheckBox::stateChanged, this, - &InstrumentView::onFunctionalityChanged); - m_reflectometryAction = new QWidgetAction(nullptr); - m_reflectometryAction->setToolTip("Specular instrument"); - m_reflectometryAction->setDefaultWidget(m_reflectometryCheck); - - m_depthProbeCheck = new QCheckBox("Depth probe instrument", nullptr); - m_depthProbeCheck->setChecked(f.testFlag(ProjectDocument::Depthprobe)); - connect(m_depthProbeCheck, &QCheckBox::stateChanged, this, - &InstrumentView::onFunctionalityChanged); - m_depthProbeAction = new QWidgetAction(nullptr); - m_depthProbeAction->setToolTip("Depth probe instrument"); - m_depthProbeAction->setDefaultWidget(m_depthProbeCheck); - connect(m_instrumentListView, &InstrumentListView::instrumentSelected, this, &InstrumentView::createWidgetsForCurrentInstrument); @@ -227,18 +195,49 @@ void InstrumentView::updateSingleInstrumentMode() } void InstrumentView::fillViewMenu(QMenu* menu) { - auto* action = new QAction(menu); + + auto* action = new QWidgetAction(menu); + auto* checkBox = new QCheckBox("Use single instrument", menu); + action->setDefaultWidget(checkBox); action->setText("Use single instrument"); action->setCheckable(true); - action->setChecked(m_document->singleInstrumentMode()); - connect(action, &QAction::triggered, this, &InstrumentView::onSingleInstrumentModeChanged); + checkBox->setChecked(m_document->singleInstrumentMode()); + connect(checkBox, &QCheckBox::stateChanged, this, + &InstrumentView::onSingleInstrumentModeChanged); menu->addAction(action); menu->addSeparator(); - menu->addAction(m_gisasAction); - menu->addAction(m_offspecAction); - menu->addAction(m_reflectometryAction); - menu->addAction(m_depthProbeAction); + + const auto f = m_document->functionalities(); + gisasCheck = new QCheckBox("GISAS instrument", menu); + gisasCheck->setChecked(f.testFlag(ProjectDocument::Gisas)); + connect(gisasCheck, &QCheckBox::stateChanged, this, &InstrumentView::onFunctionalityChanged); + action = new QWidgetAction(menu); + action->setToolTip("GISAS instrument"); + action->setDefaultWidget(gisasCheck); + menu->addAction(action); + offspecCheck = new QCheckBox("Off-specular instrument", menu); + offspecCheck->setChecked(f.testFlag(ProjectDocument::Offspec)); + connect(offspecCheck, &QCheckBox::stateChanged, this, &InstrumentView::onFunctionalityChanged); + action = new QWidgetAction(menu); + action->setToolTip("Off-specular instrument"); + action->setDefaultWidget(offspecCheck); + menu->addAction(action); + specularCheck = new QCheckBox("Specular instrument", menu); + specularCheck->setChecked(f.testFlag(ProjectDocument::Specular)); + connect(specularCheck, &QCheckBox::stateChanged, this, &InstrumentView::onFunctionalityChanged); + action = new QWidgetAction(menu); + action->setToolTip("Specular instrument"); + action->setDefaultWidget(specularCheck); + menu->addAction(action); + depthProbeCheck = new QCheckBox("Depth probe instrument", menu); + depthProbeCheck->setChecked(f.testFlag(ProjectDocument::Depthprobe)); + connect(depthProbeCheck, &QCheckBox::stateChanged, this, + &InstrumentView::onFunctionalityChanged); + action = new QWidgetAction(menu); + action->setToolTip("Depth probe instrument"); + action->setDefaultWidget(depthProbeCheck); + menu->addAction(action); } void InstrumentView::onSingleInstrumentModeChanged(bool newState) @@ -263,10 +262,10 @@ void InstrumentView::onSingleInstrumentModeChanged(bool newState) ProjectDocument::Functionalities InstrumentView::functionalities() const { ProjectDocument::Functionalities f; - f.setFlag(ProjectDocument::Gisas, m_gisasCheck->isChecked()); - f.setFlag(ProjectDocument::Offspec, m_offspecCheck->isChecked()); - f.setFlag(ProjectDocument::Specular, m_reflectometryCheck->isChecked()); - f.setFlag(ProjectDocument::Depthprobe, m_depthProbeCheck->isChecked()); + f.setFlag(ProjectDocument::Gisas, gisasCheck->isChecked()); + f.setFlag(ProjectDocument::Offspec, offspecCheck->isChecked()); + f.setFlag(ProjectDocument::Specular, specularCheck->isChecked()); + f.setFlag(ProjectDocument::Depthprobe, depthProbeCheck->isChecked()); return f; } @@ -280,10 +279,10 @@ void InstrumentView::onFunctionalityChanged() "You have to select at least one functionality. Changing " "this setting is not possible."); const auto f = m_document->functionalities(); - m_gisasCheck->setChecked(f.testFlag(ProjectDocument::Gisas)); - m_offspecCheck->setChecked(f.testFlag(ProjectDocument::Offspec)); - m_reflectometryCheck->setChecked(f.testFlag(ProjectDocument::Specular)); - m_depthProbeCheck->setChecked(f.testFlag(ProjectDocument::Depthprobe)); + gisasCheck->setChecked(f.testFlag(ProjectDocument::Gisas)); + offspecCheck->setChecked(f.testFlag(ProjectDocument::Offspec)); + specularCheck->setChecked(f.testFlag(ProjectDocument::Specular)); + depthProbeCheck->setChecked(f.testFlag(ProjectDocument::Depthprobe)); return; } m_document->setFunctionalities(f); diff --git a/GUI/View/Instrument/InstrumentView.h b/GUI/View/Instrument/InstrumentView.h index 91e10774f26..c381862072f 100644 --- a/GUI/View/Instrument/InstrumentView.h +++ b/GUI/View/Instrument/InstrumentView.h @@ -56,14 +56,10 @@ private: InstrumentListView* m_instrumentListView; ProjectDocument* m_document; QScrollArea* m_scrollArea; - QCheckBox* m_gisasCheck; - QCheckBox* m_offspecCheck; - QCheckBox* m_reflectometryCheck; - QCheckBox* m_depthProbeCheck; - QWidgetAction* m_gisasAction; - QWidgetAction* m_offspecAction; - QWidgetAction* m_reflectometryAction; - QWidgetAction* m_depthProbeAction; + QCheckBox* gisasCheck; + QCheckBox* offspecCheck; + QCheckBox* specularCheck; + QCheckBox* depthProbeCheck; }; #endif // BORNAGAIN_GUI_VIEW_INSTRUMENT_INSTRUMENTVIEW_H diff --git a/GUI/View/Instrument/InstrumentsTreeModel.cpp b/GUI/View/Instrument/InstrumentsTreeModel.cpp index 8eb575e379c..c189e574a92 100644 --- a/GUI/View/Instrument/InstrumentsTreeModel.cpp +++ b/GUI/View/Instrument/InstrumentsTreeModel.cpp @@ -201,10 +201,10 @@ QVariant InstrumentsTreeModel::data(const QModelIndex& index, int role) const return QVariant(Qt::AlignLeft | Qt::AlignVCenter); case Qt::BackgroundRole: - return appSettings->styleSheetPalette().headlineBackground; + return appSettings->styleSheetPalette().color(QPalette::Base); case Qt::ForegroundRole: - return appSettings->styleSheetPalette().headlineText; + return appSettings->styleSheetPalette().color(QPalette::Text); default: return QVariant(); diff --git a/GUI/View/Main/ActionManager.cpp b/GUI/View/Main/ActionManager.cpp index c520d16f75e..391669fe090 100644 --- a/GUI/View/Main/ActionManager.cpp +++ b/GUI/View/Main/ActionManager.cpp @@ -24,12 +24,16 @@ #include "GUI/View/Project/ProjectManager.h" #include "GUI/View/SampleDesigner/SampleView.h" #include "GUI/View/Tool/mainwindow_constants.h" +#include <QButtonGroup> +#include <QCheckBox> #include <QDesktopServices> #include <QDir> #include <QMenuBar> +#include <QRadioButton> #include <QSettings> #include <QShortcut> #include <QUrl> +#include <QWidgetAction> ActionManager::ActionManager(MainWindow* parent) : QObject(parent) @@ -152,7 +156,7 @@ void ActionManager::createMenus() // Settings Menu m_settingsMenu = new QMenu("&Settings", m_mainWindow); onAboutToShowSettingsMenu(); // MacOS feature: action should exist already, otherwise menuBar - // will not add menu + // will not add menu connect(m_settingsMenu, &QMenu::aboutToShow, this, &ActionManager::onAboutToShowSettingsMenu); m_menuBar->addMenu(m_settingsMenu); @@ -209,36 +213,47 @@ void ActionManager::onAboutToShowSettingsMenu() { m_settingsMenu->clear(); m_settingsMenu->setToolTipsVisible(true); - - QAction* action = m_settingsMenu->addAction("&Enable autosave"); + auto* action = new QWidgetAction(m_settingsMenu); + auto* checkBox = new QCheckBox("&Enable autosave", m_settingsMenu); + action->setText("&Enable autosave"); + action->setDefaultWidget(checkBox); action->setToolTip("Project will be saved periodically in project's autosave directory.\n" "When opening project, recover option will be suggested, if possible."); action->setCheckable(true); - action->setChecked(m_mainWindow->projectManager()->isAutosaveEnabled()); - connect(action, &QAction::toggled, m_mainWindow->projectManager(), + checkBox->setChecked(m_mainWindow->projectManager()->isAutosaveEnabled()); + connect(checkBox, &QCheckBox::toggled, m_mainWindow->projectManager(), &ProjectManager::setAutosaveEnabled); + m_settingsMenu->addAction(action); - action = m_settingsMenu->addAction("&Create project on startup"); + action = new QWidgetAction(m_settingsMenu); + checkBox = new QCheckBox("&Create project on startup", m_settingsMenu); + action->setText("&Create project on startup"); + action->setDefaultWidget(checkBox); action->setCheckable(true); - action->setChecked(appSettings->createNewProjectOnStartup()); - connect(action, &QAction::toggled, + checkBox->setChecked(appSettings->createNewProjectOnStartup()); + connect(checkBox, &QCheckBox::toggled, [](bool b) { appSettings->setCreateNewProjectOnStartup(b); }); + m_settingsMenu->addAction(action); m_settingsMenu->addSeparator(); - // The dark style is not completed so far. See issue #220 - // The light style is almost done, but with dark system theme it may lead to invisible - // text. See issue #276 - // + auto* styleMenu = m_settingsMenu->addMenu("Interface Style"); + auto* styleGroup = new QButtonGroup(this); + styleGroup->setExclusive(true); auto* styleActions = new QActionGroup(this); const auto addStyleAction = [=](const QString& text, ApplicationSettings::Style style) { - auto* action = m_settingsMenu->addAction(text, [=]() { + auto* action = new QWidgetAction(styleMenu); + auto* radioButton = new QRadioButton(text, styleMenu); + radioButton->setStyleSheet(""); + action->setDefaultWidget(radioButton); + radioButton->setChecked(appSettings->currentStyle() == style); + connect(radioButton, &QRadioButton::toggled, this, [=]() { appSettings->setStyleToUse(style); appSettings->loadStyle(style); }); action->setCheckable(true); - action->setChecked(appSettings->currentStyle() == style); - styleActions->addAction(action); + styleGroup->addButton(radioButton); + styleMenu->addAction(action); }; addStyleAction("Dark style", ApplicationSettings::Style::dark); diff --git a/GUI/View/MaterialEditor/MaterialEditorDialog.cpp b/GUI/View/MaterialEditor/MaterialEditorDialog.cpp index 19b36890913..96361a486d8 100644 --- a/GUI/View/MaterialEditor/MaterialEditorDialog.cpp +++ b/GUI/View/MaterialEditor/MaterialEditorDialog.cpp @@ -18,6 +18,7 @@ #include "GUI/Model/Sample/MaterialItem.h" #include "GUI/Model/Sample/MaterialModel.h" #include "GUI/Model/Sample/SampleItem.h" +#include "GUI/View/Common/StyledToolbar.h" #include "GUI/View/MaterialEditor/MaterialEditorModel.h" #include "GUI/View/Tool/EditUtil.h" #include "GUI/View/Tool/StyleUtils.h" @@ -28,7 +29,6 @@ #include <QMessageBox> #include <QPushButton> #include <QSettings> -#include <QToolBar> #include <QVBoxLayout> MaterialEditorDialog::MaterialEditorDialog(SampleItem* sample, QWidget* parent) @@ -86,7 +86,7 @@ MaterialEditorDialog::MaterialEditorDialog(SampleItem* sample, QWidget* parent) m_ui->treeView->setModel(m_model); m_ui->treeView->header()->setSectionResizeMode(QHeaderView::ResizeToContents); - auto* toolbar = new QToolBar(this); + auto* toolbar = new StyledToolbar(this); toolbar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); toolbar->addAction(addRefractiveMaterialAction); toolbar->addAction(addSldMaterialAction); diff --git a/GUI/View/SampleDesigner/SampleView.cpp b/GUI/View/SampleDesigner/SampleView.cpp index 0792399afb6..ee6d10ece4d 100644 --- a/GUI/View/SampleDesigner/SampleView.cpp +++ b/GUI/View/SampleDesigner/SampleView.cpp @@ -28,10 +28,12 @@ #include "GUI/View/SampleView/RealspaceWidget.h" #include <QBoxLayout> +#include <QCheckBox> #include <QDockWidget> #include <QMenu> #include <QMessageBox> #include <QToolButton> +#include <QWidgetAction> SampleView::SampleView(QWidget* parent, ProjectDocument* document) : QMainWindow(parent) @@ -166,17 +168,19 @@ void SampleView::fillViewMenu(QMenu* menu) menu->addSeparator(); + auto* actionSampleMode = new QWidgetAction(menu); + actionSampleMode->setText("Use single sample mode"); + auto* sampleModeWidget = new QCheckBox("Use single sample mode",menu); + sampleModeWidget->setChecked(m_document->singleSampleMode()); + connect(sampleModeWidget, &QCheckBox::toggled, this, &SampleView::onSingleSampleModeChanged); + actionSampleMode->setCheckable(true); + actionSampleMode->setDefaultWidget(sampleModeWidget); + menu->addAction(actionSampleMode); + auto* action = new QAction(menu); action->setText("Reset to default layout"); connect(action, &QAction::triggered, this, &SampleView::resetLayout); menu->addAction(action); - - auto* actionSampleMode = new QAction(menu); - actionSampleMode->setText("Use single sample mode"); - actionSampleMode->setCheckable(true); - actionSampleMode->setChecked(m_document->singleSampleMode()); - connect(actionSampleMode, &QAction::triggered, this, &SampleView::onSingleSampleModeChanged); - menu->addAction(actionSampleMode); } void SampleView::showEvent(QShowEvent*) diff --git a/GUI/gui.qrc b/GUI/gui.qrc index c38154ec965..da7f42ed785 100644 --- a/GUI/gui.qrc +++ b/GUI/gui.qrc @@ -30,7 +30,12 @@ <file>images/main_testview.svg</file> <file>images/about_icon.awk</file> <file>images/caret-down.svg</file> + <file>images/caret-up.svg</file> <file>images/caret-right.svg</file> + <file>images/dock-close.svg</file> + <file>images/dock-float.svg</file> + <file>images/checkbox-checked.svg</file> + <file>images/radio-checked.svg</file> <file>images/gisas_instrument.svg</file> <file>images/gisas_instrument_new.svg</file> <file>images/gisas_instrument_shaded.svg</file> diff --git a/GUI/images/caret-up.svg b/GUI/images/caret-up.svg new file mode 100644 index 00000000000..dde71c72dbb --- /dev/null +++ b/GUI/images/caret-up.svg @@ -0,0 +1,57 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + width="1792" + height="1792" + viewBox="0 0 1792 1792" + id="svg2" + version="1.1" + inkscape:version="1.2.2 (b0a8486541, 2022-12-01)" + sodipodi:docname="caret-up.svg" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns="http://www.w3.org/2000/svg" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:dc="http://purl.org/dc/elements/1.1/"> + <metadata + id="metadata10"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs8" /> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1920" + inkscape:window-height="1013" + id="namedview6" + showgrid="false" + inkscape:zoom="0.13169643" + inkscape:cx="334.10169" + inkscape:cy="903.59321" + inkscape:window-x="0" + inkscape:window-y="0" + inkscape:window-maximized="1" + inkscape:current-layer="svg2" + inkscape:showpageshadow="2" + inkscape:pagecheckerboard="0" + inkscape:deskcolor="#d1d1d1" /> + <path + d="m 1408,1152 q 0,-26 -19,-45 L 941,659 q -19,-19 -45,-19 -26,0 -45,19 l -448,448 q -19,19 -19,45 0,26 19,45 19,19 45,19 h 896 q 26,0 45,-19 19,-19 19,-45 z" + id="path4" + style="fill:#696c70;fill-opacity:1" /> +</svg> diff --git a/GUI/images/checkbox-checked.svg b/GUI/images/checkbox-checked.svg new file mode 100644 index 00000000000..d37c9e8387e --- /dev/null +++ b/GUI/images/checkbox-checked.svg @@ -0,0 +1,80 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + width="1792" + height="1792" + viewBox="0 0 1792 1792" + id="svg2" + version="1.1" + inkscape:version="1.2.2 (b0a8486541, 2022-12-01)" + sodipodi:docname="checkbox-checked.svg" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns="http://www.w3.org/2000/svg" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:dc="http://purl.org/dc/elements/1.1/"> + <metadata + id="metadata10"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs8"> + <inkscape:path-effect + effect="fillet_chamfer" + id="path-effect1072" + is_visible="true" + lpeversion="1" + nodesatellites_param="F,1,0,1,0,0.07,0,5 @ F,1,0,1,0,0.07,0,5 @ F,1,0,1,0,0.07,0,5 @ F,1,0,1,0,0.07,0,5 @ F,1,0,1,0,0.07,0,5 @ F,1,0,1,0,0.07,0,5" + unit="px" + method="bezier" + mode="F" + radius="7" + chamfer_steps="5" + flexible="true" + use_knot_distance="true" + apply_no_radius="true" + apply_with_radius="true" + only_selected="false" + hide_knots="false" /> + </defs> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1920" + inkscape:window-height="1013" + id="namedview6" + showgrid="false" + inkscape:zoom="0.13169643" + inkscape:cx="2167.8644" + inkscape:cy="-964.33897" + inkscape:window-x="0" + inkscape:window-y="0" + inkscape:window-maximized="1" + inkscape:current-layer="svg2" + inkscape:showpageshadow="2" + inkscape:pagecheckerboard="0" + inkscape:deskcolor="#d1d1d1"> + <inkscape:grid + type="xygrid" + id="grid513" /> + </sodipodi:namedview> + <path + style="fill:#696c70;stroke:#ebe955;stroke-linejoin:round;stroke-dasharray:12, 12;fill-opacity:1" + d="m 148.62915,740.58873 v 0 c 0,0 -113.137086,113.13708 0,226.2742 l 509.11688,509.11687 c 0,0 113.13708,113.137 226.27417,0 l 791.9596,-791.95963 c 0,0 113.1371,-113.13708 0,-226.27417 v 0 c -113.1371,-113.13708 -226.2742,0 -226.2742,0 l -620.08009,620.0801 c -2.17386,2.1739 -57.42379,60.061 -115.67755,1.8072 L 367.83225,733.51766 c 0,0 -106.06602,-106.06602 -219.2031,7.07107 z" + id="path515" + sodipodi:nodetypes="ccccccccccccc" /> +</svg> diff --git a/GUI/images/dock-close.svg b/GUI/images/dock-close.svg new file mode 100644 index 00000000000..f105bfeb250 --- /dev/null +++ b/GUI/images/dock-close.svg @@ -0,0 +1,80 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + width="1792" + height="1792" + viewBox="0 0 1792 1792" + id="svg2" + version="1.1" + inkscape:version="1.2.2 (b0a8486541, 2022-12-01)" + sodipodi:docname="dock-close.svg" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns="http://www.w3.org/2000/svg" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:dc="http://purl.org/dc/elements/1.1/"> + <metadata + id="metadata10"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs8"> + <inkscape:path-effect + effect="fillet_chamfer" + id="path-effect1072" + is_visible="true" + lpeversion="1" + nodesatellites_param="F,1,0,1,0,0.07,0,5 @ F,1,0,1,0,0.07,0,5 @ F,1,0,1,0,0.07,0,5 @ F,1,0,1,0,0.07,0,5 @ F,1,0,1,0,0.07,0,5 @ F,1,0,1,0,0.07,0,5" + unit="px" + method="bezier" + mode="F" + radius="7" + chamfer_steps="5" + flexible="true" + use_knot_distance="true" + apply_no_radius="true" + apply_with_radius="true" + only_selected="false" + hide_knots="false" /> + </defs> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1920" + inkscape:window-height="1013" + id="namedview6" + showgrid="true" + inkscape:zoom="0.093123439" + inkscape:cx="2029.5642" + inkscape:cy="-687.25984" + inkscape:window-x="0" + inkscape:window-y="0" + inkscape:window-maximized="1" + inkscape:current-layer="svg2" + inkscape:showpageshadow="2" + inkscape:pagecheckerboard="0" + inkscape:deskcolor="#d1d1d1"> + <inkscape:grid + type="xygrid" + id="grid513" /> + </sodipodi:namedview> + <path + id="rect342" + style="fill:#696c70;stroke:#ebe955;stroke-width:1.06044;stroke-linejoin:round;stroke-dasharray:12.7251, 12.7251" + d="M 914.06534 1178.8464 L 79.980406 1178.8464 L 79.980406 344.77808 L -79.996979 344.77808 L -79.996979 1178.8464 L -885.40956 1178.8478 L -885.41094 1338.8238 L -79.996979 1338.8238 L -79.996979 2144.2544 L 79.980406 2144.2544 L 79.980406 1338.8238 L 914.06534 1338.8238 L 914.06534 1178.8464 z " + transform="rotate(-45)" /> +</svg> diff --git a/GUI/images/dock-float.svg b/GUI/images/dock-float.svg new file mode 100644 index 00000000000..cfdb8c40511 --- /dev/null +++ b/GUI/images/dock-float.svg @@ -0,0 +1,83 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + width="1792" + height="1792" + viewBox="0 0 1792 1792" + id="svg2" + version="1.1" + inkscape:version="1.2.2 (b0a8486541, 2022-12-01)" + sodipodi:docname="dock-float.svg" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns="http://www.w3.org/2000/svg" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:dc="http://purl.org/dc/elements/1.1/"> + <metadata + id="metadata10"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs8"> + <inkscape:path-effect + effect="fillet_chamfer" + id="path-effect1072" + is_visible="true" + lpeversion="1" + nodesatellites_param="F,1,0,1,0,0.07,0,5 @ F,1,0,1,0,0.07,0,5 @ F,1,0,1,0,0.07,0,5 @ F,1,0,1,0,0.07,0,5 @ F,1,0,1,0,0.07,0,5 @ F,1,0,1,0,0.07,0,5" + unit="px" + method="bezier" + mode="F" + radius="7" + chamfer_steps="5" + flexible="true" + use_knot_distance="true" + apply_no_radius="true" + apply_with_radius="true" + only_selected="false" + hide_knots="false" /> + </defs> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1920" + inkscape:window-height="1013" + id="namedview6" + showgrid="true" + inkscape:zoom="0.16" + inkscape:cx="1568.75" + inkscape:cy="943.75" + inkscape:window-x="0" + inkscape:window-y="0" + inkscape:window-maximized="1" + inkscape:current-layer="svg2" + inkscape:showpageshadow="2" + inkscape:pagecheckerboard="0" + inkscape:deskcolor="#d1d1d1"> + <inkscape:grid + type="xygrid" + id="grid513" /> + </sodipodi:namedview> + <path + id="rect342" + style="fill:#696c70;stroke:#ebe955;stroke-width:0.806;stroke-linejoin:round;stroke-dasharray:9.67186, 9.67186" + d="M 640.40234 159.98438 L 640.40234 319.99219 L 1519.9473 319.99219 L 1519.9473 1119.6465 L 1680.0527 1119.6465 L 1680.0527 319.95117 L 1679.7539 319.95117 L 1679.7539 159.98438 L 640.40234 159.98438 z " /> + <path + id="rect342-5" + style="fill:#696c70;stroke:#ebe955;stroke-width:0.908213;stroke-linejoin:round;stroke-dasharray:10.8984, 10.8984" + d="M 80 480 L 80 640.00586 L 1239.8125 640.00586 L 1239.8125 1400 L 240.5918 1400 L 240.5918 640.37109 L 80.371094 640.37109 L 80.371094 1400 L 80 1400 L 80 1560.0059 L 1399.6758 1560.0059 L 1399.6758 1400 L 1400.0312 1400 L 1400.0312 639.9082 L 1399.6758 639.9082 L 1399.6758 480 L 80 480 z " /> +</svg> diff --git a/GUI/images/radio-checked.svg b/GUI/images/radio-checked.svg new file mode 100644 index 00000000000..5ee7c5aee6f --- /dev/null +++ b/GUI/images/radio-checked.svg @@ -0,0 +1,81 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + width="1792" + height="1792" + viewBox="0 0 1792 1792" + id="svg2" + version="1.1" + inkscape:version="1.2.2 (b0a8486541, 2022-12-01)" + sodipodi:docname="radio-checked.svg" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns="http://www.w3.org/2000/svg" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:dc="http://purl.org/dc/elements/1.1/"> + <metadata + id="metadata10"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs8"> + <inkscape:path-effect + effect="fillet_chamfer" + id="path-effect1072" + is_visible="true" + lpeversion="1" + nodesatellites_param="F,1,0,1,0,0.07,0,5 @ F,1,0,1,0,0.07,0,5 @ F,1,0,1,0,0.07,0,5 @ F,1,0,1,0,0.07,0,5 @ F,1,0,1,0,0.07,0,5 @ F,1,0,1,0,0.07,0,5" + unit="px" + method="bezier" + mode="F" + radius="7" + chamfer_steps="5" + flexible="true" + use_knot_distance="true" + apply_no_radius="true" + apply_with_radius="true" + only_selected="false" + hide_knots="false" /> + </defs> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1920" + inkscape:window-height="1013" + id="namedview6" + showgrid="false" + inkscape:zoom="0.13169643" + inkscape:cx="2027.3898" + inkscape:cy="-356.88135" + inkscape:window-x="0" + inkscape:window-y="0" + inkscape:window-maximized="1" + inkscape:current-layer="svg2" + inkscape:showpageshadow="2" + inkscape:pagecheckerboard="0" + inkscape:deskcolor="#d1d1d1"> + <inkscape:grid + type="xygrid" + id="grid513" /> + </sodipodi:namedview> + <circle + style="fill:#696c70;fill-opacity:1;stroke:#ebe955;stroke-width:0.82697;stroke-linejoin:round;stroke-dasharray:9.92363, 9.92363" + id="path2442" + cx="895.99908" + cy="895.99872" + r="479.76309" /> +</svg> diff --git a/GUI/styles/Base.stylesheet b/GUI/styles/Base.stylesheet index 4af5af6315c..b7dff014cab 100644 --- a/GUI/styles/Base.stylesheet +++ b/GUI/styles/Base.stylesheet @@ -1,95 +1,257 @@ -/* Background For All Main Views */ -QMainWindow,WelcomeView +/* Highlight Border Of Focused Controls With System Highlight Color. */ +::focus{border: 2px solid palette(highlight);} +/* Exclude QCheckBoxes & QRadioButton From Above Rule. */ +/* Their Box Model Includes Indicator and Label.*/ +/* If Not Excluded, They Will Have A Border Around Entire Region. */ +QCheckBox::focus, QRadioButton::focus{border: 0px solid transparent;} +/* Set The Text Color Of All Widgets To Theme Text Color. */ +*{ color: palette(text);} +/* Set Global Theme Background Color. */ +*{background-color: palette(base);} +/* Exclude QCheckBoxes, QRadioButton, QLabel From Above Rule. */ +/* Their Box Model Includes Indicator and Label.*/ +/* If Not Excluded, They Will Have A Box Fill Of The Entire Region. */ +QRadioButton, QCheckBox, QLabel{ background-color: transparent;} +/* Exclude ContentArea From Above Rule. */ +/* Otherwise, It Will Overlay The Custom Colored GroupBox */ +QWidget#ContentArea{background-color: transparent;} +/* Exclude GroupBoxToggler From Above Rule. */ +/* Otherwise, It Will Overlay The Custom Colored GroupBox Title*/ +QWidget#GroupBoxTogglerTitleWidget{background-color: transparent;} +QWidget#GroupBoxToggler{background-color: transparent;} +/* Exclude Child QWidgets Used To Layout Form Items From Above Rule. */ +QWidget#ContentArea .QWidget{ background-color: transparent; } +QScrollArea .QWidget{ background-color: transparent; } +/* Exclude QTreeView & QListView Overlay Widgets From Above Rule. */ +QTreeView::item .QWidget{background-color: transparent;} +QListView::item .QWidget{background-color: transparent;} +/* Set The Background Of SampleView Child Views To A Darker Version*/ +SampleListView, QScrollArea > QWidget > QWidget{background: palette(dark);} +QScrollBar::add-page:horizontal, QScrollBar::sub-page:horizontal{background: none;} +QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical{background: none;} +QTabWidget, QListView{background-color: palette(dark);} +StyledToolbar QToolBar{background-color:transparent;} +/* Common Style For All Input Controls */ +QPushButton,QLineEdit,QTextEdit,QSpinBox,QDoubleSpinBox,ScientificSpinBox,QComboBox { - background-color: @windowBackground; + padding: 4px; + border-radius: 3px; + border: 1px solid; + color:palette(text); + background-color: rgba(100, 100, 100, 0%); + border-color: rgba(100, 100, 100, 25%); +} +QDockWidget::close-button, QDockWidget::float-button +{ + border: 1px solid transparent; + border-radius: 0px; + background: transparent; + padding: 0px; +} +/* Set Highlight Color For Pseudo States Of All Buttons*/ +QAbstractButton::hover{background-color: rgba(100, 100, 100, 35%);} +QDockWidget::close-button:hover, QDockWidget::float-button:hover +{background: rgba(100, 100, 100, 35%);} +QDockWidget::close-button:pressed, QDockWidget::float-button:pressed +{background: rgba(100, 100, 100, 55%);} +QAbstractButton::pressed{background-color: rgba(100, 100, 100, 55%);} +/* Exclude QCheckBoxes & QRadioButton From Above Rule. */ +QRadioButton::hover, QCheckBox::hover{background-color: transparent;} +QRadioButton::pressed, QCheckBox::pressed{background-color: transparent;} + +QMenuBar, QToolBar{border: 0px;} + +/* Set The Alternate Background Color For Use In e.g QTableWidgets Alternate Row Coloring. */ +QAbstractItemView{alternate-background-color:palette(alternate-base);} +/* Set ComboBox Style */ +QComboBox::drop-down +{ + subcontrol-origin: padding; + subcontrol-position: top right; + width: 15px; + border-top-right-radius: 3px; /* same radius as the QComboBox */ + border-bottom-right-radius: 3px; + image: url(:/images/caret-down.svg); } -QWidget +QComboBox::drop-down:hover { - color: @text; + background-color: rgba(100, 100, 100, 10%); } - -QAbstractItemView +QComboBox::drop-down:pressed { - background-color:@windowBackground; - alternate-background-color:@windowBackgroundAlternative; + background-color: rgba(100, 100, 100, 20%); } -QHeaderView::section +/* Set SpinBox Style */ +QSpinBox::up-button,QDoubleSpinBox::up-button,ScientificSpinBox::up-button { - background-color:@windowBackground; + subcontrol-origin: border; + subcontrol-position: top right; + width: 15px; + border-top-right-radius: 3px; /* same radius as the QComboBox */ + border-bottom-right-radius: 3px; + image: url(:/images/caret-up.svg); } -QHeaderView +QSpinBox::up-button:hover,QDoubleSpinBox::up-button:hover,ScientificSpinBox::up-button:hover { - background-color:@windowBackground; + background-color: rgba(100, 100, 100, 10%); } - -/* Style For The Big Action Buttons */ -QPushButton +QSpinBox::up-button:pressed,QDoubleSpinBox::up-button:pressed,ScientificSpinBox::up-button:pressed { - padding: 10px; - border-radius: 6px; - margin-left: 20px; - border: 2px solid; - color:@text; - background-color: @buttonBackground; - border-color: @componentBoder; + background-color: rgba(100, 100, 100, 20%); } -QPushButton:hover +QSpinBox::down-button,QDoubleSpinBox::down-button,ScientificSpinBox::down-button { - background-color: @componentBoder; + subcontrol-origin: border; + subcontrol-position: bottom right; + width: 15px; + border-top-right-radius: 3px; /* same radius as the QComboBox */ + border-bottom-right-radius: 3px; + image: url(:/images/caret-down.svg); } -QPushButton:pressed +QSpinBox::down-button:hover,QDoubleSpinBox::down-button:hover,ScientificSpinBox::down-button:hover { - background-color: @windowBackgroundDarker; + background-color: rgba(100, 100, 100, 10%); } -QMenuBar +QSpinBox::down-button:pressed,QDoubleSpinBox::down-button:pressed,ScientificSpinBox::down-button:pressed { - background-color: @windowBackgroundAlternative; - color: @text; + background-color: rgba(100, 100, 100, 20%); } -QMenu{ - background-color: @windowBackgroundAlternative; - color: @text; +/* Set QTabWidget Style */ +QCheckBox +{ + spacing: 5px; + padding: 0px; } -QToolButton +QCheckBox::indicator { - border: none; - color: @text; + width: 13px; + height: 13px; + border: 1px solid transparent; + background-color: rgba(100, 100, 100, 15%); } -QTabBar +QCheckBox::indicator:checked { - color: @text; - background-color: @windowBackgroundAlternative; + image: url(:/images/checkbox-checked.svg); } -QTabBar::tab +QCheckBox::indicator:hover { - color: @text; + background-color: rgba(100, 100, 100, 10%); } -QTabWidget QWidget +/* Set QRadioButton Style */ +QRadioButton { - background-color: @windowBackgroundDarker; + spacing: 5px; + padding: 0px; } -QTabWidget +QRadioButton::indicator { - background-color: @windowBackgroundDarker; + width: 13px; + height: 13px; + border: 1px solid transparent; + border-radius: 7px; + background-color: rgba(100, 100, 100, 15%); } -QListView +QRadioButton::indicator:checked { - background-color: @windowBackgroundDarker; + image: url(:/images/radio-checked.svg); } -QDialog +QRadioButton::indicator:hover { - background-color: @windowBackground; + background-color: rgba(100, 100, 100, 10%); } -QDialog QLabel +/* Set Style For QMenuBar */ +/* A Selected Item Should Be Highlighted With A Darker Color*/ +QMenuBar::item:selected, QMenu::selected, QMenu::item:selected { - color: @text; + background-color: rgba(0, 0, 0, 15%); } -QDockWidget::title +QMenu{ + background-color: palette(base); + border: 1px solid; + border-color: rgba(100, 100, 100, 25%); + color: palette(text); +} +/* Set The Separator Color To The Same AS The Menu Border Color */ +QMenu::separator { - border: none; - text-align: left; + height: 1px; + background-color: rgba(100, 100, 100, 25%); +} +/* Set Custom Style For QRadioButton & QCheckBox In QMenu */ +QMenu QRadioButton{ + padding: 4px; + margin 4px; +} +QMenu QRadioButton::indicator +{ + width: 13px; + height: 13px; + border: 1px solid transparent; + border-radius: 7px; + margin-left: 4px; + background-color: rgba(100, 100, 100, 15%); +} +QMenu QCheckBox +{ + padding: 4px; + margin 4px; +} +QMenu QCheckBox::indicator +{ + width: 10px; + height: 10px; + border: 0px solid; + margin-left: 4px; + padding: 2px; + background-color: rgba(100, 100, 100, 15%); +} + + +QToolButton{border: none;} +QScrollBar:vertical, QScrollBar:horizontal +{ + border: 1px solid; + border-color: rgba(100, 100, 100, 25%); + background: palette(alternate-base); + margin: 0px 0px 0px 0px; +} +QScrollBar:vertical{width:10px} +QScrollBar:horizontal{height:10px} + +QScrollBar::handle:vertical,QScrollBar::handle:horizontal +{ + background: rgba(100, 100, 100, 55%); + min-height: 0px; + min-width: 0px; +} +QScrollBar::add-line:vertical, QScrollBar::sub-line:vertical,QScrollBar::add-line:horizontal,QScrollBar::sub-line:horizontal +{ + border: 1px solid; + border-color: rgba(100, 100, 100, 25%); + background: palette(alternate-base); + height: 0px; + width: 0px; +} +QScrollBar::add-line:vertical{ + subcontrol-position: bottom; + subcontrol-origin: margin; +} +QScrollBar::sub-line:vertical +{ + subcontrol-position: top; + subcontrol-origin: margin; +} +QScrollBar::add-line:horizontal{ + subcontrol-position: right; + subcontrol-origin: margin; +} +QScrollBar::sub-line:horizontal{ + subcontrol-position: left; + subcontrol-origin: margin; } + + QDockWidget { font: bold 15px; @@ -98,118 +260,162 @@ QDockWidget border: none; text-align: left; padding-top: 10px; - color:@text; - background-color: @windowBackgroundDarker; + color:palette(text); + background-color: palette(dark); + titlebar-close-icon: url(:images/dock-close.svg); + titlebar-normal-icon: url(:images/dock-float.svg); } -QGroupBox + +QDockWidget::title { - background-color: @windowBackgroundAlternative; - padding-top: 0px; border: none; - font: bold 15px; - margin-top: 0px; - padding-bottom: 0px; - padding-left: 0px; - spacing: 5px + text-align: left; } -/* ProjectSettingsView Style */ -ProjectSettingsView QWidget#GroupBoxToggler + +/* Set Style For QGroupBox With Title Set */ +QGroupBox { - background-color: rgba(0, 0, 0, 15%); - color: @text; + background-color: palette(alternate-base); + padding: 5px; + border: 1px solid transparent; + border-radius: 3px; + font: 12px; + margin-top:15px; + spacing: 2px; + background-clip: padding; +} +QGroupBox::title{ + subcontrol-origin: margin; + subcontrol-position: top left; + background-color: transparent; + background-color: palette(alternate-base); + border: 1px solid transparent; + border-radius: 3px; + padding: 0px 5px 4px 2px; + margin-top:2px; + margin-left:1px; + margin-bottom:4px; +} +/* Create A Border Around The GroupBox Inherited Forms For SampleView*/ +CompoundForm,MesocrystalForm,ParticleForm,CoreAndShellForm, ParticleLayoutForm{ + border: 1px solid; + border-color: rgba(100, 100, 100, 55%); } -ProjectSettingsView QGroupBox QLabel,QCheckBox,QRadioButton{ - color: @text; +/* Reset Margin From QGroupBox To 0px To Save Space In SampleView */ +LayerForm{ + margin-top:0px; } -/*SampleView Style */ -SampleListView +/* Set The Style For The Global SideBar */ +QToolButton#ViewSelectionButton { - background-color: @windowBackgroundDarker; + border: none; + color: white; background-color: #347a9c; } -MultiLayerForm QPushButton + +QToolButton#ViewSelectionButton:pressed { - padding: 4px; - margin-left: 0px; - border-radius: 4px; - border: 1px solid; - background: @buttonBackground; - color:@text; + color: black; background-color: #dae7ed; } -MultiLayerForm QPushButton:hover + +QToolButton#ViewSelectionButton:hover { - border-radius: 4px; - border: 2px solid; - background-color: rgba(0,0,0,0.15); + color: white; background-color: #448aac; } -MultiLayerForm QGroupBox + +QToolButton#ViewSelectionButton:checked { - padding-top: 0px; - border: none; - font: bold 15px; - margin-top: 0px; - padding-bottom: 0px; - padding-left: 0px; - spacing: 5px + color: black; background-color: #dae7ed; } -MultiLayerForm -{ - background-color: @windowBackgroundAlternative; + +/* Set Hover Style To Indicate Focused GroupBox */ +QWidget#GroupBoxTogglerTitleWidget:hover{ + background-color: rgba(100,100,100,10%); } -MultiLayerForm QWidget#GroupBoxTogglerTitleWidget + +QTabWidget::pane { - background-color: rgba(0, 0, 0, 15%) + border: 1px solid; + border-color: rgba(100, 100, 100, 25%); + padding: 5px; + margin: 0px; } -MultiLayerForm QWidget#GroupBoxToggler + +QTabWidget::tab-bar { - background-color: transparent; - font: bold 15px; + left: 5px; } -RealSpacePanel QLabel{ - color: @text; + +QTabBar::tab +{ + color: palette(text); + border: 1px solid transparent; + padding: 5px; + margin-right: 2px; + min-width: 100px; + background-color: rgba(100, 100, 100,10%); } -/* InstrumentView Style */ -InstrumentView QLabel +QTabBar::tab:selected { - color: @text; + background-color: rgba(100, 100, 100,55%); + color: palette(text); } -InstrumentView QGroupBox + +QTabBar::tab:hover { - background-color: @windowBackgroundAlternative; - padding-top: 0px; - border: none; - font: bold 15px; - margin-top: 0px; - padding-bottom: 0px; - padding-left: 0px; - spacing: 5px + background-color: rgba(100, 100, 100,35%); + color: palette(text); } -QScrollArea > QWidget > QWidget +QTabBar::tab:top { - background: @windowBackgroundDarker; + border-top-left-radius: 3px; + border-top-right-radius: 3px; } -/* SimulationView Style */ -SimulationView QGroupBox QLabel,QCheckBox,QRadioButton +QTabBar::tab:bottom { - color: @text; + border-bottom-left-radius: 3px; + border-bottom-right-radius: 3px; +} +ImportDataView QTreeView::item { + padding: 2px; + border-bottom: 1px solid rgba(100, 100, 100, 25%); } -/* JobView Style */ -RealDataSelectorWidget +QTableView QHeaderView::section { - background-color: @windowBackground; + background-color: palette(alternate-base); + color: palette(text); + padding: 2px; + font: 12px; + spacing: 2px; + background-clip: padding; } -IntensityDataPropertyWidget QGroupBox::title +QTableView QHeaderView::section:horizontal { - font: regular 10px; - padding-left: 15px; - padding-top: 10px; + border: 1px solid transparent; + border-right: 1px solid rgba(100, 100, 100, 25%); } -IntensityDataPropertyWidget QGroupBox +QTableView QHeaderView::section:vertical { - padding: 15px; - padding-top: 35px; - border-radius: 6px; + border: 1px solid transparent; + border-bottom: 1px solid rgba(100, 100, 100, 25%); } +QTableView QHeaderView::section:checked +{ + background-color: palette(alternate-base); + color: palette(text); + padding: 4px; + font: 12px; + spacing: 2px; + background-clip: padding; +} +QTableView QTableCornerButton::section +{ + background-color: palette(alternate-base); + border: 1px solid transparent; + color: palette(text); + font: 12px; + background-clip: padding; +} \ No newline at end of file diff --git a/GUI/styles/Dark.stylesheet b/GUI/styles/Dark.stylesheet index 664a2a87137..295567e2a3d 100644 --- a/GUI/styles/Dark.stylesheet +++ b/GUI/styles/Dark.stylesheet @@ -1,48 +1,37 @@ -QToolButton#ViewSelectionButton -{ - color: white; background-color: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop : 0 rgb(18,25,29), stop : 1 rgb(71,96,107)); -} -QToolButton#ViewSelectionButton:pressed -{ - color: black; background-color: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #97a8b0, stop: 1 #dae7ed); -} -QToolButton#ViewSelectionButton:hover -{ - color: white; background-color: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #254b5c, stop: 1 #448aac); -} -QToolButton#ViewSelectionButton:checked -{ - color: black; background-color: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #97a8b0, stop: 1 #dae7ed); -} -MultiLayerForm QWidget#GroupBoxToggler{ - color:rgb(255,255,255) -} -QToolButton:hover{ - background-color: rgba(255,255,255,0.1) -} -QToolButton:pressed{ - background-color: rgba(255,255,255,0.3) -} -QToolButton:checked{ - color:white; - background-color: rgba(255,255,255,0.3) -} -#MultiLayerForm QGroupBox QPushButton{ - color:black; -} -#MultiLayerForm QLabel{ - color:black; -} -QTextEdit,DoubleSpinBox,QLineEdit,QSpinBox,ScientificSpinBox,QComboBox,SafeSpinBox,QDoubleSpinBox{ - background-color:black; -} -/* Checkbox Integrate of Xi needs special styling to have concistency */ -SampleView QCheckBox{ - color:black; -} -QHeaderView::section{ - background-color:@windowBackground; -} -QHeaderView{ - background-color:@windowBackground; +/* Set The Background Color Of All Common Controls To The Darker Version Of the Background Color*/ +QTextEdit, QLineEdit, QSpinBox, ScientificSpinBox, QDoubleSpinBox, QComboBox, QTabWidget,QDockWidget, QListView, QTableView, QTableWidget, QHeaderView, QProgressBar, QSlider, QScrollBar{ + background-color: palette(dark); +} +/* Set The Text Color Of All Controls In Pseudo State Disabled*/ +::disabled{ + color: dimgray; +} +/* Make The LayerItems In The SampleView Have Round Corners For Pleasant Appearance*/ +SampleView LayerOrientedSampleEditor QScrollArea SampleForm{ + border-radius: 2px; +} +SampleView LayerOrientedSampleEditor QScrollArea LayerForm{ + border-radius: 2px; +} + +/* In Dark Theme Text Color is A Bright White Color*/ +/* This Color Would Clash With The Background Color Of The LayerItems*/ +/* Therefore We Set The Text Color Of Controls Inside The LayerForms To Black*/ +SampleView LayerOrientedSampleEditor QScrollArea LayerForm QCheckBox{ + color: black; +} +SampleView LayerOrientedSampleEditor QScrollArea LayerForm QToolButton{ + color: black; + background-color: "transparent"; +} + +SampleView LayerOrientedSampleEditor QScrollArea LayerForm QPushButton{ + color: black; +} +SampleView LayerOrientedSampleEditor QScrollArea LayerForm QLabel{ + color: black; +} + +SampleView LayerOrientedSampleEditor QScrollArea LayerForm QToolButton{ + background-color: transparent; } diff --git a/GUI/styles/Light.stylesheet b/GUI/styles/Light.stylesheet index 5b84d5290f0..ec91857a00a 100644 --- a/GUI/styles/Light.stylesheet +++ b/GUI/styles/Light.stylesheet @@ -1,37 +1,38 @@ -QToolButton#ViewSelectionButton -{ - color: white; background-color: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop : 0 #153b4c, stop : 1 #347a9c); +QWidget{ + color: palette(text); } -QToolButton#ViewSelectionButton:pressed -{ - color: black;background-color: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #97a8b0, stop: 1 #dae7ed); +QTextEdit, QLineEdit, QSpinBox, ScientificSpinBox, QDoubleSpinBox, QComboBox, QTabWidget,QDockWidget, QListView, QTableView, QTableWidget, QHeaderView, QProgressBar, QSlider, QScrollBar,QToolBar{ + background-color: white; } -QToolButton#ViewSelectionButton:hover -{ - color: white; background-color: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #254b5c, stop: 1 #448aac); +::disabled{ + color: rgb(200,200,200); } -QToolButton#ViewSelectionButton:checked -{ - color: black;background-color: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #97a8b0, stop: 1 #dae7ed); +QRadioButton::indicator:checked { + background-color: rgba(100,100,100,40%); } -QToolButton:hover -{ - background-color: rgba(0,0,0,0.1) +QCheckBox::indicator:checked { + background-color: rgba(100,100,100,40%); } -QToolButton:pressed -{ - background-color: rgba(0,0,0,0.3) +SampleView LayerOrientedSampleEditor QScrollArea SampleForm{ + border-radius: 2px; } -QToolButton:checked -{ +SampleView LayerOrientedSampleEditor QScrollArea LayerForm{ + border-radius: 2px; +} + +SampleView LayerOrientedSampleEditor QScrollArea LayerForm QLabel{ color: black; - background-color: rgba(0,0,0,0.3) } -QHeaderView::section -{ - background-color: @windowBackground; + +SampleView LayerOrientedSampleEditor QScrollArea LayerForm QCheckBox{ + color: black; } -QHeaderView -{ - background-color: @windowBackground; + +SampleView LayerOrientedSampleEditor QScrollArea LayerForm QToolButton{ + color: black; + background-color: "transparent"; } + +SampleView LayerOrientedSampleEditor QScrollArea LayerForm QPushButton{ + color: black; +} \ No newline at end of file diff --git a/GUI/styles/Native.stylesheet b/GUI/styles/Native.stylesheet index e478806af81..62afe187acc 100644 --- a/GUI/styles/Native.stylesheet +++ b/GUI/styles/Native.stylesheet @@ -1,21 +1,46 @@ -QToolButton#ViewSelectionButton -{ - border: none; - color: white; background-color: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop : 0 #153b4c, stop : 1 #347a9c); +QToolButton#ViewSelectionButton +{ + border: none; + color: white; background-color: #347a9c; } QToolButton#ViewSelectionButton:pressed -{ - color: black; background-color: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #97a8b0, stop: 1 #dae7ed); +{ + color: black; background-color: #dae7ed; } -QToolButton#ViewSelectionButton:hover -{ - color: white; background-color: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #254b5c, stop: 1 #448aac); +QToolButton#ViewSelectionButton:hover +{ + color: white; background-color: #448aac; } -QToolButton#ViewSelectionButton:checked -{ - color: black; background-color: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #97a8b0, stop: 1 #dae7ed); -} +QToolButton#ViewSelectionButton:checked +{ + color: black; background-color: #dae7ed; +} +SampleView QGroupBox +{ + border: 1px solid rgba(0, 0, 0,0%); + border-radius: 3px; +} + +SampleView LayerOrientedSampleEditor QScrollArea LayerForm QLabel{ + color: black; +} + +SampleView LayerOrientedSampleEditor QScrollArea LayerForm QCheckBox{ + color: black; +} + +SampleView LayerOrientedSampleEditor QScrollArea LayerForm QToolButton{ + color: black; +} + +SampleView LayerOrientedSampleEditor QScrollArea LayerForm QPushButton{ + color: black; +} +CompoundForm, LayerForm,MesocrystalForm,ParticleForm,CoreAndShellForm, ParticleLayoutForm{ + border: 1px solid; + border-color: rgba(100, 100, 100, 10%); +} \ No newline at end of file -- GitLab