From 3ae5038d7f823d6ca84496b5bff15b51d3073ccf Mon Sep 17 00:00:00 2001 From: Mathieu Pellerin Date: Sat, 9 Feb 2019 14:28:22 +0700 Subject: [PATCH] [themes] Properly style widget focus --- resources/themes/Blend of Gray/style.qss | 45 ++++++++++++++------ resources/themes/Blend of Gray/variables.qss | 2 + resources/themes/Night Mapping/style.qss | 45 ++++++++++++++------ resources/themes/Night Mapping/variables.qss | 1 + 4 files changed, 69 insertions(+), 24 deletions(-) diff --git a/resources/themes/Blend of Gray/style.qss b/resources/themes/Blend of Gray/style.qss index fd3a0b69766..05834d50162 100644 --- a/resources/themes/Blend of Gray/style.qss +++ b/resources/themes/Blend of Gray/style.qss @@ -290,17 +290,6 @@ QComboBox::indicator { selection-color:transparent; } -QLineEdit:focus -{ - border: 1px solid @selection; -} - - -QTextEdit:focus -{ - border: 1px solid @selection; -} - /* ==================================================================================== */ /* SCROLL BAR */ /* ==================================================================================== */ @@ -719,6 +708,27 @@ QHeaderView::section { padding: 0 0 0.1em 0.2em; } +/* ==================================================================================== */ +/* FOCUS */ +/* ==================================================================================== */ + +QToolButton:focus, QPushButton:focus, QCheckBox:focus, QRadioButton:focus, QGroupBox:focus { + outline:1px solid @focusdark; + outline-radius: 0.2em; +} + +QComboBox:focus, QAbstractSpinBox:focus, QLineEdit:focus, QPlainTextEdit:focus, QTextEdit:focus { + border:1px solid @focus; +} + +QToolButton[autoRaise=true]:focus:!pressed { + border:1px solid @focusdark; +} + +QToolButton[autoRaise=false]:focus:!pressed { + border:1px solid @focus; +} + /* ==================================================================================== */ /* QGIS-SPECIFIC TWEAKS */ /* ==================================================================================== */ @@ -733,6 +743,10 @@ QgsColorButton:hover, QgsColorRampButton:hover, QgsSymbolButton:hover, QgsFontBu color:@itembackground; } +QgsColorButton:focus, QgsColorRampButton:focus, QgsSymbolButton:focus, QgsFontButton:focus { + border:1px solid @focus; +} + QgsMessageBar QLabel, QgsMessageBar QTextEdit, QMessageBar QToolButton { background: transparent; border: none; @@ -775,10 +789,17 @@ QgsMessageBar QScrollBar::down-arrow:vertical { image: url(@theme_path/icons/arrow-down.svg); } -QgsPropertyOverrideButton { +QgsPropertyOverrideButton, QgsPropertyOverrideButton:hover, QgsPropertyOverrideButton:pressed { + background: none; + border: 1px solid rgba(0, 0, 0, 0%); padding: 0px; } +QgsPropertyOverrideButton:focus { + border:1px solid @focusdark; + border-radius: 0.2em; +} + QListWidget#mOptionsListWidget { background-color: @itemdarkbackground; color: @itembackground; diff --git a/resources/themes/Blend of Gray/variables.qss b/resources/themes/Blend of Gray/variables.qss index 327f12214db..8e86798ff6b 100644 --- a/resources/themes/Blend of Gray/variables.qss +++ b/resources/themes/Blend of Gray/variables.qss @@ -12,3 +12,5 @@ @toggleon: #ee7913 @selection: #f0f0f0 @hover: #c7c7c7 +@focusdark: rgba(0,0,0,100) +@focus: rgba(199,199,199,255) diff --git a/resources/themes/Night Mapping/style.qss b/resources/themes/Night Mapping/style.qss index 920d0abb6da..e920f24b435 100644 --- a/resources/themes/Night Mapping/style.qss +++ b/resources/themes/Night Mapping/style.qss @@ -303,17 +303,6 @@ QComboBox::indicator { selection-color:transparent; } -QLineEdit:focus -{ - border: 1px solid @focus; -} - - -QTextEdit:focus -{ - border: 1px solid @focus; -} - /* ==================================================================================== */ /* SCROLL BAR */ /* ==================================================================================== */ @@ -732,6 +721,27 @@ QHeaderView::section { padding: 0 0 0.1em 0.2em; } +QToolButton[autoRaise=true]:focus:!pressed { + border:1px solid @focusdark; +} + +QToolButton[autoRaise=false]:focus:!pressed { + border:1px solid @focusdark; +} + +/* ==================================================================================== */ +/* FOCUS */ +/* ==================================================================================== */ + +QToolButton:focus, QPushButton:focus, QCheckBox:focus, QRadioButton:focus, QGroupBox:focus { + outline:1px solid @focusdark; + outline-radius: 0.2em; +} + +QComboBox:focus, QAbstractSpinBox:focus, QLineEdit:focus, QPlainTextEdit:focus, QTextEdit:focus { + border:1px solid @focusdark; +} + /* ==================================================================================== */ /* QGIS-SPECIFIC TWEAKS */ /* ==================================================================================== */ @@ -746,6 +756,10 @@ QgsColorButton:hover, QgsColorRampButton:hover, QgsSymbolButton:hover, QgsFontBu color:@itembackground; } +QgsColorButton:focus, QgsColorRampButton:focus, QgsSymbolButton:focus, QgsFontButton:focus { + border:1px solid @focusdark; +} + QgsMessageBar QLabel, QgsMessageBar QTextEdit, QMessageBar QToolButton, QMessageBar QToolButton::menu-button { background: transparent; border: none; @@ -788,10 +802,17 @@ QgsMessageBar QScrollBar::down-arrow:vertical { image: url(@theme_path/icons/arrow-down.svg); } -QgsPropertyOverrideButton { +QgsPropertyOverrideButton, QgsPropertyOverrideButton:hover, QgsPropertyOverrideButton:pressed { + background: none; + border: 1px solid rgba(0, 0, 0, 0%); padding: 0px; } +QgsPropertyOverrideButton:focus { + border:1px solid @focusdark; + border-radius: 0.2em; +} + QListWidget#mOptionsListWidget { background-color: @itembackground; color: @text; diff --git a/resources/themes/Night Mapping/variables.qss b/resources/themes/Night Mapping/variables.qss index a2af4daabf9..678feeab4e0 100644 --- a/resources/themes/Night Mapping/variables.qss +++ b/resources/themes/Night Mapping/variables.qss @@ -10,4 +10,5 @@ @toggleoff: #535353 @toggleon: #0f6e00 @selection: #0f6e00 +@focusdark: rgba(215,128,26,100) @focus: #d7801a