From 7723f24c124dc6ae7d83581cb48ea2433361f7a3 Mon Sep 17 00:00:00 2001
From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com>
Date: Sat, 6 Jun 2020 10:36:50 +0200
Subject: [PATCH] The correct fix for tree widget font sizes, issue #273
---
nw/assets/themes/gui/default/style.qss | 4 ----
nw/assets/themes/gui/default_dark/styles.qss | 4 ----
nw/gui/outline.py | 5 -----
nw/gui/projload.py | 6 ------
nw/gui/projsettings.py | 8 --------
nw/gui/projtree.py | 12 ------------
6 files changed, 39 deletions(-)
diff --git a/nw/assets/themes/gui/default/style.qss b/nw/assets/themes/gui/default/style.qss
index 90ef623f..14e81208 100644
--- a/nw/assets/themes/gui/default/style.qss
+++ b/nw/assets/themes/gui/default/style.qss
@@ -1,7 +1,3 @@
/**
* Default Theme: Light
*/
-
-QTreeView, QHeaderView {
- font-size: 13px;
-}
diff --git a/nw/assets/themes/gui/default_dark/styles.qss b/nw/assets/themes/gui/default_dark/styles.qss
index 6c847eb6..4b647f09 100644
--- a/nw/assets/themes/gui/default_dark/styles.qss
+++ b/nw/assets/themes/gui/default_dark/styles.qss
@@ -1,7 +1,3 @@
/**
* Default Theme: Dark
*/
-
-QTreeView, QHeaderView {
- font-size: 13px;
-}
diff --git a/nw/gui/outline.py b/nw/gui/outline.py
index 12c26383..ada3c0a8 100644
--- a/nw/gui/outline.py
+++ b/nw/gui/outline.py
@@ -339,8 +339,6 @@ class GuiProjectOutline(QTreeWidget):
headItem.setTextAlignment(self.colIndex[nwOutline.CCOUNT], Qt.AlignRight)
headItem.setTextAlignment(self.colIndex[nwOutline.WCOUNT], Qt.AlignRight)
headItem.setTextAlignment(self.colIndex[nwOutline.PCOUNT], Qt.AlignRight)
- for hItem in self.treeOrder:
- headItem.setFont(self.colIndex[hItem], self.theTheme.guiFont)
currTitle = None
currChapter = None
@@ -433,9 +431,6 @@ class GuiProjectOutline(QTreeWidget):
newItem.setText(self.colIndex[nwOutline.ENTITY], ", ".join(theRefs[nwKeyWords.ENTITY_KEY]))
newItem.setText(self.colIndex[nwOutline.CUSTOM], ", ".join(theRefs[nwKeyWords.CUSTOM_KEY]))
- for i in self.treeOrder:
- newItem.setFont(self.colIndex[i], self.theTheme.guiFont)
-
return newItem
# END Class GuiProjectOutline
diff --git a/nw/gui/projload.py b/nw/gui/projload.py
index 63f0be9f..282a69f7 100644
--- a/nw/gui/projload.py
+++ b/nw/gui/projload.py
@@ -92,9 +92,6 @@ class GuiProjectLoad(QDialog):
treeHead = self.listBox.headerItem()
treeHead.setTextAlignment(1, Qt.AlignRight)
treeHead.setTextAlignment(2, Qt.AlignRight)
- treeHead.setFont(0, self.theTheme.guiFont)
- treeHead.setFont(1, self.theTheme.guiFont)
- treeHead.setFont(2, self.theTheme.guiFont)
self.lblRecent = QLabel("Recently Opened Projects")
self.lblPath = QLabel("Path")
@@ -260,9 +257,6 @@ class GuiProjectLoad(QDialog):
newItem.setTextAlignment(0, Qt.AlignLeft | Qt.AlignVCenter)
newItem.setTextAlignment(1, Qt.AlignRight | Qt.AlignVCenter)
newItem.setTextAlignment(2, Qt.AlignRight | Qt.AlignVCenter)
- newItem.setFont(0, self.theTheme.guiFont)
- newItem.setFont(1, self.theTheme.guiFont)
- newItem.setFont(2, self.theTheme.guiFont)
self.listBox.addTopLevelItem(newItem)
if not hasSelection:
newItem.setSelected(True)
diff --git a/nw/gui/projsettings.py b/nw/gui/projsettings.py
index a1c28ca4..3722d41c 100644
--- a/nw/gui/projsettings.py
+++ b/nw/gui/projsettings.py
@@ -450,14 +450,8 @@ class GuiProjectEditReplace(QWidget):
self.listBox.itemSelectionChanged.connect(self._selectedItem)
self.listBox.setIndentation(0)
- treeHead = self.listBox.headerItem()
- treeHead.setFont(0, self.theTheme.guiFont)
- treeHead.setFont(1, self.theTheme.guiFont)
-
for aKey, aVal in self.theProject.autoReplace.items():
newItem = QTreeWidgetItem(["<%s>" % aKey, aVal])
- newItem.setFont(0, self.theTheme.guiFont)
- newItem.setFont(1, self.theTheme.guiFont)
self.listBox.addTopLevelItem(newItem)
self.listBox.sortByColumn(0, Qt.AscendingOrder)
@@ -548,8 +542,6 @@ class GuiProjectEditReplace(QWidget):
saveKey = "" % (self.listBox.topLevelItemCount() + 1)
newVal = ""
newItem = QTreeWidgetItem([saveKey, newVal])
- newItem.setFont(0, self.theTheme.guiFont)
- newItem.setFont(1, self.theTheme.guiFont)
self.listBox.addTopLevelItem(newItem)
return True
diff --git a/nw/gui/projtree.py b/nw/gui/projtree.py
index 72246c3a..312d3a75 100644
--- a/nw/gui/projtree.py
+++ b/nw/gui/projtree.py
@@ -79,14 +79,6 @@ class GuiProjectTree(QTreeWidget):
treeHeadItem.setToolTip(self.C_EXPORT, "Include in build")
treeHeadItem.setToolTip(self.C_FLAGS, "Status, class, and layout flags")
- # Force the font to fix font sizing issues on some platforms
- # like Ubuntu. This must also be set when the rows are added.
- self.setFont(self.theTheme.guiFont)
- treeHeadItem.setFont(self.C_NAME, self.theTheme.guiFont)
- treeHeadItem.setFont(self.C_COUNT,self.theTheme.guiFont)
- treeHeadItem.setFont(self.C_EXPORT, self.theTheme.guiFont)
- treeHeadItem.setFont(self.C_FLAGS, self.theTheme.guiFont)
-
# Let the last column stretch, and set the minimum size to the
# size of the icon as the default Qt font metrics approach fails
# for some fonts like the Ubuntu font.
@@ -599,10 +591,6 @@ class GuiProjectTree(QTreeWidget):
newItem.setTextAlignment(self.C_EXPORT, Qt.AlignLeft | Qt.AlignVCenter)
newItem.setTextAlignment(self.C_FLAGS, Qt.AlignLeft | Qt.AlignVCenter)
- newItem.setFont(self.C_NAME, self.theTheme.guiFont)
- newItem.setFont(self.C_COUNT, self.theTheme.guiFont)
- newItem.setFont(self.C_FLAGS, self.theTheme.guiFont)
-
newItem.setData(self.C_NAME, Qt.UserRole, tHandle)
self.theMap[tHandle] = newItem