Add option to hide scrollbars on all major GUI areas

This commit is contained in:
Veronica K. B. Olsen
2020-10-11 16:40:54 +02:00
parent 80e8788baa
commit fe71353198
8 changed files with 68 additions and 2 deletions
+4
View File
@@ -102,6 +102,10 @@ class Config:
self.outlnPanePos = [500, 150]
self.isFullScreen = False
## Features
self.hideVScroll = False # Hide vertical scroll bars on main widgets
self.hideHScroll = False # Hide horizontal scroll bars on main widgets
## Project
self.autoSaveProj = 60
self.autoSaveDoc = 30
+10 -2
View File
@@ -450,10 +450,12 @@ class GuiBuildNovel(QDialog):
# Tool Box Scroll Area
self.toolsArea = QScrollArea()
self.toolsArea.setMinimumWidth(self.mainConf.pxInt(250))
self.toolsArea.setHorizontalScrollBarPolicy(Qt.ScrollBarAsNeeded)
self.toolsArea.setVerticalScrollBarPolicy(Qt.ScrollBarAsNeeded)
self.toolsArea.setWidgetResizable(True)
self.toolsArea.setWidget(self.toolsWidget)
if self.mainConf.hideVScroll:
self.toolsArea.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
if self.mainConf.hideHScroll:
self.toolsArea.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
# Tools and Buttons Layout
self.innerBox = QVBoxLayout()
@@ -1116,6 +1118,12 @@ class GuiBuildNovelDocView(QTextBrowser):
else:
self.setTabStopWidth(self.mainConf.getTabWidth())
# Scroll bars
if self.mainConf.hideVScroll:
self.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
if self.mainConf.hideHScroll:
self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
docPalette = self.palette()
docPalette.setColor(QPalette.Base, QColor(255, 255, 255))
docPalette.setColor(QPalette.Text, QColor(0, 0, 0))
+6
View File
@@ -224,6 +224,12 @@ class GuiDocEditor(QTextEdit):
self.qDocument.setDefaultTextOption(theOpt)
# Scroll bars
if self.mainConf.hideVScroll:
self.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
if self.mainConf.hideHScroll:
self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
# Refresh the tab stops
if self.mainConf.verQtValue >= 51000:
self.setTabStopDistance(self.mainConf.getTabWidth())
+6
View File
@@ -124,6 +124,12 @@ class GuiDocViewer(QTextBrowser):
theOpt.setAlignment(Qt.AlignJustify)
self.qDocument.setDefaultTextOption(theOpt)
# Scroll bars
if self.mainConf.hideVScroll:
self.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
if self.mainConf.hideHScroll:
self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
# Refresh the tab stops
if self.mainConf.verQtValue >= 51000:
self.setTabStopDistance(self.mainConf.getTabWidth())
+12
View File
@@ -118,6 +118,7 @@ class GuiOutline(QTreeWidget):
self.colIndex = {}
self.treeNCols = 0
self.initOutline()
self.clearOutline()
self.headerMenu.setHiddenState(self.colHidden)
@@ -125,6 +126,17 @@ class GuiOutline(QTreeWidget):
return
def initOutline(self):
"""Set or update outline settings.
"""
# Scroll bars
if self.mainConf.hideVScroll:
self.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
if self.mainConf.hideHScroll:
self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
return
def clearOutline(self):
"""Clear the tree and header and set the default values for the
columns arrays.
+13
View File
@@ -224,10 +224,23 @@ class GuiOutlineDetails(QScrollArea):
self.setVerticalScrollBarPolicy(Qt.ScrollBarAsNeeded)
self.setWidgetResizable(True)
self.initDetails()
logger.debug("GuiOutlineDetails initialisation complete")
return
def initDetails(self):
"""Set or update outline settings.
"""
# Scroll bars
if self.mainConf.hideVScroll:
self.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
if self.mainConf.hideHScroll:
self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
return
def showItem(self, tHandle, sTitle):
"""Update the content of the tree with the given handle and line
number pointing to a header.
+14
View File
@@ -115,6 +115,9 @@ class GuiProjectTree(QTreeWidget):
# The last column should just auto-scale
self.resizeColumnToContents(self.C_FLAGS)
# Set custom settings
self.initTree()
logger.debug("GuiProjectTree initialisation complete")
# Internal Mapping
@@ -122,6 +125,17 @@ class GuiProjectTree(QTreeWidget):
return
def initTree(self):
"""Set or update tree widget settings.
"""
# Scroll bars
if self.mainConf.hideVScroll:
self.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
if self.mainConf.hideHScroll:
self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
return
##
# Class Methods
##
+3
View File
@@ -790,6 +790,9 @@ class GuiMain(QMainWindow):
self.saveDocument()
self.docEditor.initEditor()
self.docViewer.initViewer()
self.treeView.initTree()
self.projView.initOutline()
self.projMeta.initDetails()
return