View Single Post
Posts: 99 | Thanked: 75 times | Joined on Nov 2009
#1
I've started writing an app to let you see live departures and arrivals of trains in the UK.

I decided to use Python and QT for this. However I've come across a problem I've not been able to solve.

Because there are a number of stations in the UK I wanted to have a the QT equivalent of the hildon PickerButton that give you a button which, when pressed, presents a list of options. You also have the ability to type into a text box to take you to the option you want.

I started searching for the QT version and came across this post:
http://qt.nokia.com/doc/qt-maemo-4.6...kselector.html

So I tried to implement this in python. The first problem I came across was that PyQT didn't seem to support the QtMaemo5 module so I switched to pyside.

This ran fine up until I clicked the button and then the app seg faults.

The code I'm using to try and create this is:

Code:
        model = QtGui.QStandardItemModel(0,1);

        for i in range(1, 5):
            item = QtGui.QStandardItem(QtCore.QString("Station "+str(i)))
            item.setTextAlignment(QtCore.Qt.AlignCenter)
            item.setEditable(0)
            model.appendRow(item)

        stationsFrom = QtMaemo5.QMaemo5ValueButton("Departing From:")
        stationsFrom.setValueLayout(QtMaemo5.QMaemo5ValueButton.ValueBesideText)

        selectorFrom = QtMaemo5.QMaemo5ListPickSelector()
        selectorFrom.setModel(model)
        stationsFrom.setPickSelector(selectorFrom)
If I comment out the "setPickSelector" call the button doesn't do anything when clicked but at least it doesn't crash. This makes me think it has to be something to do with QMaemo5ListPickSelector.

A google for QMaemo5ListPickSelector and pyside brings up only a git commit log.

Is there a chance this just doesn't work yet or am I doing something stupid? This is my first python project in about 4 years and my first time using QT so perhaps it's pebkac.

Any help would be greatly appreciated.