Ejemplo n.º 1
0
    def create_widget(self, parent):
        """ Create the QListView widget.

        """
        # Create the list model and accompanying controls:
        widget = QListWidget(parent)
        self.selected_index = -1
        self.selected_indexes = [-1]
        self.selected_item = ''
        self.selected_items = ['']
        for item in self.items:
            widget.addItem(item)
        if self.multiselect:
            mode = QAbstractItemView.ExtendedSelection
        else:
            mode = QAbstractItemView.SingleSelection
        widget.setSelectionMode(mode)
        widget.itemSelectionChanged.connect(self.on_selection)
        return widget
    def create_widget(self, parent):
        """ Create the QListWidget widget.

        """
        # Create the list model and accompanying controls:
        widget = QListWidget(parent)
        for item, checked in zip(self.items, self.checked_states):
            self.add_item(widget, item, checked)

        # set selected_item here so that first change fires an 'update' rather than 'create' event
        self.selected_item = ''
        if self.items:
            self.selected_index = 0
            self.selected_item = self.items[0]
            widget.setCurrentRow(0)

        widget.itemSelectionChanged.connect(self.on_selection)
        widget.itemChanged.connect(self.on_edit)

        return widget
Ejemplo n.º 3
0
    def create_widget(self, parent):
        """ Create the QListWidget widget.

        """
        # Create the list model and accompanying controls:
        widget = QListWidget(parent)
        for item, checked in zip(self.items, self.checked_states):
            self.add_item(widget, item, checked)


        # set selected_item here so that first change fires an 'update' rather than 'create' event
        self.selected_item = ''
        if self.items:
            self.selected_index = 0
            self.selected_item = self.items[0]
            widget.setCurrentRow(0) 

        widget.itemSelectionChanged.connect(self.on_selection)
        widget.itemChanged.connect(self.on_edit)

        return widget
Ejemplo n.º 4
0
    def create_widget(self, parent):
        """ Create the QListView widget.

        """
        # Create the list model and accompanying controls:
        widget = QListWidget(parent)
        for item in self.items:
            self.add_item(widget, item)

        widget.itemSelectionChanged.connect(self.on_selection)

        # set selected_item here so that first change fires an 'update' rather than 'create' event
        self.selected_item = None

        return widget
Ejemplo n.º 5
0
    def create_widget(self, parent):
        """ Create the QListView widget.

        """
        # Create the list model and accompanying controls:
        widget = QListWidget(parent)
        self.selected_index = -1
        self.selected_indexes = [-1]
        self.selected_item = ''
        self.selected_items = ['']
        for item in self.items:
            widget.addItem(item)
        if self.multiselect:
            mode = QAbstractItemView.ExtendedSelection
        else:
            mode = QAbstractItemView.SingleSelection
        widget.setSelectionMode(mode)
        widget.itemSelectionChanged.connect(self.on_selection)
        return widget