コード例 #1
0
    def keyPressEvent(self, e):
        if e.key() == Qt.Key_Tab or e.key() == Qt.Key_Backtab:
            e.accept()
            ev = QKeyEvent(QEvent.KeyPress, e.key(), e.modifiers(), e.text(),
                           e.isAutoRepeat(), e.count())
            QApplication.postEvent(self.parent().parent(), ev)

            return

        QListView.keyPressEvent(self, e)
コード例 #2
0
    def initLayoutPhoto(self):
        """
        Function to create the main layout with all the widgets for show the images and labels.
        """
        global listView
        # Screen
        screen = QHBoxLayout()

        # Photo
        layoutPhotos = QVBoxLayout()
        self.viewPhoto = QGraphicsView()
        self.viewPhoto.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.viewPhoto.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        layoutPhotos.addWidget(self.viewPhoto)
        screen.addLayout(layoutPhotos, 10)

        # Tools
        tools = QVBoxLayout()
        tools.setAlignment(Qt.AlignTop)
        labelPeople = QLabel("People:\n")
        labelPeople.setFont(QFont("Times", 20, QFont.Bold))
        tools.addWidget(labelPeople)

        listView = QListView()
        listView.clicked[QModelIndex].connect(self.onClicked)
        listView.keyPressEvent = self.keyPressEvent
        tools.addWidget(listView)
        screen.addLayout(tools, 1)

        widget = QWidget()
        widget.setLayout(screen)
        return widget
コード例 #3
0
 def _listViewKeyPressEvent(self, event):
     if (event.key() == Qt.Key_Delete):
         self._btnDel_clicked()
     else:
         QListView.keyPressEvent(self.listView, event)