Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

对话框偶尔报错 QPainter::begin #867

Open
zhiyiYo opened this issue May 6, 2024 · 2 comments
Open

对话框偶尔报错 QPainter::begin #867

zhiyiYo opened this issue May 6, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@zhiyiYo
Copy link
Owner

zhiyiYo commented May 6, 2024

No description provided.

@zhiyiYo zhiyiYo added the bug Something isn't working label May 6, 2024
@Zzaphkiel
Copy link

Zzaphkiel commented May 29, 2024

同样遇到问题,测试发现如果对话框中包含有滚动条的组件(包括 ScrollArea,或有较长文本的 TextEdit)就会报错。

最小复现代码

class CustomMessageBox(MessageBoxBase):
    def __init__(self, parent=None):
        super().__init__(parent=parent)

        self.scrollArea = ScrollArea()
        self.scrollWidget = QWidget()

        # 让 widget 比 scrollArea 更高,以显示纵向滚动条
        self.scrollWidget.setFixedHeight(300)
        self.scrollArea.setFixedHeight(200)

        # 如果没有滚动条显示就不会报错:
        # self.scrollWidget.setFixedHeight(150)
        # self.scrollArea.setFixedHeight(200)

        self.scrollArea.setWidget(self.scrollWidget)
        self.viewLayout.addWidget(self.scrollArea)

报错信息

在关闭对话框后,控制台输出报错信息:

QPainter::begin: A paint device can only be painted by one painter at a time.
QPainter::translate: Painter not active

环境信息

  • OS: Windows 11 23H2
  • Python: 3.8.19 64-bit
  • PyQt: 5.15.9
  • PyQt-Fluent-Widgets: 1.5.6

@zhiyiYo
Copy link
Owner Author

zhiyiYo commented May 29, 2024

可能得取消滚动条的透明特效

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants