Fixed clipping of document bar
This commit is contained in:
+14
-10
@@ -33,7 +33,7 @@ from PyQt5.QtCore import Qt, QSize
|
|||||||
from PyQt5.QtGui import QPalette, QColor
|
from PyQt5.QtGui import QPalette, QColor
|
||||||
from PyQt5.QtWidgets import (
|
from PyQt5.QtWidgets import (
|
||||||
qApp, QWidget, QFrame, QGridLayout, QLabel, QLineEdit, QPushButton,
|
qApp, QWidget, QFrame, QGridLayout, QLabel, QLineEdit, QPushButton,
|
||||||
QHBoxLayout
|
QHBoxLayout, QSizePolicy
|
||||||
)
|
)
|
||||||
|
|
||||||
from nw.constants import nwDocAction, nwUnicode
|
from nw.constants import nwDocAction, nwUnicode
|
||||||
@@ -187,8 +187,12 @@ class GuiDocTitleBar(QWidget):
|
|||||||
self.thePalette.setColor(QPalette.Window, QColor(*self.theTheme.colBack))
|
self.thePalette.setColor(QPalette.Window, QColor(*self.theTheme.colBack))
|
||||||
self.thePalette.setColor(QPalette.Text, QColor(*self.theTheme.colText))
|
self.thePalette.setColor(QPalette.Text, QColor(*self.theTheme.colText))
|
||||||
|
|
||||||
|
iPx = self.theTheme.textIconSize
|
||||||
|
hSp = self.mainConf.pxInt(6)
|
||||||
|
self.buttonSize = iPx + hSp
|
||||||
|
|
||||||
# Main Widget Settings
|
# Main Widget Settings
|
||||||
self.setContentsMargins(0, 0, 0, 0)
|
self.setContentsMargins(2*self.buttonSize, 0, 0, 0)
|
||||||
self.setAutoFillBackground(True)
|
self.setAutoFillBackground(True)
|
||||||
self.setPalette(self.thePalette)
|
self.setPalette(self.thePalette)
|
||||||
|
|
||||||
@@ -197,10 +201,11 @@ class GuiDocTitleBar(QWidget):
|
|||||||
self.theTitle.setText("")
|
self.theTitle.setText("")
|
||||||
self.theTitle.setIndent(0)
|
self.theTitle.setIndent(0)
|
||||||
self.theTitle.setMargin(0)
|
self.theTitle.setMargin(0)
|
||||||
self.theTitle.setContentsMargins(10, 0, 0, 0)
|
self.theTitle.setContentsMargins(0, 0, 0, 0)
|
||||||
self.theTitle.setAutoFillBackground(True)
|
self.theTitle.setAutoFillBackground(True)
|
||||||
self.theTitle.setAlignment(Qt.AlignCenter)
|
self.theTitle.setAlignment(Qt.AlignTop | Qt.AlignHCenter)
|
||||||
self.theTitle.setWordWrap(True)
|
self.theTitle.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Minimum)
|
||||||
|
self.theTitle.setMinimumHeight(self.theTheme.fontPixelSize)
|
||||||
self.theTitle.setFrameShape(QFrame.NoFrame)
|
self.theTitle.setFrameShape(QFrame.NoFrame)
|
||||||
self.theTitle.setLineWidth(0)
|
self.theTitle.setLineWidth(0)
|
||||||
self.theTitle.setPalette(self.thePalette)
|
self.theTitle.setPalette(self.thePalette)
|
||||||
@@ -210,8 +215,6 @@ class GuiDocTitleBar(QWidget):
|
|||||||
self.theTitle.setFont(lblFont)
|
self.theTitle.setFont(lblFont)
|
||||||
|
|
||||||
# Buttons
|
# Buttons
|
||||||
iPx = self.theTheme.textIconSize
|
|
||||||
|
|
||||||
self.closeButton = QPushButton("")
|
self.closeButton = QPushButton("")
|
||||||
self.closeButton.setIcon(self.theTheme.getIcon("close"))
|
self.closeButton.setIcon(self.theTheme.getIcon("close"))
|
||||||
self.closeButton.setContentsMargins(0, 0, 0, 0)
|
self.closeButton.setContentsMargins(0, 0, 0, 0)
|
||||||
@@ -241,10 +244,8 @@ class GuiDocTitleBar(QWidget):
|
|||||||
self.refreshButton.clicked.connect(self._refreshDocument)
|
self.refreshButton.clicked.connect(self._refreshDocument)
|
||||||
|
|
||||||
# Assemble Layout
|
# Assemble Layout
|
||||||
hSp = self.mainConf.pxInt(6)
|
|
||||||
self.outerBox = QHBoxLayout()
|
self.outerBox = QHBoxLayout()
|
||||||
self.outerBox.setSpacing(hSp)
|
self.outerBox.setSpacing(hSp)
|
||||||
self.outerBox.addSpacing(2*(iPx + hSp))
|
|
||||||
self.outerBox.addWidget(self.theTitle, 1)
|
self.outerBox.addWidget(self.theTitle, 1)
|
||||||
if self.isEditor:
|
if self.isEditor:
|
||||||
self.outerBox.addWidget(self.minmaxButton, 0)
|
self.outerBox.addWidget(self.minmaxButton, 0)
|
||||||
@@ -315,11 +316,14 @@ class GuiDocTitleBar(QWidget):
|
|||||||
"""Switch on or off zen mode.
|
"""Switch on or off zen mode.
|
||||||
"""
|
"""
|
||||||
self.theParent.theParent.toggleZenMode()
|
self.theParent.theParent.toggleZenMode()
|
||||||
self.closeButton.setVisible(not self.theParent.theParent.isZenMode)
|
|
||||||
if self.theParent.theParent.isZenMode:
|
if self.theParent.theParent.isZenMode:
|
||||||
self.minmaxButton.setIcon(self.theTheme.getIcon("minimise"))
|
self.minmaxButton.setIcon(self.theTheme.getIcon("minimise"))
|
||||||
|
self.setContentsMargins(self.buttonSize, 0, 0, 0)
|
||||||
|
self.closeButton.setVisible(False)
|
||||||
else:
|
else:
|
||||||
self.minmaxButton.setIcon(self.theTheme.getIcon("maximise"))
|
self.minmaxButton.setIcon(self.theTheme.getIcon("maximise"))
|
||||||
|
self.setContentsMargins(2*self.buttonSize, 0, 0, 0)
|
||||||
|
self.closeButton.setVisible(True)
|
||||||
return
|
return
|
||||||
|
|
||||||
def _refreshDocument(self):
|
def _refreshDocument(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user