Python PySide.QtGui 模块,QListView() 实例源码

我们从Python开源项目中,提取了以下3个代码示例,用于说明如何使用PySide.QtGui.QListView()

项目:pcbre    作者:pcbre    | 项目源码 | 文件源码
def __init__(self, project, viewState):
        super(LayerListWidget, self).__init__("Layer List")
        self.setAllowedAreas(QtCore.Qt.LeftDockWidgetArea | QtCore.Qt.RightDockWidgetArea)

        model = LayerListModel(project)
        customerList = QtGui.QListView(self)
        customerList.setModel(model)
        selm = customerList.selectionModel()
        self.p = project

        def layerSelectionChanged(index, b):
            viewState.current_layer = self.p.stackup.layers[index.indexes()[0].row()]

        selm.selectionChanged.connect(layerSelectionChanged)

        self.setWidget(customerList)
项目:zeex    作者:zbarge    | 项目源码 | 文件源码
def setupUi(self, PushGridWidget):
        PushGridWidget.setObjectName("PushGridWidget")
        PushGridWidget.resize(302, 203)
        self.gridLayoutWidget_2 = QtGui.QWidget(PushGridWidget)
        self.gridLayoutWidget_2.setGeometry(QtCore.QRect(0, 0, 301, 201))
        self.gridLayoutWidget_2.setObjectName("gridLayoutWidget_2")
        self.pushGrid = QtGui.QGridLayout(self.gridLayoutWidget_2)
        self.pushGrid.setContentsMargins(0, 0, 0, 0)
        self.pushGrid.setObjectName("pushGrid")
        self.listViewLeft = QtGui.QListView(self.gridLayoutWidget_2)
        self.listViewLeft.setObjectName("listViewLeft")
        self.pushGrid.addWidget(self.listViewLeft, 0, 0, 1, 1)
        self.listViewRight = QtGui.QListView(self.gridLayoutWidget_2)
        self.listViewRight.setObjectName("listViewRight")
        self.pushGrid.addWidget(self.listViewRight, 0, 2, 1, 1)
        self.btnGrid = QtGui.QGridLayout()
        self.btnGrid.setObjectName("btnGrid")
        self.btnPushRight = QtGui.QPushButton(self.gridLayoutWidget_2)
        self.btnPushRight.setObjectName("btnPushRight")
        self.btnGrid.addWidget(self.btnPushRight, 0, 0, 1, 1)
        self.btnPushLeft = QtGui.QPushButton(self.gridLayoutWidget_2)
        self.btnPushLeft.setObjectName("btnPushLeft")
        self.btnGrid.addWidget(self.btnPushLeft, 1, 0, 1, 1)
        self.pushGrid.addLayout(self.btnGrid, 0, 1, 1, 1)

        self.retranslateUi(PushGridWidget)
        QtCore.QMetaObject.connectSlotsByName(PushGridWidget)
项目:kite    作者:pyrocko    | 项目源码 | 文件源码
def __init__(self, sandbox, *args, **kwargs):
        QtGui.QListView.__init__(self, *args, **kwargs)
        self.sandbox = sandbox
        self.setModel(sandbox.sources)
        self.setItemDelegate(self.SourceItemDelegate())
        self.setAlternatingRowColors(True)
        sandbox.sources.setSelectionModel(self.selectionModel())