Update Qt namespace flags
This commit is contained in:
@@ -27,8 +27,8 @@ import logging
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from PyQt5.QtCore import QTimer, pyqtSlot
|
||||
from PyQt5.QtGui import QCloseEvent
|
||||
from PyQt5.QtCore import QTimer, Qt, pyqtSlot
|
||||
from PyQt5.QtWidgets import (
|
||||
QAbstractButton, QAbstractItemView, QDialog, QDialogButtonBox, QFileDialog,
|
||||
QGridLayout, QHBoxLayout, QLabel, QLineEdit, QListWidget, QListWidgetItem,
|
||||
@@ -44,7 +44,7 @@ from novelwriter.core.item import NWItem
|
||||
from novelwriter.enum import nwBuildFmt
|
||||
from novelwriter.extensions.modified import NIconToolButton
|
||||
from novelwriter.extensions.simpleprogress import NProgressSimple
|
||||
from novelwriter.types import QtAlignCenter
|
||||
from novelwriter.types import QtAlignCenter, QtUserRole
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -56,7 +56,7 @@ class GuiManuscriptBuild(QDialog):
|
||||
independently of the Manuscript Build Tool.
|
||||
"""
|
||||
|
||||
D_KEY = Qt.ItemDataRole.UserRole
|
||||
D_KEY = QtUserRole
|
||||
|
||||
def __init__(self, parent: QWidget, build: BuildSettings):
|
||||
super().__init__(parent=parent)
|
||||
|
||||
@@ -53,7 +53,8 @@ from novelwriter.gui.theme import STYLES_FLAT_TABS, STYLES_MIN_TOOLBUTTON
|
||||
from novelwriter.tools.manusbuild import GuiManuscriptBuild
|
||||
from novelwriter.tools.manussettings import GuiBuildSettings
|
||||
from novelwriter.types import (
|
||||
QtAlignAbsolute, QtAlignCenter, QtAlignJustify, QtAlignRight, QtAlignTop
|
||||
QtAlignAbsolute, QtAlignCenter, QtAlignJustify, QtAlignRight, QtAlignTop,
|
||||
QtUserRole
|
||||
)
|
||||
|
||||
if TYPE_CHECKING: # pragma: no cover
|
||||
@@ -70,7 +71,7 @@ class GuiManuscript(QDialog):
|
||||
a document directly to disk.
|
||||
"""
|
||||
|
||||
D_KEY = Qt.ItemDataRole.UserRole
|
||||
D_KEY = QtUserRole
|
||||
|
||||
def __init__(self, mainGui: GuiMain) -> None:
|
||||
super().__init__(parent=mainGui)
|
||||
@@ -661,7 +662,7 @@ class _DetailsWidget(QWidget):
|
||||
|
||||
class _OutlineWidget(QWidget):
|
||||
|
||||
D_LINE = Qt.ItemDataRole.UserRole
|
||||
D_LINE = QtUserRole
|
||||
|
||||
outlineEntryClicked = pyqtSignal(str)
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ from novelwriter.extensions.modified import NComboBox, NDoubleSpinBox, NIconTool
|
||||
from novelwriter.extensions.pagedsidebar import NPagedSideBar
|
||||
from novelwriter.extensions.switch import NSwitch
|
||||
from novelwriter.extensions.switchbox import NSwitchBox
|
||||
from novelwriter.types import QtAlignLeft
|
||||
from novelwriter.types import QtAlignLeft, QtUserRole
|
||||
|
||||
if TYPE_CHECKING: # pragma: no cover
|
||||
from novelwriter.guimain import GuiMain
|
||||
@@ -289,8 +289,8 @@ class _FilterTab(NFixedPage):
|
||||
C_ACTIVE = 1
|
||||
C_STATUS = 2
|
||||
|
||||
D_HANDLE = Qt.ItemDataRole.UserRole
|
||||
D_FILE = Qt.ItemDataRole.UserRole + 1
|
||||
D_HANDLE = QtUserRole
|
||||
D_FILE = QtUserRole + 1
|
||||
|
||||
F_NONE = 0
|
||||
F_FILTERED = 1
|
||||
|
||||
@@ -26,8 +26,8 @@ from __future__ import annotations
|
||||
import math
|
||||
import logging
|
||||
|
||||
from PyQt5.QtCore import pyqtSlot
|
||||
from PyQt5.QtGui import QCloseEvent
|
||||
from PyQt5.QtCore import Qt, pyqtSlot
|
||||
from PyQt5.QtWidgets import (
|
||||
QAbstractItemView, QDialog, QDialogButtonBox, QFormLayout, QGridLayout,
|
||||
QHBoxLayout, QLabel, QSpinBox, QStackedWidget, QTreeWidget,
|
||||
@@ -41,7 +41,7 @@ from novelwriter.extensions.configlayout import NColourLabel, NFixedPage, NScrol
|
||||
from novelwriter.extensions.novelselector import NovelSelector
|
||||
from novelwriter.extensions.pagedsidebar import NPagedSideBar
|
||||
from novelwriter.extensions.switch import NSwitch
|
||||
from novelwriter.types import QtAlignRight
|
||||
from novelwriter.types import QtAlignRight, QtDecoration
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -485,7 +485,7 @@ class _ContentsPage(NFixedPage):
|
||||
if tTitle.strip() == "":
|
||||
tTitle = self.tr("Untitled")
|
||||
|
||||
newItem.setData(self.C_TITLE, Qt.DecorationRole, hDec)
|
||||
newItem.setData(self.C_TITLE, QtDecoration, hDec)
|
||||
newItem.setText(self.C_TITLE, tTitle)
|
||||
newItem.setText(self.C_WORDS, f"{wCount:n}")
|
||||
newItem.setText(self.C_PAGES, f"{pCount:n}")
|
||||
|
||||
@@ -42,7 +42,7 @@ from novelwriter.common import formatTime, checkInt, checkIntTuple, minmax
|
||||
from novelwriter.constants import nwConst
|
||||
from novelwriter.error import formatException
|
||||
from novelwriter.extensions.switch import NSwitch
|
||||
from novelwriter.types import QtAlignLeftMiddle, QtAlignRight, QtAlignRightMiddle
|
||||
from novelwriter.types import QtAlignLeftMiddle, QtAlignRight, QtAlignRightMiddle, QtDecoration
|
||||
|
||||
if TYPE_CHECKING: # pragma: no cover
|
||||
from novelwriter.guimain import GuiMain
|
||||
@@ -122,10 +122,11 @@ class GuiWritingStats(QDialog):
|
||||
hHeader.setTextAlignment(self.C_IDLE, QtAlignRight)
|
||||
hHeader.setTextAlignment(self.C_COUNT, QtAlignRight)
|
||||
|
||||
sDec = Qt.SortOrder.DescendingOrder
|
||||
sAsc = Qt.SortOrder.AscendingOrder
|
||||
sortCol = minmax(pOptions.getInt("GuiWritingStats", "sortCol", 0), 0, 2)
|
||||
sortOrder = checkIntTuple(
|
||||
pOptions.getInt("GuiWritingStats", "sortOrder", Qt.DescendingOrder),
|
||||
(Qt.AscendingOrder, Qt.DescendingOrder), Qt.DescendingOrder
|
||||
pOptions.getInt("GuiWritingStats", "sortOrder", sDec), (sAsc, sDec), sDec
|
||||
)
|
||||
self.listBox.sortByColumn(sortCol, sortOrder) # type: ignore
|
||||
self.listBox.setSortingEnabled(True)
|
||||
@@ -571,6 +572,8 @@ class GuiWritingStats(QDialog):
|
||||
pcTotal = wcTotal
|
||||
|
||||
# Populate the list
|
||||
mTrans = Qt.TransformationMode.FastTransformation
|
||||
mAspect = Qt.AspectRatioMode.IgnoreAspectRatio
|
||||
showIdleTime = self.showIdleTime.isChecked()
|
||||
for _, sStart, sDiff, nWords, _, _, sIdle in self.filterData:
|
||||
|
||||
@@ -589,11 +592,9 @@ class GuiWritingStats(QDialog):
|
||||
if nWords > 0 and listMax > 0:
|
||||
wBar = self.barImage.scaled(
|
||||
int(200*min(nWords, histMax)/listMax),
|
||||
self.barHeight,
|
||||
Qt.IgnoreAspectRatio,
|
||||
Qt.FastTransformation
|
||||
self.barHeight, mAspect, mTrans
|
||||
)
|
||||
newItem.setData(self.C_BAR, Qt.DecorationRole, wBar)
|
||||
newItem.setData(self.C_BAR, QtDecoration, wBar)
|
||||
|
||||
newItem.setTextAlignment(self.C_LENGTH, QtAlignRight)
|
||||
newItem.setTextAlignment(self.C_IDLE, QtAlignRight)
|
||||
|
||||
Reference in New Issue
Block a user