From e32b3a7fe5e20a8bc47ffb67687a62f227ffe1c2 Mon Sep 17 00:00:00 2001
From: Matthias Metelka <62722460+kleinerpirat@users.noreply.github.com>
Date: Thu, 19 Jan 2023 12:14:52 +0100
Subject: [PATCH] Add separate styling for template editor QGroupBoxes (#2337)
* Add separate styling for template editor GroupBoxes
* Fix title alignment and padding
---
qt/aqt/clayout.py | 2 +-
qt/aqt/forms/template.ui | 2 +-
qt/aqt/stylesheets.py | 10 ++++++++++
3 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/qt/aqt/clayout.py b/qt/aqt/clayout.py
index 807489a10..3e87b0379 100644
--- a/qt/aqt/clayout.py
+++ b/qt/aqt/clayout.py
@@ -247,7 +247,7 @@ class CardLayout(QDialog):
tform.front_button.setText(tr.card_templates_front_template())
tform.back_button.setText(tr.card_templates_back_template())
tform.style_button.setText(tr.card_templates_template_styling())
- tform.groupBox.setTitle(tr.card_templates_template_box())
+ tform.template_box.setTitle(tr.card_templates_template_box())
cnt = self.mw.col.models.use_count(self.model)
tform.changes_affect_label.setText(
diff --git a/qt/aqt/forms/template.ui b/qt/aqt/forms/template.ui
index 61588d377..c0ff9c0a7 100644
--- a/qt/aqt/forms/template.ui
+++ b/qt/aqt/forms/template.ui
@@ -33,7 +33,7 @@
0
-
-
+
GroupBox
diff --git a/qt/aqt/stylesheets.py b/qt/aqt/stylesheets.py
index 69bc7824b..508b7fd43 100644
--- a/qt/aqt/stylesheets.py
+++ b/qt/aqt/stylesheets.py
@@ -88,11 +88,21 @@ class CustomStyles:
border-radius: {tm.var(props.BORDER_RADIUS)};
margin-top: 10px;
}}
+ QGroupBox#preview_box,
+ QGroupBox#template_box {{
+ background: none;
+ border: none;
+ }}
QGroupBox::title {{
subcontrol-origin: margin;
subcontrol-position: top left;
margin: 0 2px;
left: 15px;
+ }}
+ QGroupBox#preview_box::title,
+ QGroupBox#template_box::title {{
+ margin-top: 5px;
+ left: 5px;
}}
"""