This is the type of dropdown window I would like. It has columns, with different types of data in each. I tried just using tab delimiting, but it made it look sloppy. How could I get a dropdown / combobox element like this using PyQt4? (Ignore the black box, I just wanted to hide my system files).
+2
A:
By using your own custom item delegate. Probably not easy answer one would hope for, but you will have complete control :)
Chris
2010-07-06 20:07:54
I was hoping for something a little more than this... But if I don't get any other answers I'll give you the bounty...
bball
2010-07-12 22:16:08
+1
A:
I've not used PyQt, but if it's anything like PyGTK, it's possible to use something like the tree widget.
Although as an alternative, you could simply use string formatting (much better than tab delimiting):
(new style formatting)
'{0:20}{0:20}'.format('l','lines in current document')
And if you want to make sure there's enough for each of the largest you could do something like this:
leftwidth = len(max(['l', 'foo', 'longitem'], key=len))
rightwidth = len(max(['Number of lines',
'some other option',
'yet another long option'], key=len))
'{key:{L}}{desc:{R}}'.format(key='l',desc='Number of lines',
L=leftwidth, R=rightwidth)
And if you store your key/description in a dictionary it's even easier to automate the process.
Wayne Werner
2010-07-13 17:23:15