Python PyQt5.QtCore.Qt 模块,NoFocus() 实例源码

我们从Python开源项目中,提取了以下14个代码示例,用于说明如何使用PyQt5.QtCore.Qt.NoFocus()

项目:uitester    作者:IfengAutomation    | 项目源码 | 文件源码
def __init__(self, parent=None):
        super(CompleterWidget, self).__init__(parent)

        ui_dir_path = os.path.dirname(__file__)
        ui_file_path = os.path.join(ui_dir_path, 'completer_widget.ui')
        uic.loadUi(ui_file_path, self)

        self.setWindowFlags(Qt.FramelessWindowHint | Qt.Tool)

        self.func_list_widget = QListWidget()
        self.func_list_widget.setFixedWidth(200)
        self.func_list_widget.setSizeAdjustPolicy(QListWidget.AdjustToContents)
        self.func_list_layout.insertWidget(0, self.func_list_widget)
        self.desc_text_browser.setSizeAdjustPolicy(QTextBrowser.AdjustToContents)

        self.func_list_widget.setFocusPolicy(Qt.NoFocus)
项目:headcache    作者:s9w    | 项目源码 | 文件源码
def __init__(self, parent=None):
        QWidget.__init__(self, parent)
        allLayout = QVBoxLayout()

        self.l1 = QListWidget(self)
        self.l1.setObjectName("search_result_list")
        self.l1.setViewMode(QListView.ListMode)
        # self.l1.currentItemChanged.connect(self.f1click)
        self.l1.itemDoubleClicked.connect(self.item_dclick)
        allLayout.addWidget(self.l1)
        self.setLayout(allLayout)

        # self.setWindowFlags(Qt.FramelessWindowHint | Qt.Popup)
        # self.setFocusPolicy(Qt.ClickFocus)

        # self.setAttribute(Qt.WA_ShowWithoutActivating)
        # self.l1.setAttribute(Qt.WA_ShowWithoutActivating)
        self.setFocusPolicy(Qt.StrongFocus)
        # self.l1.setFocusPolicy(Qt.NoFocus)
        # print(parent.finder)
        # self.setFocusProxy(parent.finder)
项目:gui_tool    作者:UAVCAN    | 项目源码 | 文件源码
def make_icon_button(icon_name, tool_tip, parent, checkable=False, checked=False, on_clicked=None, text=''):
    b = QPushButton(text, parent)
    b.setFocusPolicy(Qt.NoFocus)
    if icon_name:
        b.setIcon(get_icon(icon_name))
    b.setToolTip(tool_tip)
    if checkable:
        b.setCheckable(True)
        b.setChecked(checked)
    if on_clicked:
        b.clicked.connect(on_clicked)
    return b
项目:uitester    作者:IfengAutomation    | 项目源码 | 文件源码
def init_completer_widget(self):
        """
        init the completer widget's data
        :return:
        """
        self.popup_widget.show()
        self.popup_widget.setFocusPolicy(Qt.NoFocus)
        # set the current item
        self.popup_widget.func_list_widget.setCurrentRow(0)
        item_text = self.popup_widget.func_list_widget.currentItem().text()
        item_desc = ""
        if item_text in self.func_name_list:
            if self.func_dict[item_text].__doc__:
                item_desc = self.func_dict[item_text].__doc__
        self.popup_widget.selected_func_name_signal.emit(item_text, item_desc)
项目:ultimate-tic-tac-toe    作者:stoimenoff    | 项目源码 | 文件源码
def __init__(self, id, text='&', parent=None):
        super(Square, self).__init__(text, parent)
        self.id = id
        self.setStyleSheet(SHEET)
        self.setFocusPolicy(Qt.NoFocus)
        # self.setFixedSize(50, 50)
项目:repo-checker    作者:1dot75cm    | 项目源码 | 文件源码
def delRowSlot(self):
        """???"""
        # ????????????setFocusPolicy(Qt.NoFocus)
        rowIndex = self.tableWidget.currentRow()
        if rowIndex != -1:
            self.tableWidget.removeRow(rowIndex)
            self.tableContents.remove(self.tableContents[rowIndex])
            log.debug(self.tableContents)
        else:
            QMessageBox.warning(self, self.tr("Warning"), self.tr("Please select a row."))
项目:repo-checker    作者:1dot75cm    | 项目源码 | 文件源码
def setupTable(self):
        """?????"""
        self.tableWidget.setFocusPolicy(Qt.NoFocus)  # ???
        self.tableWidget.setGridStyle(Qt.DashDotLine)  # ???
        self.tableWidget.setWordWrap(True)
        self.tableWidget.setCornerButtonEnabled(True)
        self.tableWidget.horizontalHeader().setVisible(True)  # ????
        #self.tableWidget.horizontalHeader().setSortIndicatorShown(True)  # ?????
        self.tableWidget.horizontalHeader().setStretchLastSection(True)  # ??????

        self.tableWidget.setColumnCount(self.tableColumnCount)  # ??
        self.tableWidget.setRowCount(self.tableRowCount)  # ??

        # ??
        for i in range(self.tableRowCount):
            item = QTableWidgetItem("%s" % (i+1))
            self.tableWidget.setVerticalHeaderItem(i, item)  # ??

        # ??
        for i in range(self.tableColumnCount):
            item = QTableWidgetItem(self.tableHeaders[i])  # QIcon, str
            self.tableWidget.setHorizontalHeaderItem(i, item)  # ?????

        for i in [3, 4, 5]:
            self.tableWidget.resizeColumnToContents(i)  # ????????

        # ?????
        for i in range(self.tableRowCount):
            self.tableContents.append(Checker())
            for j in range(self.tableColumnCount):
                item = QTableWidgetItem()
                self.tableWidget.setItem(i, j, item)

        self.setBackgroundColor(self.bgColor)
项目:kaptan    作者:KaOSx    | 项目源码 | 文件源码
def __init__(self, parent=None):
        super().__init__(parent)
        self.setTitle(self.tr("Preview"))
        self.setMaximumHeight(120)
        self.parent = parent

        vboxLayout = QVBoxLayout(self)
        self.previewGroupBox = QGroupBox(self)
        self.previewGroupBox.setObjectName("previewGroupBox")
        vboxLayout.addWidget(self.previewGroupBox)

        self.horizontalLayout = QHBoxLayout(self.previewGroupBox)
        self.verticalLayout = QVBoxLayout()
        self.horizontalLayout.addLayout(self.verticalLayout)

        self.previewLabel = QLabel(self.previewGroupBox)
        self.previewLabel.setText(self.tr("Window Text"))
        self.previewLabel.setObjectName("previewLabel")
        self.verticalLayout.addWidget(self.previewLabel)

        self.previewPushButton = QPushButton(self.previewGroupBox)
        self.previewPushButton.setText(self.tr("Button"))
        self.previewPushButton.setObjectName("previewPushButton")
        self.verticalLayout.addWidget(self.previewPushButton)

        self.previewTextBrowser = QTextBrowser(self.previewGroupBox)
        self.previewTextBrowser.setObjectName("previewTextBrowser")

        css = iniToCss(os.path.join("/usr/share/color-schemes", self.parent.children()[1].currentItem().colorSchemeName))

        self.previewTextBrowser.setHtml("""<style>#unclicked {color : rgb(%s);}
        #clicked {color : rgb(%s);}</style>"""%(css[1][0],css[1][1]) +
        self.tr("""<p>Normal text <a id='unclicked' href='#'>link</a> <a id='clicked' href='#'>visited</a></p>"""))


        self.horizontalLayout.addWidget(self.previewTextBrowser)


        self.previewPushButton.installEventFilter(self.previewGroupBox)
        self.previewPushButton.setFocusPolicy(Qt.NoFocus)

        self.previewTextBrowser.installEventFilter(self.previewGroupBox)
        self.previewTextBrowser.setFocusPolicy(Qt.NoFocus)
        self.previewTextBrowser.setTextInteractionFlags(Qt.NoTextInteraction)
项目:tahoe-gui    作者:LeastAuthority    | 项目源码 | 文件源码
def __init__(self):  # pylint: disable=too-many-statements
        super(self.__class__, self).__init__()
        self.step = 0
        self.resize(500, 333)
        layout = QVBoxLayout(self)

        layout_1 = QHBoxLayout()
        self.icon = QLabel()
        pixmap = QPixmap(resource('mail-envelope-open.png')).scaled(128, 128)
        self.icon.setPixmap(pixmap)
        layout_1.addItem(QSpacerItem(0, 0, QSizePolicy.Expanding, 0))
        layout_1.addWidget(self.icon)
        layout_1.addItem(QSpacerItem(0, 0, QSizePolicy.Expanding, 0))

        layout_2 = QHBoxLayout()
        self.label = QLabel("Enter invite code:")
        font = QFont()
        font.setPointSize(14)
        self.label.setFont(font)
        self.label.setStyleSheet("color: grey")
        layout_2.addItem(QSpacerItem(0, 0, QSizePolicy.Expanding, 0))
        layout_2.addWidget(self.label)
        layout_2.addItem(QSpacerItem(0, 0, QSizePolicy.Expanding, 0))

        layout_3 = QHBoxLayout()
        self.lineedit = LineEdit(self)
        self.lineedit.returnPressed.connect(self.return_pressed)
        self.progressbar = QProgressBar()
        self.progressbar.setMaximum(8)
        self.progressbar.setTextVisible(False)
        self.progressbar.hide()
        layout_3.addItem(QSpacerItem(85, 0, QSizePolicy.Preferred, 0))
        layout_3.addWidget(self.lineedit)
        layout_3.addWidget(self.progressbar)
        layout_3.addItem(QSpacerItem(85, 0, QSizePolicy.Preferred, 0))

        layout_4 = QHBoxLayout()
        self.checkbox = QCheckBox(self)
        self.checkbox.setText("Always connect using Tor")
        self.checkbox.setEnabled(True)
        self.checkbox.setCheckable(False)
        self.checkbox.setStyleSheet("color: grey")
        self.checkbox.setFocusPolicy(Qt.NoFocus)
        self.message = QLabel()
        self.message.hide()
        layout_4.addItem(QSpacerItem(0, 0, QSizePolicy.Expanding, 0))
        layout_4.addWidget(self.checkbox)
        layout_4.addWidget(self.message)
        layout_4.addItem(QSpacerItem(0, 0, QSizePolicy.Expanding, 0))

        layout.addItem(QSpacerItem(0, 0, 0, QSizePolicy.Expanding))
        layout.addLayout(layout_1)
        layout.addLayout(layout_2)
        layout.addLayout(layout_3)
        layout.addLayout(layout_4)
        layout.addItem(QSpacerItem(0, 0, 0, QSizePolicy.Expanding))
项目:Mac-Python-3.X    作者:L1nwatch    | 项目源码 | 文件源码
def __init__(self):
        super(TetrixWindow, self).__init__()

        self.board = TetrixBoard()

        nextPieceLabel = QLabel()
        nextPieceLabel.setFrameStyle(QFrame.Box | QFrame.Raised)
        nextPieceLabel.setAlignment(Qt.AlignCenter)
        self.board.setNextPieceLabel(nextPieceLabel)

        scoreLcd = QLCDNumber(5)
        scoreLcd.setSegmentStyle(QLCDNumber.Filled)
        levelLcd = QLCDNumber(2)
        levelLcd.setSegmentStyle(QLCDNumber.Filled)
        linesLcd = QLCDNumber(5)
        linesLcd.setSegmentStyle(QLCDNumber.Filled)

        startButton = QPushButton("&Start")
        startButton.setFocusPolicy(Qt.NoFocus)
        quitButton = QPushButton("&Quit")
        quitButton.setFocusPolicy(Qt.NoFocus)
        pauseButton = QPushButton("&Pause")
        pauseButton.setFocusPolicy(Qt.NoFocus)

        startButton.clicked.connect(self.board.start)
        pauseButton.clicked.connect(self.board.pause)
        quitButton.clicked.connect(QApplication.instance().quit)
        self.board.scoreChanged.connect(scoreLcd.display)
        self.board.levelChanged.connect(levelLcd.display)
        self.board.linesRemovedChanged.connect(linesLcd.display)

        layout = QGridLayout()
        layout.addWidget(self.createLabel("NEXT"), 0, 0)
        layout.addWidget(nextPieceLabel, 1, 0)
        layout.addWidget(self.createLabel("LEVEL"), 2, 0)
        layout.addWidget(levelLcd, 3, 0)
        layout.addWidget(startButton, 4, 0)
        layout.addWidget(self.board, 0, 1, 6, 1)
        layout.addWidget(self.createLabel("SCORE"), 0, 2)
        layout.addWidget(scoreLcd, 1, 2)
        layout.addWidget(self.createLabel("LINES REMOVED"), 2, 2)
        layout.addWidget(linesLcd, 3, 2)
        layout.addWidget(quitButton, 4, 2)
        layout.addWidget(pauseButton, 5, 2)
        self.setLayout(layout)

        self.setWindowTitle("Tetrix")
        self.resize(550, 370)
项目:examples    作者:pyqt    | 项目源码 | 文件源码
def __init__(self):
        super(TetrixWindow, self).__init__()

        self.board = TetrixBoard()

        nextPieceLabel = QLabel()
        nextPieceLabel.setFrameStyle(QFrame.Box | QFrame.Raised)
        nextPieceLabel.setAlignment(Qt.AlignCenter)
        self.board.setNextPieceLabel(nextPieceLabel)

        scoreLcd = QLCDNumber(5)
        scoreLcd.setSegmentStyle(QLCDNumber.Filled)
        levelLcd = QLCDNumber(2)
        levelLcd.setSegmentStyle(QLCDNumber.Filled)
        linesLcd = QLCDNumber(5)
        linesLcd.setSegmentStyle(QLCDNumber.Filled)

        startButton = QPushButton("&Start")
        startButton.setFocusPolicy(Qt.NoFocus)
        quitButton = QPushButton("&Quit")
        quitButton.setFocusPolicy(Qt.NoFocus)
        pauseButton = QPushButton("&Pause")
        pauseButton.setFocusPolicy(Qt.NoFocus)

        startButton.clicked.connect(self.board.start)
        pauseButton.clicked.connect(self.board.pause)
        quitButton.clicked.connect(QApplication.instance().quit)
        self.board.scoreChanged.connect(scoreLcd.display)
        self.board.levelChanged.connect(levelLcd.display)
        self.board.linesRemovedChanged.connect(linesLcd.display)

        layout = QGridLayout()
        layout.addWidget(self.createLabel("NEXT"), 0, 0)
        layout.addWidget(nextPieceLabel, 1, 0)
        layout.addWidget(self.createLabel("LEVEL"), 2, 0)
        layout.addWidget(levelLcd, 3, 0)
        layout.addWidget(startButton, 4, 0)
        layout.addWidget(self.board, 0, 1, 6, 1)
        layout.addWidget(self.createLabel("SCORE"), 0, 2)
        layout.addWidget(scoreLcd, 1, 2)
        layout.addWidget(self.createLabel("LINES REMOVED"), 2, 2)
        layout.addWidget(linesLcd, 3, 2)
        layout.addWidget(quitButton, 4, 2)
        layout.addWidget(pauseButton, 5, 2)
        self.setLayout(layout)

        self.setWindowTitle("Tetrix")
        self.resize(550, 370)
项目:BigBrotherBot-For-UrT43    作者:ptitbigorneau    | 项目源码 | 文件源码
def initUI(self):
        """
        Initialize the MainTable layout.
        """
        self.setFixedSize(594, GEOMETRY[b3.getPlatform()]['MAIN_TABLE_HEIGHT'])
        self.setStyleSheet("""
        QWidget {
            background: #FFFFFF;
            border: 0;
        }
        QTableWidget {
            background: #FFFFFF;
            border: 1px solid #B7B7B7;
            color: #484848;
        }
        QTableWidget QLabel.name {
            margin-left: 1px;
        }
        QTableWidget QLabel.icon {
            margin-left: 1px;
        }
        QTableWidget QLabel.idle {
            font-style: italic;
            background: yellow;
            color: #484848;
            margin: 1px;
        }
        QTableWidget QLabel.running {
            font-style: italic;
            background: green;
            color: white;
            margin: 1px;
        }
        QTableWidget QLabel.errored {
            font-style: italic;
            background: red;
            color: white;
            margin: 1px;
        }
        """)
        self.setShowGrid(False)
        self.setAcceptDrops(True)
        self.setDragEnabled(True)
        self.setEditTriggers(QAbstractItemView.NoEditTriggers)
        self.setSelectionMode(QAbstractItemView.NoSelection)
        self.setFocusPolicy(Qt.NoFocus)
        self.horizontalHeader().setVisible(False)
        self.verticalHeader().setVisible(False)
        self.verticalHeader().sectionResizeMode(QHeaderView.Fixed)
        self.verticalHeader().setDefaultSectionSize(34)
        self.verticalScrollBar().setStyleSheet("""
        QScrollBar:vertical {
            background: #B7B7B7;
            border: 0;
        }
        """)
项目:kaptan    作者:PisiLinuxNew    | 项目源码 | 文件源码
def __init__(self, parent=None):
        super().__init__(parent)
        self.setTitle(self.tr("Preview"))
        self.setMaximumHeight(120)
        self.parent = parent

        vboxLayout = QVBoxLayout(self)
        self.previewGroupBox = QGroupBox(self)
        self.previewGroupBox.setObjectName("previewGroupBox")
        vboxLayout.addWidget(self.previewGroupBox)

        self.horizontalLayout = QHBoxLayout(self.previewGroupBox)
        self.verticalLayout = QVBoxLayout()
        self.horizontalLayout.addLayout(self.verticalLayout)

        self.previewLabel = QLabel(self.previewGroupBox)
        self.previewLabel.setText(self.tr("Window Text"))
        self.previewLabel.setObjectName("previewLabel")
        self.verticalLayout.addWidget(self.previewLabel)

        self.previewPushButton = QPushButton(self.previewGroupBox)
        self.previewPushButton.setText(self.tr("Button"))
        self.previewPushButton.setObjectName("previewPushButton")
        self.verticalLayout.addWidget(self.previewPushButton)

        self.previewTextBrowser = QTextBrowser(self.previewGroupBox)
        self.previewTextBrowser.setObjectName("previewTextBrowser")

        css = iniToCss(os.path.join("/usr/share/color-schemes", self.parent.children()[1].currentItem().colorSchemeName))

        self.previewTextBrowser.setHtml("""<style>#unclicked {color : rgb(%s);}
        #clicked {color : rgb(%s);}</style>"""%(css[1][0],css[1][1]) +
        self.tr("""<p>Normal text <a id='unclicked' href='#'>link</a> <a id='clicked' href='#'>visited</a></p>"""))


        self.horizontalLayout.addWidget(self.previewTextBrowser)


        self.previewPushButton.installEventFilter(self.previewGroupBox)
        self.previewPushButton.setFocusPolicy(Qt.NoFocus)

        self.previewTextBrowser.installEventFilter(self.previewGroupBox)
        self.previewTextBrowser.setFocusPolicy(Qt.NoFocus)
        self.previewTextBrowser.setTextInteractionFlags(Qt.NoTextInteraction)
项目:pyqt5-example    作者:guinslym    | 项目源码 | 文件源码
def __init__(self):
        super(TetrixWindow, self).__init__()

        self.board = TetrixBoard()

        nextPieceLabel = QLabel()
        nextPieceLabel.setFrameStyle(QFrame.Box | QFrame.Raised)
        nextPieceLabel.setAlignment(Qt.AlignCenter)
        self.board.setNextPieceLabel(nextPieceLabel)

        scoreLcd = QLCDNumber(5)
        scoreLcd.setSegmentStyle(QLCDNumber.Filled)
        levelLcd = QLCDNumber(2)
        levelLcd.setSegmentStyle(QLCDNumber.Filled)
        linesLcd = QLCDNumber(5)
        linesLcd.setSegmentStyle(QLCDNumber.Filled)

        startButton = QPushButton("&Start")
        startButton.setFocusPolicy(Qt.NoFocus)
        quitButton = QPushButton("&Quit")
        quitButton.setFocusPolicy(Qt.NoFocus)
        pauseButton = QPushButton("&Pause")
        pauseButton.setFocusPolicy(Qt.NoFocus)

        startButton.clicked.connect(self.board.start)
        pauseButton.clicked.connect(self.board.pause)
        quitButton.clicked.connect(QApplication.instance().quit)
        self.board.scoreChanged.connect(scoreLcd.display)
        self.board.levelChanged.connect(levelLcd.display)
        self.board.linesRemovedChanged.connect(linesLcd.display)

        layout = QGridLayout()
        layout.addWidget(self.createLabel("NEXT"), 0, 0)
        layout.addWidget(nextPieceLabel, 1, 0)
        layout.addWidget(self.createLabel("LEVEL"), 2, 0)
        layout.addWidget(levelLcd, 3, 0)
        layout.addWidget(startButton, 4, 0)
        layout.addWidget(self.board, 0, 1, 6, 1)
        layout.addWidget(self.createLabel("SCORE"), 0, 2)
        layout.addWidget(scoreLcd, 1, 2)
        layout.addWidget(self.createLabel("LINES REMOVED"), 2, 2)
        layout.addWidget(linesLcd, 3, 2)
        layout.addWidget(quitButton, 4, 2)
        layout.addWidget(pauseButton, 5, 2)
        self.setLayout(layout)

        self.setWindowTitle("Tetrix")
        self.resize(550, 370)