Add settings to customize context menus

This commit is contained in:
Florian Bruhin 2019-12-16 12:16:09 +01:00
parent 64b0fb41d3
commit 036ddb431f
4 changed files with 76 additions and 0 deletions

View File

@ -23,6 +23,10 @@ Added
- New `tabs.tooltips` setting which can be used to disable hover tooltips for
tabs.
- New settings to configure the appearance of context menus:
- `fonts.contextmenu`
- `colors.contextmenu.bg`
- `colors.contextmenu.fg`
Changed
~~~~~~~

View File

@ -32,6 +32,8 @@
|<<colors.completion.odd.bg,colors.completion.odd.bg>>|Background color of the completion widget for odd rows.
|<<colors.completion.scrollbar.bg,colors.completion.scrollbar.bg>>|Color of the scrollbar in the completion view.
|<<colors.completion.scrollbar.fg,colors.completion.scrollbar.fg>>|Color of the scrollbar handle in the completion view.
|<<colors.contextmenu.bg,colors.contextmenu.bg>>|Background color of the context menu.
|<<colors.contextmenu.fg,colors.contextmenu.fg>>|Foreground color of the context menu.
|<<colors.downloads.bar.bg,colors.downloads.bar.bg>>|Background color for the download bar.
|<<colors.downloads.error.bg,colors.downloads.error.bg>>|Background color for downloads with errors.
|<<colors.downloads.error.fg,colors.downloads.error.fg>>|Foreground color for downloads with errors.
@ -183,6 +185,7 @@
|<<editor.encoding,editor.encoding>>|Encoding to use for the editor.
|<<fonts.completion.category,fonts.completion.category>>|Font used in the completion categories.
|<<fonts.completion.entry,fonts.completion.entry>>|Font used in the completion widget.
|<<fonts.contextmenu,fonts.contextmenu>>|Font used for the context menu.
|<<fonts.debug_console,fonts.debug_console>>|Font used for the debugging console.
|<<fonts.downloads,fonts.downloads>>|Font used for the downloadbar.
|<<fonts.hints,fonts.hints>>|Font used for the hints.
@ -855,6 +858,24 @@ Type: <<types,QssColor>>
Default: +pass:[white]+
[[colors.contextmenu.bg]]
=== colors.contextmenu.bg
Background color of the context menu.
If set to null, the Qt default is used.
Type: <<types,QssColor>>
Default: empty
[[colors.contextmenu.fg]]
=== colors.contextmenu.fg
Foreground color of the context menu.
If set to null, the Qt default is used.
Type: <<types,QssColor>>
Default: empty
[[colors.downloads.bar.bg]]
=== colors.downloads.bar.bg
Background color for the download bar.
@ -2371,6 +2392,15 @@ Type: <<types,Font>>
Default: +pass:[10pt monospace]+
[[fonts.contextmenu]]
=== fonts.contextmenu
Font used for the context menu.
If set to null, the Qt default is used.
Type: <<types,Font>>
Default: empty
[[fonts.debug_console]]
=== fonts.debug_console
Font used for the debugging console.

View File

@ -2040,6 +2040,26 @@ colors.completion.scrollbar.bg:
type: QssColor
desc: Color of the scrollbar in the completion view.
colors.contextmenu.bg:
type:
name: QssColor
none_ok: true
default: null
desc: >-
Background color of the context menu.
If set to null, the Qt default is used.
colors.contextmenu.fg:
type:
name: QssColor
none_ok: true
default: null
desc: >-
Foreground color of the context menu.
If set to null, the Qt default is used.
colors.downloads.bar.bg:
default: black
type: QssColor
@ -2438,6 +2458,16 @@ fonts.completion.category:
type: Font
desc: Font used in the completion categories.
fonts.contextmenu:
type:
name: Font
none_ok: true
default: null
desc: >-
Font used for the context menu.
If set to null, the Qt default is used.
fonts.debug_console:
default: 10pt monospace
type: QtFont

View File

@ -160,6 +160,18 @@ class MainWindow(QWidget):
padding-left: 3px;
padding-right: 3px;
}
QMenu {
{% if conf.fonts.contextmenu %}
font: {{ conf.fonts.contextmenu }};
{% endif %}
{% if conf.colors.contextmenu.bg %}
background-color: {{ conf.colors.contextmenu.bg }};
{% endif %}
{% if conf.colors.contextmenu.fg %}
color: {{ conf.colors.contextmenu.fg }};
{% endif %}
}
"""
def __init__(self, *, private, geometry=None, parent=None):