Update Qt namespace flags
This commit is contained in:
@@ -25,11 +25,11 @@ from __future__ import annotations
|
||||
|
||||
from math import ceil
|
||||
|
||||
from PyQt5.QtCore import QRect
|
||||
from PyQt5.QtGui import QBrush, QColor, QPaintEvent, QPainter, QPen
|
||||
from PyQt5.QtCore import QRect, Qt
|
||||
from PyQt5.QtWidgets import QProgressBar, QSizePolicy, QWidget
|
||||
|
||||
from novelwriter.types import QtAlignCenter
|
||||
from novelwriter.types import QtAlignCenter, QtRoundCap, QtSolidLine, QtTransparent
|
||||
|
||||
|
||||
class NProgressCircle(QProgressBar):
|
||||
@@ -50,8 +50,8 @@ class NProgressCircle(QProgressBar):
|
||||
self._point = point
|
||||
self._dRect = QRect(0, 0, size, size)
|
||||
self._cRect = QRect(point, point, size - 2*point, size - 2*point)
|
||||
self._dPen = QPen(Qt.transparent)
|
||||
self._dBrush = QBrush(Qt.transparent)
|
||||
self._dPen = QPen(QtTransparent)
|
||||
self._dBrush = QBrush(QtTransparent)
|
||||
self.setColours(
|
||||
track=self.palette().alternateBase().color(),
|
||||
bar=self.palette().highlight().color(),
|
||||
@@ -69,9 +69,9 @@ class NProgressCircle(QProgressBar):
|
||||
self._dPen = QPen(back)
|
||||
self._dBrush = QBrush(back)
|
||||
if isinstance(bar, QColor):
|
||||
self._cPen = QPen(QBrush(bar), self._point, Qt.SolidLine, Qt.RoundCap)
|
||||
self._cPen = QPen(QBrush(bar), self._point, QtSolidLine, QtRoundCap)
|
||||
if isinstance(track, QColor):
|
||||
self._bPen = QPen(QBrush(track), self._point, Qt.SolidLine, Qt.RoundCap)
|
||||
self._bPen = QPen(QBrush(track), self._point, QtSolidLine, QtRoundCap)
|
||||
if isinstance(text, QColor):
|
||||
self._tColor = text
|
||||
return
|
||||
|
||||
@@ -32,7 +32,7 @@ from PyQt5.QtWidgets import (
|
||||
QStyleOptionToolButton, QToolBar, QToolButton, QWidget
|
||||
)
|
||||
|
||||
from novelwriter.types import QtAlignLeft
|
||||
from novelwriter.types import QtAlignLeft, QtNoBrush, QtNoPen
|
||||
|
||||
|
||||
class NPagedSideBar(QToolBar):
|
||||
@@ -56,7 +56,7 @@ class NPagedSideBar(QToolBar):
|
||||
self._group.buttonClicked.connect(self._buttonClicked)
|
||||
|
||||
self.setMovable(False)
|
||||
self.setOrientation(Qt.Vertical)
|
||||
self.setOrientation(Qt.Orientation.Vertical)
|
||||
|
||||
stretch = QWidget(self)
|
||||
stretch.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
|
||||
@@ -146,8 +146,8 @@ class _NPagedToolButton(QToolButton):
|
||||
|
||||
paint = QPainter(self)
|
||||
paint.setRenderHint(QPainter.Antialiasing, True)
|
||||
paint.setPen(Qt.NoPen)
|
||||
paint.setBrush(Qt.NoBrush)
|
||||
paint.setPen(QtNoPen)
|
||||
paint.setBrush(QtNoBrush)
|
||||
|
||||
width = self.width()
|
||||
height = self.height()
|
||||
@@ -215,7 +215,7 @@ class _NPagedToolLabel(QLabel):
|
||||
"""
|
||||
paint = QPainter(self)
|
||||
paint.setRenderHint(QPainter.Antialiasing, True)
|
||||
paint.setPen(Qt.NoPen)
|
||||
paint.setPen(QtNoPen)
|
||||
|
||||
width = self.width()
|
||||
height = self.height()
|
||||
|
||||
@@ -28,6 +28,7 @@ from PyQt5.QtCore import QEvent, QPropertyAnimation, Qt, pyqtProperty
|
||||
from PyQt5.QtWidgets import QAbstractButton, QSizePolicy, QWidget
|
||||
|
||||
from novelwriter import CONFIG, SHARED
|
||||
from novelwriter.types import QtMouseLeft, QtNoPen
|
||||
|
||||
|
||||
class NSwitch(QAbstractButton):
|
||||
@@ -90,7 +91,7 @@ class NSwitch(QAbstractButton):
|
||||
"""Drawing the switch itself."""
|
||||
painter = QPainter(self)
|
||||
painter.setRenderHint(QPainter.Antialiasing, True)
|
||||
painter.setPen(Qt.NoPen)
|
||||
painter.setPen(QtNoPen)
|
||||
|
||||
palette = self.palette()
|
||||
if self.isChecked():
|
||||
@@ -119,7 +120,7 @@ class NSwitch(QAbstractButton):
|
||||
def mouseReleaseEvent(self, event: QMouseEvent) -> None:
|
||||
"""Animate the switch on mouse release."""
|
||||
super().mouseReleaseEvent(event)
|
||||
if event.button() == Qt.LeftButton:
|
||||
if event.button() == QtMouseLeft:
|
||||
anim = QPropertyAnimation(self, b"offset", self)
|
||||
anim.setDuration(120)
|
||||
anim.setStartValue(self._offset)
|
||||
@@ -129,7 +130,7 @@ class NSwitch(QAbstractButton):
|
||||
|
||||
def enterEvent(self, event: QEvent) -> None:
|
||||
"""Change the cursor when hovering the button."""
|
||||
self.setCursor(Qt.PointingHandCursor)
|
||||
self.setCursor(Qt.CursorShape.PointingHandCursor)
|
||||
super().enterEvent(event)
|
||||
return
|
||||
|
||||
|
||||
Reference in New Issue
Block a user