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

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

项目:gpvdm    作者:roderickmackenzie    | 项目源码 | 文件源码
def mouseMoveEvent(self,event):
            if  self.timer!=None:
                self.timer.stop()
                self.timer=None

            if self.lastPos==None:
                self.lastPos=event.pos()
            dx = event.x() - self.lastPos.x();
            dy = event.y() - self.lastPos.y();

            if event.buttons()==Qt.LeftButton:

                self.viewpoint.xRot =self.viewpoint.xRot + 1 * dy
                self.viewpoint.yRot =self.viewpoint.yRot + 1 * dx

            if event.buttons()==Qt.RightButton:
                self.viewpoint.x_pos =self.viewpoint.x_pos + 0.1 * dx
                self.viewpoint.y_pos =self.viewpoint.y_pos - 0.1 * dy


            self.lastPos=event.pos()
            self.setFocusPolicy(Qt.StrongFocus)
            self.setFocus()
            self.update()
项目:Mac-Python-3.X    作者:L1nwatch    | 项目源码 | 文件源码
def __init__(self, parent=None):
        super(TetrixBoard, self).__init__(parent)

        self.timer = QBasicTimer()
        self.nextPieceLabel = None
        self.isWaitingAfterLine = False
        self.curPiece = TetrixPiece()
        self.nextPiece = TetrixPiece()
        self.curX = 0
        self.curY = 0
        self.numLinesRemoved = 0
        self.numPiecesDropped = 0
        self.score = 0
        self.level = 0
        self.board = None

        self.setFrameStyle(QFrame.Panel | QFrame.Sunken)
        self.setFocusPolicy(Qt.StrongFocus)
        self.isStarted = False
        self.isPaused = False
        self.clearBoard()

        self.nextPiece.setRandomShape()
项目:examples    作者:pyqt    | 项目源码 | 文件源码
def __init__(self, parent=None):
        super(TetrixBoard, self).__init__(parent)

        self.timer = QBasicTimer()
        self.nextPieceLabel = None
        self.isWaitingAfterLine = False
        self.curPiece = TetrixPiece()
        self.nextPiece = TetrixPiece()
        self.curX = 0
        self.curY = 0
        self.numLinesRemoved = 0
        self.numPiecesDropped = 0
        self.score = 0
        self.level = 0
        self.board = None

        self.setFrameStyle(QFrame.Panel | QFrame.Sunken)
        self.setFocusPolicy(Qt.StrongFocus)
        self.isStarted = False
        self.isPaused = False
        self.clearBoard()

        self.nextPiece.setRandomShape()
项目: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)
项目:pyqt5-example    作者:guinslym    | 项目源码 | 文件源码
def __init__(self, parent=None):
        super(TetrixBoard, self).__init__(parent)

        self.timer = QBasicTimer()
        self.nextPieceLabel = None
        self.isWaitingAfterLine = False
        self.curPiece = TetrixPiece()
        self.nextPiece = TetrixPiece()
        self.curX = 0
        self.curY = 0
        self.numLinesRemoved = 0
        self.numPiecesDropped = 0
        self.score = 0
        self.level = 0
        self.board = None

        self.setFrameStyle(QFrame.Panel | QFrame.Sunken)
        self.setFocusPolicy(Qt.StrongFocus)
        self.isStarted = False
        self.isPaused = False
        self.clearBoard()

        self.nextPiece.setRandomShape()
项目:pyopenvr    作者:cmbruns    | 项目源码 | 文件源码
def __init__(self, renderer, glformat, app):
        "Creates an OpenGL context and a window, and acquires OpenGL resources"
        super(MyGlWidget, self).__init__(glformat)
        self.renderer = renderer
        self.app = app
        # Use a timer to rerender as fast as possible
        self.timer = QTimer(self)
        self.timer.setSingleShot(True)
        self.timer.setInterval(0)
        self.timer.timeout.connect(self.render_vr)
        # Accept keyboard events
        self.setFocusPolicy(Qt.StrongFocus)
项目:chronophore    作者:mesbahamin    | 项目源码 | 文件源码
def __init__(self, message, parent=None):
        super(QtUserTypeSelectionDialog, self).__init__(parent)

        lbl_message = QLabel(message, self)

        self.rb_tutor = QRadioButton('Tutor', self)
        self.rb_student = QRadioButton('Student', self)
        self.rb_tutor.setFocusPolicy(Qt.StrongFocus)
        self.rb_student.setFocusPolicy(Qt.StrongFocus)

        radio_vbox = QVBoxLayout()
        radio_vbox.addWidget(self.rb_tutor)
        radio_vbox.addWidget(self.rb_student)

        radios = QGroupBox(self)
        radios.setLayout(radio_vbox)

        btn_sign_in = QPushButton('Sign In', self)
        btn_sign_in.setDefault(True)
        btn_sign_in.setAutoDefault(True)
        btn_cancel = QPushButton('Cancel', self)
        btn_cancel.setAutoDefault(True)

        btn_sign_in.clicked.connect(self.update_user_type)
        btn_cancel.clicked.connect(self.reject)

        self.rb_tutor.setChecked(True)

        hbox = QHBoxLayout()
        hbox.addStretch(1)
        hbox.addWidget(btn_sign_in)
        hbox.addWidget(btn_cancel)

        vbox = QVBoxLayout()
        vbox.addWidget(lbl_message)
        vbox.addWidget(radios)
        vbox.addStretch(1)
        vbox.addLayout(hbox)

        self.setLayout(vbox)
        self.setWindowTitle('User Type Selection')
项目:gpvdm    作者:roderickmackenzie    | 项目源码 | 文件源码
def callback_on_line_help(self):
        #print("here")
        #self.a=cool_menu(self.ribbon.home.help.icon())
        #self.a.show()
        #self.a.setVisible(True)

        #self.a.setFocusPolicy(Qt.StrongFocus)
        #self.a.setFocus(True)
        #self.a.hasFocus()
        webbrowser.open("https://www.gpvdm.com")
项目:defconQt    作者:trufont    | 项目源码 | 文件源码
def __init__(self, parent=None):
        super(ColorVignette, self).__init__(parent)
        self.setFocusPolicy(Qt.StrongFocus)
        self.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum)
        self._color = None
        self._margins = (0, 2, 0, -2)
        self._mayClearColor = True
        self._readOnly = False
项目:Sigil-Ebook-Plugins    作者:Kennyl    | 项目源码 | 文件源码
def __init__(self,
                 app=None,
                 parent=None,
                 items=None):

        super(askSetting, self).__init__(parent)

        self.app = app
        self.items = items

        layout = QVBoxLayout()

        self.lineedits = {}
        global filelist
        layout.addWidget(QLabel(filelist))

        for key in items.keys():
            layout.addWidget(QLabel(key))
            self.lineedits[key] = QLineEdit()
            self.lineedits[key].setText(items[key])
            # enable ime input
            self.lineedits[key].inputMethodQuery(Qt.ImEnabled)
            layout.addWidget(self.lineedits[key])

        self.btn = QPushButton(
            'OK to Change Selected File in Book Browser', self)
        self.btn.clicked.connect(lambda: (self.bye(items)))
        self.btn.setFocusPolicy(Qt.StrongFocus)

        layout.addWidget(self.btn)

        self.setLayout(layout)
        self.setWindowTitle(' Setting ')
项目:Sigil-Ebook-Plugins    作者:Kennyl    | 项目源码 | 文件源码
def __init__(self,
                 items,
                 app=None,
                 parent=None,
                 ):

        super(askSetting, self).__init__(parent)

        self.app = app
        self.items = items

        layout = QVBoxLayout()

        self.buttons = {}
        self.lineedits = {}

        for key in items.keys():
            if isinstance(items[key], bool):
                self.buttons[key] = QCheckBox(key)
                self.buttons[key].setChecked(items[key])
                self.buttons[key].setFocusPolicy(Qt.StrongFocus)
                layout.addWidget(self.buttons[key])
            else:
                layout.addWidget(QLabel(key))
                self.lineedits[key] = QLineEdit()
                self.lineedits[key].setText(items[key])
                # enable ime input
                self.lineedits[key].inputMethodQuery(Qt.ImEnabled)
                layout.addWidget(self.lineedits[key])

        self.btn = QPushButton('OK', self)
        self.btn.clicked.connect(lambda: (self.bye(items)))
        self.btn.setFocusPolicy(Qt.StrongFocus)

        layout.addWidget(self.btn)

        self.setLayout(layout)
        self.setWindowTitle(' Setting ')
项目:Sigil-Ebook-Plugins    作者:Kennyl    | 项目源码 | 文件源码
def __init__(self,
                items,
                app = None,
                parent = None
                ):

      super(askSetting, self).__init__(parent)

      self.app = app
      self.items = items

      layout = QVBoxLayout()

      self.buttons = {}
      self.lineedits = {}

      for key in items.keys():
        if isinstance(items[key], bool):
            self.buttons[key] = QCheckBox(key)
            self.buttons[key].setChecked(items[key])
            self.buttons[key].setFocusPolicy(Qt.StrongFocus)
            layout.addWidget(self.buttons[key])
        else:
         # I Default it is string
            layoutX = QHBoxLayout()
            layoutX.addWidget(QLabel(key))
            self.lineedits[key] = QLineEdit()
            self.lineedits[key].setText(items[key])
            #enable ime input
            self.lineedits[key].inputMethodQuery(Qt.ImEnabled)
            layoutX.addWidget(self.lineedits[key])
            layout.addLayout(layoutX)

      self.btn = QPushButton('OK', self)
      self.btn.clicked.connect(lambda:(self.bye(items)))
      self.btn.setFocusPolicy(Qt.StrongFocus)

      layout.addWidget(self.btn)

      self.setLayout(layout)
      self.setWindowTitle(' Setting ')
项目:Sigil-Ebook-Plugins    作者:Kennyl    | 项目源码 | 文件源码
def __init__(self,
                 app=None,
                 parent=None,
                 items=None):

        super(askSetting, self).__init__(parent)

        self.app = app
        self.items = items

        layout = QVBoxLayout()

      #   self.buttons = {}
        self.lineedits = {}

        for key in items.keys():
            layout.addWidget(QLabel(key))
            self.lineedits[key] = QLineEdit()
            self.lineedits[key].setText(items[key])
            # enable ime input
            self.lineedits[key].inputMethodQuery(Qt.ImEnabled)
            layout.addWidget(self.lineedits[key])

        self.btn = QPushButton('OK', self)
        self.btn.clicked.connect(lambda: (self.bye(items)))
        self.btn.setFocusPolicy(Qt.StrongFocus)

        layout.addWidget(self.btn)

        self.setLayout(layout)
        self.setWindowTitle(' Setting ')
项目:Sigil-Ebook-Plugins    作者:Kennyl    | 项目源码 | 文件源码
def __init__(self,
                 app=None,
                 parent=None,
                 items=None):

        super(askSetting, self).__init__(parent)

        self.app = app
        self.items = items

        layout = QVBoxLayout()

        self.lineedits = {}
        global filelist
        layout.addWidget(QLabel(filelist))

        for key in items.keys():
            layout.addWidget(QLabel(key))
            self.lineedits[key] = QLineEdit()
            self.lineedits[key].setText(items[key])
            # enable ime input
            self.lineedits[key].inputMethodQuery(Qt.ImEnabled)
            layout.addWidget(self.lineedits[key])

        self.btn = QPushButton(
            'OK to Change Selected File in Book Browser', self)
        self.btn.clicked.connect(lambda: (self.bye(items)))
        self.btn.setFocusPolicy(Qt.StrongFocus)

        layout.addWidget(self.btn)

        self.setLayout(layout)
        self.setWindowTitle(' Setting ')
项目:Mac-Python-3.X    作者:L1nwatch    | 项目源码 | 文件源码
def __init__(self, orientation, title, parent=None):
        super(SlidersGroup, self).__init__(title, parent)

        self.slider = QSlider(orientation)
        self.slider.setFocusPolicy(Qt.StrongFocus)
        self.slider.setTickPosition(QSlider.TicksBothSides)
        self.slider.setTickInterval(10)
        self.slider.setSingleStep(1)

        self.scrollBar = QScrollBar(orientation)
        self.scrollBar.setFocusPolicy(Qt.StrongFocus)

        self.dial = QDial()
        self.dial.setFocusPolicy(Qt.StrongFocus)

        self.slider.valueChanged.connect(self.scrollBar.setValue)
        self.scrollBar.valueChanged.connect(self.dial.setValue)
        self.dial.valueChanged.connect(self.slider.setValue)
        self.dial.valueChanged.connect(self.valueChanged)

        if orientation == Qt.Horizontal:
            direction = QBoxLayout.TopToBottom
        else:
            direction = QBoxLayout.LeftToRight

        slidersLayout = QBoxLayout(direction)
        slidersLayout.addWidget(self.slider)
        slidersLayout.addWidget(self.scrollBar)
        slidersLayout.addWidget(self.dial)
        self.setLayout(slidersLayout)
项目:examples    作者:pyqt    | 项目源码 | 文件源码
def __init__(self, orientation, title, parent=None):
        super(SlidersGroup, self).__init__(title, parent)

        self.slider = QSlider(orientation)
        self.slider.setFocusPolicy(Qt.StrongFocus)
        self.slider.setTickPosition(QSlider.TicksBothSides)
        self.slider.setTickInterval(10)
        self.slider.setSingleStep(1)

        self.scrollBar = QScrollBar(orientation)
        self.scrollBar.setFocusPolicy(Qt.StrongFocus)

        self.dial = QDial()
        self.dial.setFocusPolicy(Qt.StrongFocus)

        self.slider.valueChanged.connect(self.scrollBar.setValue)
        self.scrollBar.valueChanged.connect(self.dial.setValue)
        self.dial.valueChanged.connect(self.slider.setValue)
        self.dial.valueChanged.connect(self.valueChanged)

        if orientation == Qt.Horizontal:
            direction = QBoxLayout.TopToBottom
        else:
            direction = QBoxLayout.LeftToRight

        slidersLayout = QBoxLayout(direction)
        slidersLayout.addWidget(self.slider)
        slidersLayout.addWidget(self.scrollBar)
        slidersLayout.addWidget(self.dial)
        self.setLayout(slidersLayout)
项目:songscreen    作者:maccesch    | 项目源码 | 文件源码
def __init__(self):
        super(MediaProgressWidget, self).__init__()

        self.setFocusPolicy(Qt.StrongFocus)
        self.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Minimum)

        self._dragging_progress = False
        self._dragging_marker = None
        self._dragging_marker_start_x = 0
        self._dragging_marker_start_pos = 0
        self._dragging_index = -1

        self.dirty = False
项目:pyqt5-example    作者:guinslym    | 项目源码 | 文件源码
def __init__(self, orientation, title, parent=None):
        super(SlidersGroup, self).__init__(title, parent)

        self.slider = QSlider(orientation)
        self.slider.setFocusPolicy(Qt.StrongFocus)
        self.slider.setTickPosition(QSlider.TicksBothSides)
        self.slider.setTickInterval(10)
        self.slider.setSingleStep(1)

        self.scrollBar = QScrollBar(orientation)
        self.scrollBar.setFocusPolicy(Qt.StrongFocus)

        self.dial = QDial()
        self.dial.setFocusPolicy(Qt.StrongFocus)

        self.slider.valueChanged.connect(self.scrollBar.setValue)
        self.scrollBar.valueChanged.connect(self.dial.setValue)
        self.dial.valueChanged.connect(self.slider.setValue)
        self.dial.valueChanged.connect(self.valueChanged)

        if orientation == Qt.Horizontal:
            direction = QBoxLayout.TopToBottom
        else:
            direction = QBoxLayout.LeftToRight

        slidersLayout = QBoxLayout(direction)
        slidersLayout.addWidget(self.slider)
        slidersLayout.addWidget(self.scrollBar)
        slidersLayout.addWidget(self.dial)
        self.setLayout(slidersLayout)
项目:vidcutter    作者:ozmartian    | 项目源码 | 文件源码
def __init__(self, parent=None):
        super(VideoSlider, self).__init__(parent)
        self.parent = parent
        self.logger = logging.getLogger(__name__)
        self.theme = self.parent.theme
        self._styles = '''
        QSlider:horizontal {{
            margin: 16px 8px 32px;
            height: {sliderHeight}px;
        }}
        QSlider::sub-page:horizontal {{
            border: none;
            background: {subpageBgColor};
            height: {subpageHeight}px;
            position: absolute;
            left: 0;
            right: 0;
            margin: 0;
            margin-left: {subpageLeftMargin}px;
        }}
        QSlider::add-page:horizontal {{
            border: none;
            background: transparent;
        }}
        QSlider::handle:horizontal {{
            border: none;
            border-radius: 0;
            background: transparent url(:images/{handleImage}) no-repeat top center;
            width: 15px;
            height: {handleHeight}px;
            margin: -12px -8px -20px;
        }}
        QSlider::handle:horizontal:hover {{
            background: transparent url(:images/{handleImageSelected}) no-repeat top center;
        }}'''
        self._progressbars = []
        self._regions = []
        self._regionHeight = 32
        self._regionSelected = -1
        self._cutStarted = False
        self._showSeekToolTip = True
        self._mouseOver = False
        self.showThumbs = True
        self.thumbnailsOn = False
        self.offset = 8
        self.setOrientation(Qt.Horizontal)
        self.setObjectName('videoslider')
        self.setCursor(Qt.PointingHandCursor)
        self.setStatusTip('Set clip start and end points')
        self.setFocusPolicy(Qt.StrongFocus)
        self.setRange(0, 0)
        self.setSingleStep(1)
        self.setTickInterval(100000)
        self.setTracking(True)
        self.setTickPosition(QSlider.TicksBelow)
        self.setFocus()
        self.restrictValue = 0
        self.valueChanged.connect(self.on_valueChanged)
        self.rangeChanged.connect(self.on_rangeChanged)
        self.installEventFilter(self)
项目:IDACyber    作者:patois    | 项目源码 | 文件源码
def OnCreate(self, form):
        self.form = form
        self.parent = self.FormToPyQtWidget(form)

        vl = QtWidgets.QVBoxLayout()
        hl = QtWidgets.QHBoxLayout()
        hl2 = QtWidgets.QHBoxLayout()
        hl3 = QtWidgets.QHBoxLayout()
        hl4 = QtWidgets.QHBoxLayout()

        self.pw = PixelWidget(self.parent, IDACyberForm.idbh)
        self.pw.setFocusPolicy(Qt.StrongFocus | Qt.WheelFocus)
        self.pw.statechanged.connect(self._update_status_text)
        self.pw.set_filter(self.filterlist[0], 0)
        self.pw.set_addr(ScreenEA())

        vl.addWidget(self.pw)

        flt = QLabel()  
        flt.setText('Filter:')
        hl.addWidget(flt)

        self.filterChoser = QComboBox()
        self.filterChoser.addItems([filter.name for filter in self.filterlist])
        self.filterChoser.currentIndexChanged.connect(self._select_filter)
        hl.addWidget(self.filterChoser)
        hl.addStretch(1)

        self.cb = QCheckBox('Sync')
        self.cb.setChecked(True)
        self.cb.stateChanged.connect(self._toggle_sync)
        hl2.addWidget(self.cb)

        self.status = QLabel()
        self.status.setText('Cyber, cyber!')
        hl4.addWidget(self.status)

        vl.addLayout(hl)
        vl.addLayout(hl2)
        vl.addLayout(hl3)
        vl.addLayout(hl4)

        self.parent.setLayout(vl)
        if IDACyberForm.hook is not None:
                IDACyberForm.hook.new_ea.connect(self._change_screen_ea)
项目:headcache    作者:s9w    | 项目源码 | 文件源码
def __init__(self, parent):
        super().__init__(parent)

        with open(pkg_resources.resource_filename("headcache", 'preview_style.css')) as file_style:
            self.preview_css_str = '<style type="text/css">{}</style>'.format(file_style.read())

        # markdown
        self.ast_generator = AstBlockParser()
        self.markdowner_simple = mistune.Markdown(renderer=IdRenderer())

        # stored data
        self.data = self.load_data()
        self.usage_mode = "browse"
        self.initUI()

        self.config = self.load_config()

        # setup search index
        analyzer_typing = StandardAnalyzer() | NgramFilter(minsize=2, maxsize=8)
        schema = Schema(
            title=TEXT(stored=True, analyzer=analyzer_typing, field_boost=self.config["search_title_weight"]),
            content=TEXT(stored=True, analyzer=analyzer_typing, field_boost=self.config["search_text_weight"]),
            time=STORED,
            path=ID(stored=True),
            tags=KEYWORD)
        if not os.path.exists("indexdir"):
            os.mkdir("indexdir")
        self.ix = create_in("indexdir", schema)

        # setup GUI

        self.old_sizes = self.splitter.sizes()
        self.parent().resize(*self.config["window_size"])

        if self.data:
            self.list1.setCurrentRow(0)
            self.list1.setFocus()

        self.overlay = Overlay(self)
        self.overlay.hide()
        self.setObjectName("mainframe")

        self.setFocusPolicy(Qt.StrongFocus)

        self.fileWatcher = watchdog.observers.Observer()
        watcher = FileChangeWatcher()
        self.fileWatcher.schedule(watcher, path=os.getcwd(), recursive=False)
        watcher.signal_deleted.connect(self.file_deleted)
        watcher.signal_modified.connect(self.file_modified)
        watcher.signal_added.connect(self.file_added)
        self.fileWatcher.start()