diff --git a/ApplicationCode/Resources/themes/dark.qss b/ApplicationCode/Resources/themes/dark.qss index ee222879fe..cb13598f1c 100644 --- a/ApplicationCode/Resources/themes/dark.qss +++ b/ApplicationCode/Resources/themes/dark.qss @@ -5,8 +5,11 @@ $backgroundColor3: #5a6067; // Background color layer 3 $backgroundColor4: #89939d; // Background color layer 4 $backgroundColor5: #adbac6; // Background color layer 5 $textColor: #e6e7ea; // Main text color -$primaryColor: #018fa3; // Primary color (buttons etc) -$secondaryColor: #e82257; // Secondary color +$inputColor: #394046; // Input background color +$buttonColor: #0a639d; // Button color +$buttonHoverColor: #136fa3; // Button hover color +$primaryColor: #084771; // Primary color +$secondaryColor: #cc6632; // Secondary color $tertiaryColor: #ffc50d; // Tertiary color $quaternaryColor: #36b27e; // Quaternary color $quinaryColor: #0ce5d5; // Quinary color @@ -24,38 +27,39 @@ $plotGridColor: #394046; // Plot grid color $auxiliaryCurveColor: #000000; // Auxiliary curve color $externalInputColor: #e82257; // External input background color +QCheckBox::indicator, QTreeView::indicator, QTableView::indicator { + background-color: $backgroundColor1; + border-radius: 3px; + width: 16px; + height: 16px; +} + QCheckBox::indicator:unchecked, QTreeView::indicator:unchecked, QTableView::indicator:unchecked { - background-color: $backgroundColor1; image: url(:/themes/dark/checkbox-unchecked.svg); } QCheckBox::indicator:checked, QTreeView::indicator:checked, QTableView::indicator:checked { - background-color: $backgroundColor1; image: url(:/themes/dark/checkbox-checked.svg); } QCheckBox::indicator:indeterminate, QTreeView::indicator:indeterminate, QTableView::indicator:indeterminate { - background-color: $backgroundColor1; image: url(:/themes/dark/checkbox-indeterminate.svg); } QCheckBox::indicator:unchecked:disabled, QTreeView::indicator:unchecked:disabled, QTableView::indicator:unchecked:disabled { - background-color: $backgroundColor1; image: url(:/themes/dark/checkbox-unchecked-disabled.svg); } QCheckBox::indicator:checked:disabled, QTreeView::indicator:checked:disabled, QTableView::indicator:checked:disabled { - background-color: $backgroundColor1; image: url(:/themes/dark/checkbox-checked-disabled.svg); } QCheckBox::indicator:indeterminate:disabled, QTreeView::indicator:indeterminate:disabled, QTableView::indicator:indeterminate:disabled { - background-color: $backgroundColor1; image: url(:/themes/dark/checkbox-indeterminate-disabled.svg); } @@ -142,7 +146,7 @@ QToolButton { padding: 3px; } -QLabel, QCheckBox { +QLabel { background-color: transparent; } @@ -150,6 +154,7 @@ QWidget { background-color: $mainBackgroundColor; color: $textColor; border-color: $borderColor; + selection-background-color: $primaryColor; } QProgressBar { @@ -252,12 +257,16 @@ QMenu::item:selected { QLineEdit, QComboBox, QSpinBox, QDoubleSpinBox, QDateEdit, QDateTimeEdit { - background-color: $backgroundColor1; + background-color: $inputColor; color: $textColor; - border-color: $borderColor; - border-width : 1.5px; - border-style: solid; + border: 0; padding: 3px; + border: 2px solid $inputColor; +} + +QLineEdit:focus, QComboBox:focus, QSpinBox:focus, +QDoubleSpinBox:focus, QDateEdit:focus, QDateTimeEdit:focus { + border: 2px solid $primaryColor; } QToolBar { @@ -283,11 +292,13 @@ QLCDNumber { QPushButton { color: $textColor; border-color: $borderColor; - background-color: $backgroundColor1; - border-width: 1.5px; - border-style: solid; - padding: 5px; - font-weight: bold; + background-color: $buttonColor; + border: 0px; + padding: 8px; +} + +QPushButton:hover { + background-color: $buttonHoverColor; } QTabWidget { @@ -426,3 +437,20 @@ QWidget:readonly { background-color: $backgroundColor1; color: $backgroundColor3; } + +QComboBox::drop-down { + subcontrol-origin: padding; + subcontrol-position: top right; + width: 18px; + border: 0px; +} + +QComboBox QAbstractItemView { + background-color: $inputColor; +} + +QComboBox::down-arrow { + image: url(:/themes/dark/expanded.svg); + width: 18px; + height: 16px; +} \ No newline at end of file diff --git a/ApplicationCode/Resources/themes/dark/checkbox-checked-disabled.svg b/ApplicationCode/Resources/themes/dark/checkbox-checked-disabled.svg index d996e272c5..ff95d20a4e 100644 --- a/ApplicationCode/Resources/themes/dark/checkbox-checked-disabled.svg +++ b/ApplicationCode/Resources/themes/dark/checkbox-checked-disabled.svg @@ -1,13 +1,13 @@ + viewBox="0 0 12.9 12.9" style="enable-background:new 0 0 12.9 12.9;" xml:space="preserve"> - - - + + + diff --git a/ApplicationCode/Resources/themes/dark/checkbox-checked.svg b/ApplicationCode/Resources/themes/dark/checkbox-checked.svg index 1ad815be52..b75336e2f1 100644 --- a/ApplicationCode/Resources/themes/dark/checkbox-checked.svg +++ b/ApplicationCode/Resources/themes/dark/checkbox-checked.svg @@ -1,13 +1,13 @@ + viewBox="0 0 12.9 12.9" style="enable-background:new 0 0 12.9 12.9;" xml:space="preserve"> - - - + + + diff --git a/ApplicationCode/Resources/themes/dark/checkbox-indeterminate-disabled.svg b/ApplicationCode/Resources/themes/dark/checkbox-indeterminate-disabled.svg index a6796db7ef..8762076c26 100644 --- a/ApplicationCode/Resources/themes/dark/checkbox-indeterminate-disabled.svg +++ b/ApplicationCode/Resources/themes/dark/checkbox-indeterminate-disabled.svg @@ -1,13 +1,13 @@ + viewBox="0 0 12.9 12.9" style="enable-background:new 0 0 12.9 12.9;" xml:space="preserve"> - - - + + + diff --git a/ApplicationCode/Resources/themes/dark/checkbox-indeterminate.svg b/ApplicationCode/Resources/themes/dark/checkbox-indeterminate.svg index ad3a5d0ec4..03ac3411b5 100644 --- a/ApplicationCode/Resources/themes/dark/checkbox-indeterminate.svg +++ b/ApplicationCode/Resources/themes/dark/checkbox-indeterminate.svg @@ -1,13 +1,13 @@ + viewBox="0 0 12.9 12.9" style="enable-background:new 0 0 12.9 12.9;" xml:space="preserve"> - - - + + + diff --git a/ApplicationCode/Resources/themes/dark/checkbox-tristate-disabled.svg b/ApplicationCode/Resources/themes/dark/checkbox-tristate-disabled.svg deleted file mode 100644 index 37b97857bd..0000000000 --- a/ApplicationCode/Resources/themes/dark/checkbox-tristate-disabled.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - diff --git a/ApplicationCode/Resources/themes/dark/checkbox-tristate.svg b/ApplicationCode/Resources/themes/dark/checkbox-tristate.svg deleted file mode 100644 index 21f5a27312..0000000000 --- a/ApplicationCode/Resources/themes/dark/checkbox-tristate.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - diff --git a/ApplicationCode/Resources/themes/dark/checkbox-unchecked-disabled.svg b/ApplicationCode/Resources/themes/dark/checkbox-unchecked-disabled.svg index b91a3a95e3..2bbbc12de1 100644 --- a/ApplicationCode/Resources/themes/dark/checkbox-unchecked-disabled.svg +++ b/ApplicationCode/Resources/themes/dark/checkbox-unchecked-disabled.svg @@ -1,13 +1,13 @@ + viewBox="0 0 12.9 12.9" style="enable-background:new 0 0 12.9 12.9;" xml:space="preserve"> - - - + + + diff --git a/ApplicationCode/Resources/themes/dark/checkbox-unchecked.svg b/ApplicationCode/Resources/themes/dark/checkbox-unchecked.svg index 4553205349..2bbbc12de1 100644 --- a/ApplicationCode/Resources/themes/dark/checkbox-unchecked.svg +++ b/ApplicationCode/Resources/themes/dark/checkbox-unchecked.svg @@ -1,13 +1,13 @@ + viewBox="0 0 12.9 12.9" style="enable-background:new 0 0 12.9 12.9;" xml:space="preserve"> - - - + + + diff --git a/ApplicationCode/UserInterface/RiuGuiTheme.cpp b/ApplicationCode/UserInterface/RiuGuiTheme.cpp index 3d6f7fa2ed..9c388e3bf8 100644 --- a/ApplicationCode/UserInterface/RiuGuiTheme.cpp +++ b/ApplicationCode/UserInterface/RiuGuiTheme.cpp @@ -22,7 +22,9 @@ #include "RiaGuiApplication.h" #include "RiaPreferences.h" #include "RiuThemesDirectory.h" + #include "cafAppEnum.h" +#include "cafPdmUiTreeViewEditor.h" #include #include @@ -362,6 +364,10 @@ void RiuGuiTheme::updateGuiTheme( RiaDefines::ThemeEnum theme ) { widget->style()->unpolish( widget ); widget->style()->polish( widget ); + if ( caf::PdmUiTreeViewWidget* treeViewWidget = dynamic_cast( widget ) ) + { + treeViewWidget->setStyle( new caf::PdmUiTreeViewStyle ); + } } } diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewEditor.cpp index abf2bff71f..b744ae38f0 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewEditor.cpp @@ -64,87 +64,78 @@ namespace caf { -class PdmUiTreeViewStyle : public QProxyStyle +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void PdmUiTreeViewStyle::drawPrimitive( QStyle::PrimitiveElement element, + const QStyleOption* option, + QPainter* painter, + const QWidget* widget ) const { -public: - void drawPrimitive( PrimitiveElement element, const QStyleOption* option, QPainter* painter, const QWidget* widget ) const override + if ( element == QStyle::PE_IndicatorItemViewItemDrop ) { - if ( element == QStyle::PE_IndicatorItemViewItemDrop ) + painter->setRenderHint( QPainter::Antialiasing, true ); + + if ( option->rect.height() == 0 ) { - painter->setRenderHint( QPainter::Antialiasing, true ); + QPalette palette; + QColor c = QApplication::palette().color( QPalette::Highlight ).darker( 150 ); + QPen pen( c ); + pen.setWidth( 2 ); + QBrush brush( c ); - if ( option->rect.height() == 0 ) - { - QPalette palette; - QColor c = QApplication::palette().color( QPalette::Highlight ).darker( 150 ); - QPen pen( c ); - pen.setWidth( 2 ); - QBrush brush( c ); + painter->setPen( pen ); + painter->setBrush( brush ); - painter->setPen( pen ); - painter->setBrush( brush ); - - painter->drawEllipse( option->rect.topLeft(), 3, 3 ); - painter->drawLine( QPoint( option->rect.topLeft().x() + 3, option->rect.topLeft().y() ), - option->rect.topRight() ); - } - else - { - QPalette palette; - QColor c = QApplication::palette().color( QPalette::Highlight ).darker( 150 ); - QPen pen( c ); - pen.setWidth( 2 ); - - painter->setPen( pen ); - - painter->drawRoundedRect( option->rect, 4, 4 ); - } + painter->drawEllipse( option->rect.topLeft(), 3, 3 ); + painter->drawLine( QPoint( option->rect.topLeft().x() + 3, option->rect.topLeft().y() ), + option->rect.topRight() ); } else { - QProxyStyle::drawPrimitive( element, option, painter, widget ); + QPalette palette; + QColor c = QApplication::palette().color( QPalette::Highlight ).darker( 150 ); + QPen pen( c ); + pen.setWidth( 2 ); + + painter->setPen( pen ); + + painter->drawRoundedRect( option->rect, 4, 4 ); } } -}; + else + { + QProxyStyle::drawPrimitive( element, option, painter, widget ); + } +} //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -class PdmUiTreeViewWidget : public QTreeView +void PdmUiTreeViewWidget::dragMoveEvent( QDragMoveEvent* event ) { -public: - explicit PdmUiTreeViewWidget( QWidget* parent = nullptr ) - : QTreeView( parent ) + caf::PdmUiTreeViewQModel* treeViewModel = dynamic_cast( model() ); + if ( treeViewModel && treeViewModel->dragDropInterface() ) { - setStyle( new PdmUiTreeViewStyle ); - }; - ~PdmUiTreeViewWidget() override{}; - - bool isTreeItemEditWidgetActive() const { return state() == QAbstractItemView::EditingState; } - -protected: - void dragMoveEvent( QDragMoveEvent* event ) override - { - caf::PdmUiTreeViewQModel* treeViewModel = dynamic_cast( model() ); - if ( treeViewModel && treeViewModel->dragDropInterface() ) - { - treeViewModel->dragDropInterface()->onProposedDropActionUpdated( event->proposedAction() ); - } - - QTreeView::dragMoveEvent( event ); + treeViewModel->dragDropInterface()->onProposedDropActionUpdated( event->proposedAction() ); } - void dragLeaveEvent( QDragLeaveEvent* event ) override - { - caf::PdmUiTreeViewQModel* treeViewModel = dynamic_cast( model() ); - if ( treeViewModel && treeViewModel->dragDropInterface() ) - { - treeViewModel->dragDropInterface()->onDragCanceled(); - } + QTreeView::dragMoveEvent( event ); +} - QTreeView::dragLeaveEvent( event ); +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void PdmUiTreeViewWidget::dragLeaveEvent( QDragLeaveEvent* event ) +{ + caf::PdmUiTreeViewQModel* treeViewModel = dynamic_cast( model() ); + if ( treeViewModel && treeViewModel->dragDropInterface() ) + { + treeViewModel->dragDropInterface()->onDragCanceled(); } -}; + + QTreeView::dragLeaveEvent( event ); +} //-------------------------------------------------------------------------------------------------- /// diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewEditor.h b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewEditor.h index bae62a31f1..42e4d8f0f0 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewEditor.h +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewEditor.h @@ -46,6 +46,7 @@ #include #include #include +#include #include #include #include @@ -68,6 +69,35 @@ class PdmUiTreeViewEditor; class PdmUiTreeViewQModel; class PdmUiTreeViewWidget; +class PdmUiTreeViewStyle : public QProxyStyle +{ +public: + void drawPrimitive( QStyle::PrimitiveElement element, + const QStyleOption* option, + QPainter* painter, + const QWidget* widget ) const override; +}; + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +class PdmUiTreeViewWidget : public QTreeView +{ +public: + explicit PdmUiTreeViewWidget( QWidget* parent = nullptr ) + : QTreeView( parent ) + { + setStyle( new PdmUiTreeViewStyle ); + }; + ~PdmUiTreeViewWidget() override{}; + + bool isTreeItemEditWidgetActive() const { return state() == QAbstractItemView::EditingState; } + +protected: + void dragMoveEvent( QDragMoveEvent* event ) override; + void dragLeaveEvent( QDragLeaveEvent* event ) override; +}; + class PdmUiTreeViewItemAttribute : public PdmUiEditorAttribute { public: