Qt5ct: Difference between revisions

From wikinotes
(Created page with "A program to manage qt stylesheets.")
 
 
(7 intermediate revisions by the same user not shown)
Line 1: Line 1:
A program to manage qt stylesheets.
Qt5 attempts to match settings from current desktop environment.<br>
qt5ct lets you set deskto-environment agnostic overrides.
 
= Documentation =
<blockquote>
{| class="wikitable"
|-
| <code>man qt5ct</code> || https://manpages.ubuntu.com/manpages/bionic/man1/qt5ct.1.html
|-
| repo || https://sourceforge.net/projects/qt5ct/
|-
|}
</blockquote><!-- Documentation -->
 
= Locations =
<blockquote>
{| class="wikitable"
|-
| <code>~/.config/qt5ct/qt5ct.conf</code> || user config
|-
| <code>~/.config/qt5ct/qss/*.qss</code> || user qss stylesheets for UI
|-
|-
| <code>/usr/share/qt5ct/qss/*.qss</code> || installed qss stylesheets referenced in UI
|-
|}
</blockquote><!-- Locations -->
 
= Enable =
<blockquote>
<syntaxhighlight lang="bash">
export QT_QPA_PLATFORMTHEME=qt5ct
</syntaxhighlight>
</blockquote><!-- Enable -->
 
= Configuration =
<blockquote>
== Stylesheet Overrides ==
<blockquote>
Add your own stylesheet overrides to <code>~/.config/qt5ct/qss/*.qss</code>.<br>
Enable your overrides in <code>~/.config/qt5ct/qt5ct.conf</code> under <code>[Interface]stylesheets</code>.
 
See [[Python qt: colours/stylesheets]] for syntax.
 
<syntaxhighlight lang="css">
/* ~/.config/qt5ct/qss/*.qss */
 
QSlider::groove:horizontal {
    border: 1px solid palette(mid);
    background: palette(alternate-window);
    height: 10px;
    border-radius: 3px;
}
QSlider::groove:vertical {
    border: 1px solid palette(mid);
    background: palette(alternate-window);
    width: 10px;
    border-radius: 3px;
}
</syntaxhighlight>
 
<syntaxhighlight lang="dosini">
# ~/.config/qt5ct/qt5ct.conf
 
[Interface]
stylesheets=/usr/share/qt5ct/qss/sliders-simple.qss, /usr/share/qt5ct/qss/tooltip-simple.qss
</syntaxhighlight>
</blockquote><!-- Stylesheet Overrides -->
</blockquote><!-- Configuration -->

Latest revision as of 04:19, 4 September 2022

Qt5 attempts to match settings from current desktop environment.
qt5ct lets you set deskto-environment agnostic overrides.

Documentation

man qt5ct https://manpages.ubuntu.com/manpages/bionic/man1/qt5ct.1.html
repo https://sourceforge.net/projects/qt5ct/

Locations

~/.config/qt5ct/qt5ct.conf user config
~/.config/qt5ct/qss/*.qss user qss stylesheets for UI
/usr/share/qt5ct/qss/*.qss installed qss stylesheets referenced in UI

Enable

export QT_QPA_PLATFORMTHEME=qt5ct

Configuration

Stylesheet Overrides

Add your own stylesheet overrides to ~/.config/qt5ct/qss/*.qss.
Enable your overrides in ~/.config/qt5ct/qt5ct.conf under [Interface]stylesheets.

See Python qt: colours/stylesheets for syntax.

/* ~/.config/qt5ct/qss/*.qss */

QSlider::groove:horizontal {
    border: 1px solid palette(mid);
    background: palette(alternate-window);
    height: 10px;
    border-radius: 3px;
}
QSlider::groove:vertical {
    border: 1px solid palette(mid);
    background: palette(alternate-window);
    width: 10px;
    border-radius: 3px;
}
# ~/.config/qt5ct/qt5ct.conf

[Interface]
stylesheets=/usr/share/qt5ct/qss/sliders-simple.qss, /usr/share/qt5ct/qss/tooltip-simple.qss