Python PyQt5.QtGui.QCursor() Examples

The following are 30 code examples for showing how to use PyQt5.QtGui.QCursor(). These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example.

You may want to check out the right sidebar which shows the related API usage.

You may also want to check out all available functions/classes of the module PyQt5.QtGui , or try the search function .

Example 1
Project: MusicBox   Author: HuberTRoy   File: addition.py    License: MIT License 6 votes vote down vote up
def __init__(self, parent=None):
        super(SearchLineEdit, self).__init__()
        self.setObjectName("SearchLine")
        self.parent = parent
        self.setMinimumSize(218, 20)
        with open('QSS/searchLine.qss', 'r') as f:
            self.setStyleSheet(f.read())

        self.button = QPushButton(self)
        self.button.setMaximumSize(13, 13)
        self.button.setCursor(QCursor(Qt.PointingHandCursor))

        self.setTextMargins(3, 0, 19, 0)

        self.spaceItem = QSpacerItem(150, 10, QSizePolicy.Expanding)

        self.mainLayout = QHBoxLayout()
        self.mainLayout.addSpacerItem(self.spaceItem)
        # self.mainLayout.addStretch(1)
        self.mainLayout.addWidget(self.button)
        self.mainLayout.addSpacing(10)
        self.mainLayout.setContentsMargins(0, 0, 0, 0)
        self.setLayout(self.mainLayout) 
Example 2
Project: kawaii-player   Author: kanishka-linux   File: playlist.py    License: GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, parent, uiwidget=None, home_var=None, tmp=None, logr=None):
        super(PlaylistWidget, self).__init__(parent)
        global MainWindow, home, TMPDIR, logger, ui
        self.setDefaultDropAction(QtCore.Qt.MoveAction)
        self.setAcceptDrops(True)
        self.setDragEnabled(True)
        self.setDragDropMode(QtWidgets.QAbstractItemView.InternalMove)
        self.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection)
        self.setCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor))
        self.downloadWget = []
        self.downloadWget_cnt = 0
        MainWindow = parent
        ui = uiwidget
        self.ui = uiwidget
        TMPDIR = tmp
        home = home_var
        logger = logr
        self.upcount = 0
        self.downcount = 0
        self.count_limit = 1
        self.pc_to_pc_dict = {}
        self.verify_slave_ssl = True
        self.discover_slave_thread = None 
Example 3
Project: kawaii-player   Author: kanishka-linux   File: optionwidgets.py    License: GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, parent, uiwidget, name):
        super(GSBCSlider, self).__init__(parent)
        global ui
        self.parent = parent
        ui = uiwidget
        self.setObjectName(name)
        self.setOrientation(QtCore.Qt.Horizontal)
        if name == 'zoom':
            self.setRange(-2000, 2000)
            self.setSingleStep(10)
            self.setPageStep(10)
        elif name == 'speed':
            self.setRange(-100, 900)
            self.setSingleStep(10)
            self.setPageStep(10)
        else:
            self.setRange(-100, 100)
            self.setSingleStep(1)
            self.setPageStep(1)
        #self.setTickInterval(5)
        self.setValue(0)
        self.setMouseTracking(True)
        self.valueChanged.connect(self.adjust_gsbc_values)
        self.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
        #self.setTickPosition(QtWidgets.QSlider.TicksAbove) 
Example 4
Project: dzetsaka   Author: nkarasiak   File: progressBar.py    License: GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, inMsg=' Loading...', inMaxStep=1):
        """
        """
        # Save reference to the QGIS interface
        # initialize progressBar
        # QApplication.processEvents() # Help to keep UI alive
        self.iface = iface

        widget = iface.messageBar().createMessage('Please wait  ', inMsg)

        prgBar = QProgressBar()
        self.prgBar = prgBar

        widget.layout().addWidget(self.prgBar)
        iface.messageBar().pushWidget(widget)
        QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))

        # if Max 0 and value 0, no progressBar, only cursor loading
        # default is set to 0
        prgBar.setValue(1)
        # set Maximum for progressBar
        prgBar.setMaximum(inMaxStep) 
Example 5
Project: CvStudio   Author: haruiz   File: items.py    License: MIT License 6 votes vote down vote up
def __init__(self, *args, **kwargs):
        super(EditableItem, self).__init__(*args, **kwargs)
        self.setZValue(10)
        self.setAcceptHoverEvents(True)
        self.setFlag(QtWidgets.QGraphicsItem.ItemIsSelectable, True)
        self.setFlag(QtWidgets.QGraphicsItem.ItemIsMovable, True)
        self.setFlag(QtWidgets.QGraphicsItem.ItemSendsGeometryChanges, True)
        self.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
        self.setOpacity(0.5)
        self.signals = EditableItemSignals()
        self._labels_dao = LabelDao()
        self._label = LabelVO()
        self._tag = None
        self._shape_type = None

        app = QApplication.instance()
        color = app.palette().color(QPalette.Highlight)
        self._pen_color = color
        self._pen_width = 2
        self._brush_color = color

        self.setPen(QtGui.QPen(self._pen_color, self._pen_width)) 
Example 6
Project: CvStudio   Author: haruiz   File: items.py    License: MIT License 6 votes vote down vote up
def __init__(self, index=None):
        super(EditablePolygonPoint, self).__init__()
        self.setPath(EditablePolygonPoint.circle)
        self.setFlag(QtWidgets.QGraphicsItem.ItemIsSelectable, True)
        self.setFlag(QtWidgets.QGraphicsItem.ItemIsMovable, True)
        self.setFlag(QtWidgets.QGraphicsItem.ItemSendsGeometryChanges, True)
        self.setAcceptHoverEvents(True)
        self.index = index
        self.setZValue(11)
        self.signals = EditablePolygonPointSignals()
        self.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))

        app = QApplication.instance()
        color = app.palette().color(QPalette.Highlight)
        self._pen_color = color
        self._pen_width = 2
        self._brush_color = color

        self.setPen(QtGui.QPen(self._pen_color, self._pen_width))
        self.setBrush(self._brush_color) 
Example 7
Project: gridsync   Author: gridsync   File: history.py    License: GNU General Public License v3.0 6 votes vote down vote up
def on_right_click(self, position):
        if not position:
            position = self.viewport().mapFromGlobal(QCursor().pos())
        item = self.itemAt(position)
        if not item:
            return
        widget = self.itemWidget(item)
        menu = QMenu(self)
        open_file_action = QAction("Open file")
        open_file_action.triggered.connect(lambda: open_path(widget.path))
        menu.addAction(open_file_action)
        open_folder_action = QAction("Open enclosing folder")
        open_folder_action.triggered.connect(
            lambda: self.on_double_click(item)
        )
        menu.addAction(open_folder_action)
        menu.exec_(self.viewport().mapToGlobal(position)) 
Example 8
Project: mindfulness-at-the-computer   Author: mindfulness-at-the-computer   File: breathing_dlg.py    License: GNU General Public License v3.0 5 votes vote down vote up
def _breathing_gi_hover(self):
        if mc.mc_global.breathing_state == mc.mc_global.BreathingState.breathing_in:
            return

        hover_rectangle_qsize = QtCore.QSizeF(BR_WIDTH_FT, BR_HEIGHT_FT)
        # noinspection PyCallByClass
        pos_pointf = QtWidgets.QGraphicsItem.mapFromItem(
            self._breathing_gi,
            self._breathing_gi,
            self._breathing_gi.x() + (self._breathing_gi.boundingRect().width() - hover_rectangle_qsize.width()) / 2,
            self._breathing_gi.y() + (self._breathing_gi.boundingRect().height() - hover_rectangle_qsize.height()) / 2
        )
        # -widget coords
        hover_rectangle_coords_qrect = QtCore.QRectF(pos_pointf, hover_rectangle_qsize)

        cursor = QtGui.QCursor()  # -screen coords
        cursor_pos_widget_coords_qp = self.mapFromGlobal(cursor.pos())  # -widget coords

        logging.debug("cursor.pos() = " + str(cursor.pos()))
        logging.debug("cursor_pos_widget_coords_qp = " + str(cursor_pos_widget_coords_qp))
        logging.debug("hover_rectangle_coords_qrect = " + str(hover_rectangle_coords_qrect))

        if hover_rectangle_coords_qrect.contains(cursor_pos_widget_coords_qp):
            mc.mc_global.breathing_state = mc.mc_global.BreathingState.breathing_in
            self.ib_signal.emit()
            self.text_gi.update_pos_and_origin_point(VIEW_WIDTH_INT, VIEW_HEIGHT_INT)
            self._breathing_gi.update_pos_and_origin_point(VIEW_WIDTH_INT, VIEW_HEIGHT_INT) 
Example 9
Project: dunya-desktop   Author: MTG   File: audioattframe.py    License: GNU General Public License v3.0 5 votes vote down vote up
def _set_size_attributes(self):
        """Sets the size policies of frame"""
        size_policy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed)
        size_policy.setHorizontalStretch(0)
        size_policy.setVerticalStretch(0)
        size_policy.setHeightForWidth(self.sizePolicy().hasHeightForWidth())
        self.setSizePolicy(size_policy)
        self.setCursor(QCursor(Qt.ArrowCursor))
        self.setFrameShape(QFrame.StyledPanel)
        self.setFrameShadow(QFrame.Raised)
        self.setLineWidth(1) 
Example 10
Project: pyleecan   Author: Eomys   File: HelpButton.py    License: Apache License 2.0 5 votes vote down vote up
def __init__(self, *args, **kwargs):
        """Same constructor as QLineEdit + config validator
        """
        self.url = "https://eomys.com/"

        # Call the QLabel constructor
        super(HelpButton, self).__init__(*args, **kwargs)

        self.setCursor(QCursor(Qt.PointingHandCursor))
        self.setPixmap(QPixmap(":/images/images/icon/help_16.png")) 
Example 11
Project: kawaii-player   Author: kanishka-linux   File: guisignals.py    License: GNU General Public License v3.0 5 votes vote down vote up
def cursor_function(self, val):
        widget, opt = val
        if opt == "show":
            widget.setCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor))
        else:
            if platform.system().lower() == "darwin" and widget == ui.tab_5:
                widget.arrow_timer.start(1000)
            else:
                widget.setCursor(QtGui.QCursor(QtCore.Qt.BlankCursor)) 
Example 12
Project: kawaii-player   Author: kanishka-linux   File: player.py    License: GNU General Public License v3.0 5 votes vote down vote up
def arrow_hide(self):
        if self.player_val in ["mplayer", "mpv", "libmpv"]:
            if self.ui.frame_extra_toolbar.isHidden() and self.ui.list2.isHidden():
                self.setCursor(QtGui.QCursor(QtCore.Qt.BlankCursor))
                self.setFocus()
                logger.debug("arrow hide")
            elif self.hasFocus():
                self.setCursor(QtGui.QCursor(QtCore.Qt.BlankCursor))
                logger.debug('player has focus')
            else:
                logger.debug('player not focussed') 
Example 13
Project: kawaii-player   Author: kanishka-linux   File: optionwidgets.py    License: GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent, uiwidget, mainwidget):
        super(VolumeSlider, self).__init__(parent)
        global ui, MainWindow
        MainWindow = mainwidget
        ui = uiwidget
        self.parent = parent
        self.setOrientation(QtCore.Qt.Horizontal)
        self.setRange(0, 100)
        self.setPageStep(2)
        self.setSingleStep(2)
        self.setMouseTracking(True)
        self.valueChanged.connect(self.adjust_volume)
        self.pressed = False
        self.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
        self.release = False 
Example 14
Project: kawaii-player   Author: kanishka-linux   File: thumbnail.py    License: GNU General Public License v3.0 5 votes vote down vote up
def thumbnail_fs_focus(self):
        #for i in range(0, 4):
        #p = "ui.label_epn_"+str(ui.thumbnail_label_number[0])+".setFocus()"
        #exec(p)
        self.setFocus()
        self.setCursor(QtGui.QCursor(QtCore.Qt.BlankCursor))
        ui.frame1.hide() 
Example 15
Project: kawaii-player   Author: kanishka-linux   File: mpv_opengl.py    License: GNU General Public License v3.0 5 votes vote down vote up
def arrow_hide(self):
        if gui.player_val in ['mpv', 'mplayer', 'libmpv']:
            if self.hasFocus():
                self.setCursor(QtGui.QCursor(QtCore.Qt.BlankCursor))
                logger.debug('player has focus')
                #QtWidgets.QApplication.setOverrideCursor(QtCore.Qt.BlankCursor);
            else:
                logger.debug('player not focussed')
            if (self.ui.fullscreen_video and self.hasFocus() and self.ui.tab_6.isHidden()
                        and self.ui.list2.isHidden() and self.ui.tab_2.isHidden()):
                self.ui.frame1.hide() 
Example 16
Project: linux-show-player   Author: FrancescoCeruti   File: media_cue_menus.py    License: GNU General Public License v3.0 5 votes vote down vote up
def add_uri_audio_media_cue():
        """Add audio MediaCue(s) form user-selected files"""

        if get_backend() is None:
            QMessageBox.critical(MainWindow(), 'Error', 'Backend not loaded')
            return

        # Default path to system "music" folder
        path = QStandardPaths.writableLocation(QStandardPaths.MusicLocation)

        # Get the backend extensions and create a filter for the Qt file-dialog
        extensions = get_backend().supported_extensions()
        filters = qfile_filters(extensions, anyfile=False)
        # Display a file-dialog for the user to choose the media-files
        files, _ = QFileDialog.getOpenFileNames(MainWindow(),
                                                translate('MediaCueMenus',
                                                          'Select media files'),
                                                path, filters)

        QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))

        # Create media cues, and add them to the Application cue_model
        for file in files:
            cue = CueFactory.create_cue('URIAudioCue', uri='file://' + file)
            # Use the filename without extension as cue name
            cue.name = os.path.splitext(os.path.basename(file))[0]
            Application().cue_model.add(cue)

        QApplication.restoreOverrideCursor() 
Example 17
Project: pychemqt   Author: jjgomera   File: flujo.py    License: GNU General Public License v3.0 5 votes vote down vote up
def waitClick(self, numClick, type, object):
        self.object = object
        self.addType = type
        self.addObj = True
        self.views()[0].viewport().setCursor(QtGui.QCursor(QtCore.Qt.CrossCursor))
        self.parent().statusbar.showMessage(QtWidgets.QApplication.translate("pychemqt",
                                                                             "Click in desire text position in screen"))
        self.Pos = []
        self.clickCollector = WaitforClick(numClick, self)
        self.clickCollector.finished.connect(self.click)
        self.clickCollector.start() 
Example 18
Project: parsec-cloud   Author: Scille   File: custom_widgets.py    License: GNU Affero General Public License v3.0 5 votes vote down vote up
def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.setCursor(QCursor(Qt.PointingHandCursor))
        self.full_text = "" 
Example 19
Project: parsec-cloud   Author: Scille   File: custom_widgets.py    License: GNU Affero General Public License v3.0 5 votes vote down vote up
def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.setCursor(QCursor(Qt.PointingHandCursor)) 
Example 20
Project: go2mapillary   Author: enricofer   File: identifygeometry.py    License: GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parentInstance, targetLayer):
        self.parentInstance = parentInstance
        self.canvas = parentInstance.canvas
        self.targetLayer = targetLayer
        QgsMapToolIdentify.__init__(self, self.canvas)
        self.setCursor(QCursor()) 
Example 21
Project: QGISFMV   Author: All4Gis   File: ui_FmvOpenStream.py    License: GNU General Public License v3.0 5 votes vote down vote up
def setupUi(self, FmvOpenStream):
        FmvOpenStream.setObjectName("FmvOpenStream")
        FmvOpenStream.resize(355, 83)
        FmvOpenStream.setMinimumSize(QtCore.QSize(0, 0))
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(":/imgFMV/images/stream.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        FmvOpenStream.setWindowIcon(icon)
        FmvOpenStream.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates))
        self.verticalLayout = QtWidgets.QVBoxLayout(FmvOpenStream)
        self.verticalLayout.setObjectName("verticalLayout")
        self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_2.setObjectName("horizontalLayout_2")
        self.cmb_protocol = QtWidgets.QComboBox(FmvOpenStream)
        self.cmb_protocol.setCursor(QtGui.QCursor(QtCore.Qt.IBeamCursor))
        self.cmb_protocol.setObjectName("cmb_protocol")
        self.cmb_protocol.addItem("")
        self.horizontalLayout_2.addWidget(self.cmb_protocol)
        self.ln_host = QtWidgets.QLineEdit(FmvOpenStream)
        self.ln_host.setText("")
        self.ln_host.setObjectName("ln_host")
        self.horizontalLayout_2.addWidget(self.ln_host)
        self.ln_port = QtWidgets.QLineEdit(FmvOpenStream)
        self.ln_port.setInputMethodHints(QtCore.Qt.ImhNone)
        self.ln_port.setText("")
        self.ln_port.setObjectName("ln_port")
        self.horizontalLayout_2.addWidget(self.ln_port)
        self.verticalLayout.addLayout(self.horizontalLayout_2)
        self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_3.setObjectName("horizontalLayout_3")
        self.btn_Open = QtWidgets.QPushButton(FmvOpenStream)
        self.btn_Open.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
        self.btn_Open.setObjectName("btn_Open")
        self.horizontalLayout_3.addWidget(self.btn_Open)
        self.verticalLayout.addLayout(self.horizontalLayout_3)

        self.retranslateUi(FmvOpenStream)
        self.btn_Open.clicked['bool'].connect(FmvOpenStream.OpenStream)
        QtCore.QMetaObject.connectSlotsByName(FmvOpenStream) 
Example 22
Project: Hydra   Author: CountryTk   File: foldArea.py    License: GNU General Public License v3.0 5 votes vote down vote up
def returnCursorToNormal(self) -> None:

        cursor: QCursor = QCursor(Qt.ArrowCursor)
        QApplication.setOverrideCursor(cursor)
        QApplication.changeOverrideCursor(cursor) 
Example 23
Project: Hydra   Author: CountryTk   File: foldArea.py    License: GNU General Public License v3.0 5 votes vote down vote up
def mouseMoveEvent(self, event: QMouseEvent) -> None:

        pattern = re.compile(FOLDING_PATTERN)
        block: QTextBlock = self.editor.getBlockUnderCursor(event)

        if pattern.match(block.text()):

            cursor: QCursor = QCursor(Qt.PointingHandCursor)
            QApplication.setOverrideCursor(cursor)
            QApplication.changeOverrideCursor(cursor)

        else:

            self.returnCursorToNormal() 
Example 24
Project: Hydra   Author: CountryTk   File: Messagebox.py    License: GNU General Public License v3.0 5 votes vote down vote up
def change_cursor(self):
        # Changes the cursor to indicate that our QAction is clickable
        cursor = QCursor(Qt.PointingHandCursor)
        QApplication.setOverrideCursor(cursor)
        QApplication.changeOverrideCursor(cursor) 
Example 25
Project: Hydra   Author: CountryTk   File: Messagebox.py    License: GNU General Public License v3.0 5 votes vote down vote up
def normal_cursor(self):
        # Returns the cursor to normal cursor
        cursor = QCursor(Qt.ArrowCursor)

        QApplication.setOverrideCursor(cursor)
        QApplication.changeOverrideCursor(cursor) 
Example 26
Project: Hydra   Author: CountryTk   File: Messagebox.py    License: GNU General Public License v3.0 5 votes vote down vote up
def mouseMoveEvent(self, event):
        cursor = QCursor(Qt.ArrowCursor)
        QApplication.setOverrideCursor(cursor)
        QApplication.changeOverrideCursor(cursor)
        super().mouseMoveEvent(event) 
Example 27
Project: CvStudio   Author: haruiz   File: polygon.py    License: MIT License 5 votes vote down vote up
def __init__(self, annotation_item, index):
        super(GripItem, self).__init__()
        self.m_annotation_item = annotation_item
        self.m_index = index

        self.setPath(GripItem.circle)
        self.setBrush(QtGui.QColor("green"))
        self.setPen(QtGui.QPen(QtGui.QColor("green"), 2))
        self.setFlag(QtWidgets.QGraphicsItem.ItemIsSelectable, True)
        self.setFlag(QtWidgets.QGraphicsItem.ItemIsMovable, True)
        self.setFlag(QtWidgets.QGraphicsItem.ItemSendsGeometryChanges, True)
        self.setAcceptHoverEvents(True)
        self.setZValue(11)
        self.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor)) 
Example 28
Project: CvStudio   Author: haruiz   File: polygon.py    License: MIT License 5 votes vote down vote up
def __init__(self, parent=None):
        super(PolygonAnnotation, self).__init__(parent)
        self.m_points = []
        self.setZValue(10)
        self.setPen(QtGui.QPen(QtGui.QColor("green"), 2))
        self.setAcceptHoverEvents(True)

        self.setFlag(QtWidgets.QGraphicsItem.ItemIsSelectable, True)
        self.setFlag(QtWidgets.QGraphicsItem.ItemIsMovable, True)
        self.setFlag(QtWidgets.QGraphicsItem.ItemSendsGeometryChanges, True)

        self.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))

        self.m_items = [] 
Example 29
Project: fotobox   Author: adlerweb   File: fotobox.py    License: MIT License 5 votes vote down vote up
def __init__(self):
    super(QWebView, self).__init__()
    self.ui = Ui_Form_mod()
    self.ui.setupUi(self)
    self.ui.initSystem(self)
    self.ui.screenMain(self)
    self.setCursor(QtGui.QCursor(QtCore.Qt.BlankCursor))

    if not fotoboxCfg['nopi']:
      GPIO.setmode(GPIO.BCM)

      GPIO.setup(17, GPIO.IN, pull_up_down=GPIO.PUD_UP)
      GPIO.setup(21, GPIO.IN, pull_up_down=GPIO.PUD_UP)
      GPIO.setup(22, GPIO.IN, pull_up_down=GPIO.PUD_UP)

      self.btnC1 = GPIO.HIGH
      self.btnC2 = GPIO.HIGH
      self.btnC3 = GPIO.HIGH
    
    #Key Poller
    self.timerKey = QTimer(self)
    self.timerKey.timeout.connect(self.buttonCheck)
    self.timerKey.start(25)
    self.btnB  = 1

    self.showFullScreen() 
Example 30
Project: DQLearning-Toolbox   Author: liangzp   File: mainwindow.py    License: MIT License 5 votes vote down vote up
def mousePressEvent(self, event):
        if event.button() == QtCore.Qt.LeftButton:
            self.m_drag = True
            self.m_DragPosition = event.globalPos() - self.pos()
            event.accept()
            self.setCursor(QtGui.QCursor(QtCore.Qt.OpenHandCursor))