Anti-Aliasing doesn't work with QWebFrame.render()

  • I use QWebPage (without QWebView) as a delegate for QListView. Here is the simple code. It is works, but it doesn't support Anti-Aliasing, the fonts look ugly. Everything works, but without Anti-Aliasing... That's driving me crazy!

    I tried to use painter.setRenderHint(QtGui.Painter.Antialiasing, True) to enable Anti-Aliasing, but it doesn't work. I also read the C++ source code of QWebPage and QWebView, but I didn't found any useful information.

    @class HTMLDelegate(QtGui.QStyledItemDelegate):
    def paint(self, painter, option, index):
    options = QtGui.QStyleOptionViewItemV4(option)
    self.initStyleOption(options, index)

        style = if options.widget is None else
        webPage = QtWebKit.QWebPage(self)
        webFrame = webPage.mainFrame()
        options.text = ""
        style.drawControl(QtGui.QStyle.CE_ItemViewItem, options, painter)
        textRect = style.subElementRect(QtGui.QStyle.SE_ItemViewItemText, options)
        # not works
        #painter.setRenderHint(QtGui.Painter.Antialiasing, True)

  • Maybe resolved. Maybe it is a Qt bug, I relogin and the problem went away :) Will remove it.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.