mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
pyqt6: Use QStylePainter for separators
In pyqt6 QApplication::style() returns QCommonStyle instead of the proxy calibre style I install using C++. QStylePainter gets around that.
This commit is contained in:
parent
56dd01a591
commit
cb07ca7b70
@ -4,8 +4,8 @@
|
|||||||
|
|
||||||
|
|
||||||
from qt.core import (
|
from qt.core import (
|
||||||
QPainter, QPoint, QRect, QSize, QSizePolicy, QStyle, QStyleOption, Qt, QToolBar,
|
QPoint, QRect, QSize, QSizePolicy, QStyle, QStyleOption, QStylePainter, Qt,
|
||||||
QToolButton, QWidget, pyqtSignal
|
QToolBar, QToolButton, QWidget, pyqtSignal
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -26,8 +26,8 @@ class Separator(QWidget):
|
|||||||
return QSize(width, int(self.devicePixelRatioF() * self.desired_height))
|
return QSize(width, int(self.devicePixelRatioF() * self.desired_height))
|
||||||
|
|
||||||
def paintEvent(self, ev):
|
def paintEvent(self, ev):
|
||||||
p = QPainter(self)
|
p = QStylePainter(self)
|
||||||
self.style().drawPrimitive(QStyle.PrimitiveElement.PE_IndicatorToolBarSeparator, self.style_option(), p, self)
|
p.drawPrimitive(QStyle.PrimitiveElement.PE_IndicatorToolBarSeparator, self.style_option())
|
||||||
|
|
||||||
|
|
||||||
class Button(QToolButton):
|
class Button(QToolButton):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user