Closed DrinkSth closed 5 months ago
Describe the bug 继承FramelessWindow 主窗口加载显示pyvistqt的plotter, 设置背景色为其他颜色,结果仍为白色; 将主窗口继承QMainWindow, 设置plotter的背景色,生效。
Environment 环境信息
Code 最小复现代码
import mne import numpy as np from mne.viz.backends import renderer from PyQt5.QtCore import Qt from PyQt5.QtWidgets import ( QWidget, QVBoxLayout, ) from qframelesswindow import FramelessWindow class SegHeadWidget(QWidget): def __init__(self, renderer, parent=None): super().__init__() layout = QVBoxLayout() layout.addWidget(renderer) self.setLayout(layout) class MainWindow(FramelessWindow): def __init__(self): super().__init__() self.widget = QWidget(self) self.seg_widget = self.load_seghead_image() layout = QVBoxLayout() layout.addWidget(self.seg_widget) self.widget.setLayout(layout) def load_seghead_image(self, data_man=None): coords = np.random.rand(100, 3) faces = np.random.randint(0, 100, (300, 3)) self.renderer = renderer.create_3d_figure(size=(600, 600), bgcolor=(199, 19, 199), scene=False) gray = (0.3, 0.3, 0.3) self.renderer.mesh(*coords.T, triangles=faces, color=gray) view_kwargs = dict(elevation=90, azimuth=90) mne.viz.set_3d_view(figure=self.renderer.figure, distance=650, focalpoint=(0.0, 0.0, 40.0), **view_kwargs) self.plotter = self.renderer.plotter # self.plotter.set_background("red") self.plotter.interactor.set_background("green") self.plotter.update() self.plotter.updateGeometry() self.plotter._render() self.renderer_widget = SegHeadWidget(self.plotter) return self.renderer_widget if __name__ == "__main__": import sys from qtpy.QtWidgets import QApplication app = QApplication(sys.argv) window = MainWindow() window.show() sys.exit(app.exec_())
左侧是继承QMainWindow, 右侧是继承FramelessWindow
add self.plotter.setBackgroundRole(1)
Describe the bug 继承FramelessWindow 主窗口加载显示pyvistqt的plotter, 设置背景色为其他颜色,结果仍为白色; 将主窗口继承QMainWindow, 设置plotter的背景色,生效。
Environment 环境信息
Code 最小复现代码
左侧是继承QMainWindow, 右侧是继承FramelessWindow