Require at least Qt 5.9

This commit is contained in:
Veronica Berglyd Olsen
2022-10-15 22:47:18 +02:00
parent 05ad483f06
commit aadc576d0a
3 changed files with 14 additions and 26 deletions
+4 -4
View File
@@ -214,14 +214,14 @@ def main(sysArgs=None):
"At least Python 3.7 is required, found %s" % CONFIG.verPyString "At least Python 3.7 is required, found %s" % CONFIG.verPyString
) )
errorCode |= 0x04 errorCode |= 0x04
if CONFIG.verQtValue < 50300: if CONFIG.verQtValue < 50900:
errorData.append( errorData.append(
"At least Qt5 version 5.3 is required, found %s" % CONFIG.verQtString "At least Qt5 version 5.9 is required, found %s" % CONFIG.verQtString
) )
errorCode |= 0x08 errorCode |= 0x08
if CONFIG.verPyQtValue < 50300: if CONFIG.verPyQtValue < 50900:
errorData.append( errorData.append(
"At least PyQt5 version 5.3 is required, found %s" % CONFIG.verPyQtString "At least PyQt5 version 5.9 is required, found %s" % CONFIG.verPyQtString
) )
errorCode |= 0x10 errorCode |= 0x10
+3 -11
View File
@@ -220,8 +220,8 @@ class Config:
self.osUnknown = True self.osUnknown = True
# Other System Info # Other System Info
self.hostName = "Unknown" self.hostName = QSysInfo.machineHostName()
self.kernelVer = "Unknown" self.kernelVer = QSysInfo.kernelVersion()
# Packages # Packages
self.hasEnchant = False # The pyenchant package self.hasEnchant = False # The pyenchant package
@@ -264,10 +264,7 @@ class Config:
self.confPath = confPath self.confPath = confPath
if dataPath is None: if dataPath is None:
if self.verQtValue >= 50400: dataRoot = QStandardPaths.writableLocation(QStandardPaths.AppDataLocation)
dataRoot = QStandardPaths.writableLocation(QStandardPaths.AppDataLocation)
else:
dataRoot = QStandardPaths.writableLocation(QStandardPaths.DataLocation)
self.dataPath = os.path.join(os.path.abspath(dataRoot), self.appHandle) self.dataPath = os.path.join(os.path.abspath(dataRoot), self.appHandle)
else: else:
logger.info("Setting data path from alternative path: %s", dataPath) logger.info("Setting data path from alternative path: %s", dataPath)
@@ -347,11 +344,6 @@ class Config:
self.errData.append(formatException(exc)) self.errData.append(formatException(exc))
self.dataPath = None self.dataPath = None
# Host and Kernel
if self.verQtValue >= 50600:
self.hostName = QSysInfo.machineHostName()
self.kernelVer = QSysInfo.kernelVersion()
# Load recent projects cache # Load recent projects cache
self.loadRecentCache() self.loadRecentCache()
+7 -11
View File
@@ -604,19 +604,15 @@ class GuiDocEditor(QTextEdit):
## ##
def getText(self): def getText(self):
"""Get the text content of the current document. This method """Get the text content of the current document. This method uses
uses QTextEdit->toPlainText for Qt versions lower than 5.9, and QTextDocument->toRawText instead of toPlainText(). The former preserves
the QTextDocument->toRawText for higher version. The latter non-breaking spaces, the latter does not. We still want to get rid of
preserves non-breaking spaces, which the former does not. page and line separators though.
We still want to get rid of page and line separators though.
See: https://doc.qt.io/qt-5/qtextdocument.html#toPlainText See: https://doc.qt.io/qt-5/qtextdocument.html#toPlainText
""" """
if self.mainConf.verQtValue >= 50900: theText = self.document().toRawText()
theText = self.document().toRawText() theText = theText.replace(nwUnicode.U_LSEP, "\n") # Line separators
theText = theText.replace(nwUnicode.U_LSEP, "\n") # Line separators theText = theText.replace(nwUnicode.U_PSEP, "\n") # Paragraph separators
theText = theText.replace(nwUnicode.U_PSEP, "\n") # Paragraph separators
else:
theText = self.toPlainText()
return theText return theText
def getCursorPosition(self): def getCursorPosition(self):