#-*-Coding: cp936 -*-
From pyqt4.qtcore import *
From pyqt4.qtgui import *
Class inlineeditor (qwidget ):
_ Mute = 'mute'
Def _ init _ (self, parent ):
Qwidget. _ init _ (self, parent)
Self. setautofillbackground (true)
Lo = qhboxlayout ()
Lo. setmargin (0)
Lo. setspacing (4)
Self. _ cbfoo = qcombobox ()
For X in ["ABC", "def", "Ghi", "jkl"]:
Self. _ cbfoo. additem (X)
Self. _ lebar = qlineedit ('', self)
Self. _ lebar. setvalidator (qintvalidator (0, 999999, self ))
Lo. addwidget (self. _ cbfoo, 3)
Lo. addspacing (5)
Lo. addwidget (qlabel ('bar :'))
Lo. addwidget (self. _ lebar, 3)
Lo. addstretch (5)
Self. setlayout (LO)
Class form (qdialog ):
Def _ init _ (self, parent = none ):
Qdialog. _ init _ (self, parent)
Grid = qgridlayout ()
Tree = qtreewidget ()
Tree. setcolumncount (2)
For N in range (3 ):
I = qtreewidgetitem (tree) # create a subproject of qtreewidget I
I. settext (0, "first" + STR (N) # SET THE TEXT OF THE 0th Column
I. settext (1, "second ")
For m in range (3 ):
J = qtreewidgetitem (I) # create a subproject for qtreewidget subproject I
J. settext (0, "Child First" + STR (m ))
B1 = qcheckbox ("Push me 0", tree) # note the second parameter here. If this parameter is not created successfully
Tree. setitemwidget (tree. toplevelitem (0). Child (1), 1, B1) # Place the control in Column 2nd of the first sub-project of the first project.
Item = inlineeditor (tree) # process the combination of multiple controls
Tree. setitemwidget (tree. toplevelitem (0). Child (1), 1, item)
Grid. addwidget (tree)
Self. setlayout (GRID)
APP = qapplication ([])
Form = form ()
Form. Show ()
App.exe C _()
:
Pyqt display drop-down content