def test1(self): class FT(QToolBar): def paintEvent(self, e): pass w = QMainWindow() ftt, ftb = FT(), FT() ftt.setFixedHeight(15) ftb.setFixedHeight(15) w.addToolBar(Qt.TopToolBarArea, ftt) w.addToolBar(Qt.BottomToolBarArea, ftb) f = dropshadow.DropShadowFrame() te = QTextEdit() c = QWidget() c.setLayout(QVBoxLayout()) c.layout().setContentsMargins(20, 0, 20, 0) c.layout().addWidget(te) w.setCentralWidget(c) f.setWidget(te) f.radius = 15 f.color = QColor(Qt.blue) w.show() self.singleShot(3000, lambda: f.setColor(Qt.red)) self.singleShot(4000, lambda: f.setRadius(30)) self.singleShot(5000, lambda: f.setRadius(40)) self.app.exec_()
def test_dock_mainwinow(self): mw = QMainWindow() dock = CollapsibleDockWidget() w1 = QTextEdit() w2 = QToolButton() w2.setFixedSize(38, 200) dock.setExpandedWidget(w1) dock.setCollapsedWidget(w2) mw.addDockWidget(Qt.LeftDockWidgetArea, dock) mw.setCentralWidget(QTextEdit()) mw.show() def toogle(): dock.setExpanded(not dock.expanded()) self.singleShot(2000, toogle) toogle() self.app.exec_()
def test(self): lv = QListView() mw = QMainWindow() # Add two tool bars, the shadow should extend over them. mw.addToolBar(Qt.BottomToolBarArea, QToolBar()) mw.addToolBar(Qt.TopToolBarArea, QToolBar()) mw.setCentralWidget(lv) f = dropshadow.DropShadowFrame(color=Qt.blue, radius=20) f.setWidget(lv) self.assertIs(f.parentWidget(), mw) self.assertIs(f.widget(), lv) mw.show() self.app.processEvents() self.singleShot(3000, lambda: f.setColor(Qt.red)) self.singleShot(4000, lambda: f.setRadius(30)) self.singleShot(5000, lambda: f.setRadius(40)) self.app.exec_()