Update Qt namespace flags
This commit is contained in:
@@ -26,8 +26,8 @@ from __future__ import annotations
|
||||
|
||||
import logging
|
||||
|
||||
from PyQt5.QtGui import QCloseEvent
|
||||
from PyQt5.QtCore import Qt, pyqtSlot
|
||||
from PyQt5.QtGui import QCloseEvent
|
||||
from PyQt5.QtWidgets import (
|
||||
QAbstractItemView, QDialog, QDialogButtonBox, QGridLayout, QLabel,
|
||||
QListWidget, QListWidgetItem, QVBoxLayout, QWidget
|
||||
@@ -36,13 +36,14 @@ from PyQt5.QtWidgets import (
|
||||
from novelwriter import CONFIG, SHARED
|
||||
from novelwriter.extensions.switch import NSwitch
|
||||
from novelwriter.extensions.configlayout import NColourLabel
|
||||
from novelwriter.types import QtUserRole
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class GuiDocMerge(QDialog):
|
||||
|
||||
D_HANDLE = Qt.ItemDataRole.UserRole
|
||||
D_HANDLE = QtUserRole
|
||||
|
||||
def __init__(self, parent: QWidget, sHandle: str, itemList: list[str]) -> None:
|
||||
super().__init__(parent=parent)
|
||||
@@ -120,7 +121,7 @@ class GuiDocMerge(QDialog):
|
||||
finalItems = []
|
||||
for i in range(self.listBox.count()):
|
||||
item = self.listBox.item(i)
|
||||
if item is not None and item.checkState() == Qt.Checked:
|
||||
if item is not None and item.checkState() == Qt.CheckState.Checked:
|
||||
finalItems.append(item.data(self.D_HANDLE))
|
||||
|
||||
self._data["moveToTrash"] = self.trashSwitch.isChecked()
|
||||
@@ -175,7 +176,7 @@ class GuiDocMerge(QDialog):
|
||||
newItem.setIcon(itemIcon)
|
||||
newItem.setText(nwItem.itemName)
|
||||
newItem.setData(self.D_HANDLE, tHandle)
|
||||
newItem.setCheckState(Qt.Checked)
|
||||
newItem.setCheckState(Qt.CheckState.Checked)
|
||||
|
||||
self.listBox.addItem(newItem)
|
||||
|
||||
|
||||
@@ -26,8 +26,8 @@ from __future__ import annotations
|
||||
|
||||
import logging
|
||||
|
||||
from PyQt5.QtCore import pyqtSlot
|
||||
from PyQt5.QtGui import QCloseEvent
|
||||
from PyQt5.QtCore import Qt, pyqtSlot
|
||||
from PyQt5.QtWidgets import (
|
||||
QAbstractItemView, QComboBox, QDialog, QDialogButtonBox, QGridLayout,
|
||||
QLabel, QListWidget, QListWidgetItem, QVBoxLayout, QWidget
|
||||
@@ -36,15 +36,16 @@ from PyQt5.QtWidgets import (
|
||||
from novelwriter import CONFIG, SHARED
|
||||
from novelwriter.extensions.switch import NSwitch
|
||||
from novelwriter.extensions.configlayout import NColourLabel
|
||||
from novelwriter.types import QtUserRole
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class GuiDocSplit(QDialog):
|
||||
|
||||
LINE_ROLE = Qt.ItemDataRole.UserRole
|
||||
LEVEL_ROLE = Qt.ItemDataRole.UserRole + 1
|
||||
LABEL_ROLE = Qt.ItemDataRole.UserRole + 2
|
||||
LINE_ROLE = QtUserRole
|
||||
LEVEL_ROLE = QtUserRole + 1
|
||||
LABEL_ROLE = QtUserRole + 2
|
||||
|
||||
def __init__(self, parent: QWidget, sHandle: str) -> None:
|
||||
super().__init__(parent=parent)
|
||||
|
||||
@@ -40,6 +40,7 @@ from novelwriter.extensions.configlayout import NColourLabel, NFixedPage, NScrol
|
||||
from novelwriter.extensions.modified import NComboBox, NIconToolButton
|
||||
from novelwriter.extensions.pagedsidebar import NPagedSideBar
|
||||
from novelwriter.extensions.switch import NSwitch
|
||||
from novelwriter.types import QtUserRole
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -305,9 +306,9 @@ class _StatusPage(NFixedPage):
|
||||
COL_LABEL = 0
|
||||
COL_USAGE = 1
|
||||
|
||||
KEY_ROLE = Qt.ItemDataRole.UserRole
|
||||
COL_ROLE = Qt.ItemDataRole.UserRole + 1
|
||||
NUM_ROLE = Qt.ItemDataRole.UserRole + 2
|
||||
KEY_ROLE = QtUserRole
|
||||
COL_ROLE = QtUserRole + 1
|
||||
NUM_ROLE = QtUserRole + 2
|
||||
|
||||
def __init__(self, parent: QWidget, isStatus: bool) -> None:
|
||||
super().__init__(parent=parent)
|
||||
@@ -614,7 +615,7 @@ class _ReplacePage(NFixedPage):
|
||||
newItem = QTreeWidgetItem(["<%s>" % aKey, aVal])
|
||||
self.listBox.addTopLevelItem(newItem)
|
||||
|
||||
self.listBox.sortByColumn(self.COL_KEY, Qt.AscendingOrder)
|
||||
self.listBox.sortByColumn(self.COL_KEY, Qt.SortOrder.AscendingOrder)
|
||||
self.listBox.setSortingEnabled(True)
|
||||
|
||||
# List Controls
|
||||
|
||||
@@ -26,7 +26,7 @@ from __future__ import annotations
|
||||
import logging
|
||||
|
||||
from PyQt5.QtGui import QFontMetrics
|
||||
from PyQt5.QtCore import QSize, Qt, pyqtSlot
|
||||
from PyQt5.QtCore import QSize, pyqtSlot
|
||||
from PyQt5.QtWidgets import (
|
||||
QDialog, QDialogButtonBox, QFrame, QHBoxLayout, QLabel, QListWidget,
|
||||
QListWidgetItem, QVBoxLayout, QWidget
|
||||
@@ -34,7 +34,7 @@ from PyQt5.QtWidgets import (
|
||||
|
||||
from novelwriter import CONFIG
|
||||
from novelwriter.constants import trConst, nwQuotes
|
||||
from novelwriter.types import QtAlignCenter, QtAlignTop
|
||||
from novelwriter.types import QtAlignCenter, QtAlignTop, QtUserRole
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -43,7 +43,7 @@ class GuiQuoteSelect(QDialog):
|
||||
|
||||
_selected = ""
|
||||
|
||||
D_KEY = Qt.ItemDataRole.UserRole
|
||||
D_KEY = QtUserRole
|
||||
|
||||
def __init__(self, parent: QWidget, current: str = '"') -> None:
|
||||
super().__init__(parent=parent)
|
||||
|
||||
@@ -157,7 +157,7 @@ class GuiWordList(QDialog):
|
||||
self.newEntry.setText("")
|
||||
self.listBox.clearSelection()
|
||||
self._addWord(word)
|
||||
if items := self.listBox.findItems(word, Qt.MatchExactly):
|
||||
if items := self.listBox.findItems(word, Qt.MatchFlag.MatchExactly):
|
||||
self.listBox.setCurrentItem(items[0])
|
||||
self.listBox.scrollToItem(items[0], QAbstractItemView.ScrollHint.PositionAtCenter)
|
||||
return
|
||||
@@ -244,7 +244,7 @@ class GuiWordList(QDialog):
|
||||
|
||||
def _addWord(self, word: str) -> None:
|
||||
"""Add a single word to the list."""
|
||||
if word and not self.listBox.findItems(word, Qt.MatchExactly):
|
||||
if word and not self.listBox.findItems(word, Qt.MatchFlag.MatchExactly):
|
||||
self.listBox.addItem(word)
|
||||
self._changed = True
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user