我想在代理中使用QGraphicWebView來呈現QTableView單元格,但我只是不知道如何處理paint()方法需要的QStyleOptionGraphicsItem參數。如何建立它/我應該在哪裏找回它? 我使用this code作爲參考,所以paint()方法應該是這樣的:如何使用QGraphicsWebView?
def paint(self, painter, option, index):
web = QGraphicsWebView()
web.setHtml(some_html_text)
web.page().viewportSize().setWidth(option.rect.width())
painter.save()
painter.translate(option.rect.topLeft());
painter.setClipRect(option.rect.translated(-option.rect.topLeft()))
web.paint(painter, ??????) # what here?
painter.restore()
有什麼建議?
是否有一個原因,你使用'QGraphicsWebView'而不是'QWebView'? – 2010-06-29 15:30:31
不是真的,我認爲它可能是一個更好的選擇,因爲它有一個繪製方法:P – 2010-07-01 11:08:02