still don't have a title

Porting rng to QT4

Today I was busy porting reportbug-ng to QT4. One really cool thing I noticed is the new QWebView widget, which is the main widget of the QWebKit module. It works surprisingly easy compared to the good old QTextBrowser of QT3 – now you can just throw an URL at it and it will render the page nicely complete with CSS, images, etc.

Here’s the obligatory screenshot:

reportbug-ng qt4

as you can see, the bugreport looks much better than in the old version of rng. WebKit does a really good job rendering the HTML, I think the fonts look even smoother than under firefox.

To ease the transition to from QT3 to QT4 I’ve extracted all the Debian BTS specific stuff to python-debianbts and uploaded it to unstable. Rng uses it to query our Bug Tracking System via it’s SOAP interface and get the data in Python’s native data types.

There is still the problem with rng (QT3) crashing when showing bugreports. I’ve investigated the problem a bit and found out that it is not rng’s fault but probably a problem with python-qt3 or one of it’s underlying libs. QTextBrowser causes segfaults in nearly 50% of the cases where you try to render html from a different thread: here’s an easy way to reproduce:

# Usage: python "some text"
#        python "some evil html"

from qt import *
import sys
import threading

class Form(QMainWindow):
    def __init__(self,parent = None,name = None,fl = 0):
        self.browser = QTextBrowser(self, "browser")

if __name__ == '__main__':
    if len(sys.argv) < 2:
        print 'Usage: %s "some text"' % sys.argv[0]
    s = str(sys.argv[1])

    # setup qt stuff with a browser
    app = QApplication(sys.argv)
    app.connect(app, SIGNAL("lastWindowClosed()"), app, SLOT("quit()"))
    form = Form()

    # start a different thread and try to set the text in the browser
    # we wait 1.0 second -- just to make sure the change happens after the
    # start of app.exec_loop() below
    t = threading.Timer(1.0, form.browser.setText, (s, ))


QWebView doesn’t seem to have this problem, the QT4 version of rng didn’t crash a single time.

I’m not quite ready with the porting to QT4, and since I’ll be quite busy during the next weeks I suppose it will take a few weeks until the new version will be updated to unstable.