From 067bfaa7e699b8ab0d4a1b49b08fcbaf4129dba0 Mon Sep 17 00:00:00 2001 From: Kevin Hendricks Date: Sun, 11 Aug 2024 19:05:56 -0400 Subject: [PATCH] add qss examples to advanced topics --- src/OEBPS/Text/advanced_topics.xhtml | 62 ++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/src/OEBPS/Text/advanced_topics.xhtml b/src/OEBPS/Text/advanced_topics.xhtml index 3fa49d2..9932b22 100644 --- a/src/OEBPS/Text/advanced_topics.xhtml +++ b/src/OEBPS/Text/advanced_topics.xhtml @@ -152,5 +152,67 @@

In addition direct links to the PDF are possible and loading the links into a iframe is alo possible but these approaches do not allow for fallbacks for older e-readers and should be avoided if at all possible.

+ +
+ +

Customizing Sigil with Qt QSS

+ + +

Qt, the Graphical User Interface (GUI) library used by Sigil supports its own user css-like styles called QSS that allow the user to modify many aspects of Sigil to their preference. Sigil when first launched will automatically load any QSS styles it finds in the QSS stylesheet named qt_styles.qss found in your Sigil Preferences Location folder.

+ +

Here are some simple examples of how you can use Qt's QSS styles to customize Sigil.

+ +

To try any of these, simply copy one of the following QSS code blocks and save it as a text file called "qt_styles.qss" inside your Sigil Preferences Location folder.

+ +

Show Find Replace Buttons as Text Only

+
QFrame QToolButton#findNext, 
+QFrame QToolButton#replaceCurrent, 
+QFrame QToolButton#replaceFind, 
+QFrame QToolButton#restart, 
+QFrame QToolButton#replaceAll, 
+QFrame QToolButton#count {
+    qproperty-toolButtonStyle: ToolButtonTextOnly;
+}
+
+ +

Show Find Replace Buttons as icons and text

+
QFrame QToolButton#findNext, 
+QFrame QToolButton#replaceCurrent, 
+QFrame QToolButton#replaceFind, 
+QFrame QToolButton#restart, 
+QFrame QToolButton#replaceAll, 
+QFrame QToolButton#count {
+    qproperty-toolButtonStyle: ToolButtonTextBesideIcon;
+}
+
+ +

Use QSS to hide all tooltips.

+
QToolTip {
+    max-width:0; max-height:0; margin:0; padding:0;
+}
+
+ +

Hide Find Replace History

+
QFrame QComboBox QAbstractItemView::item {
+    max-height: 0;
+}
+#cbFind, #cbReplace {
+    qproperty-maxCount:0;
+}
+
+ +

Set the Font Family and Font size for the Find and Replace fields

+
#cbFind, #cbReplace {
+    font-family: "Georgia"; font-size: 16px;
+}
+
+ +

This is just a smattering of the styling changes you can make with Sigil using Qt's QSS styles. For further information see these website resources:

+ + + \ No newline at end of file