代码之家  ›  专栏  ›  技术社区  ›  backus sompnd

我怎么能用Qt得到这种下拉列表呢?(特别是PyQt4)

  •  1
  • backus sompnd  · 技术社区  · 16 年前

    Columned Dropdown

    3 回复  |  直到 16 年前
        1
  •  2
  •   Chris    16 年前

    使用您自己的自定义项委托。可能不容易回答,但你可以完全控制:)

    http://doc.trolltech.com/4.6/model-view-delegate.html

        2
  •  1
  •   Community Mohan Dere    9 年前

    我没有用过PyQt,但是如果它和PyGTK一样,可以用 the tree widget.

    尽管作为替代方案,您可以简单地使用字符串格式(比制表符分隔要好得多):

    (新样式格式)

    '{0:20}{0:20}'.format('l','lines in current document')
    

    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)
    

    如果您将密钥/描述存储在字典中,则更容易实现过程的自动化。

        3
  •  0
  •   cengizkrbck    13 年前

    当然,你必须使用QColumnView,它是Listview的扩展版本,或者只是多个Listview。如您所知,listview是Combobox的打开版本。