Python PyQt5.QtGui.QCursor() Examples
The following are 30
code examples of PyQt5.QtGui.QCursor().
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 also want to check out all available functions/classes of the module
PyQt5.QtGui
, or try the search function
.
Example #1
Source File: foldArea.py From Hydra with GNU General Public License v3.0 | 7 votes |
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 #2
Source File: addition.py From MusicBox with MIT License | 7 votes |
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 #3
Source File: items.py From CvStudio with MIT License | 6 votes |
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 #4
Source File: items.py From CvStudio with MIT License | 6 votes |
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 #5
Source File: playlist.py From kawaii-player with GNU General Public License v3.0 | 6 votes |
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 #6
Source File: history.py From gridsync with GNU General Public License v3.0 | 6 votes |
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 #7
Source File: optionwidgets.py From kawaii-player with GNU General Public License v3.0 | 6 votes |
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 #8
Source File: progressBar.py From dzetsaka with GNU General Public License v3.0 | 6 votes |
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 #9
Source File: qt_backend.py From VirtScreen with GNU General Public License v3.0 | 5 votes |
def x(self): cursor = QCursor().pos() return cursor.x()
Example #10
Source File: Messagebox.py From Hydra with GNU General Public License v3.0 | 5 votes |
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 #11
Source File: Messagebox.py From Hydra with GNU General Public License v3.0 | 5 votes |
def normal_cursor(self): # Returns the cursor to normal cursor cursor = QCursor(Qt.ArrowCursor) QApplication.setOverrideCursor(cursor) QApplication.changeOverrideCursor(cursor)
Example #12
Source File: Messagebox.py From Hydra with GNU General Public License v3.0 | 5 votes |
def mouseMoveEvent(self, event): cursor = QCursor(Qt.ArrowCursor) QApplication.setOverrideCursor(cursor) QApplication.changeOverrideCursor(cursor) super().mouseMoveEvent(event)
Example #13
Source File: polygon.py From CvStudio with MIT License | 5 votes |
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 #14
Source File: polygon.py From CvStudio with MIT License | 5 votes |
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 #15
Source File: fotobox.py From fotobox with MIT License | 5 votes |
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 #16
Source File: mainwindow.py From DQLearning-Toolbox with MIT License | 5 votes |
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))
Example #17
Source File: mainwindow.py From DQLearning-Toolbox with MIT License | 5 votes |
def mouseReleaseEvent(self, QMouseEvent): self.m_drag = False self.setCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor)) #设置案件操作
Example #18
Source File: main.py From controleEstoque with MIT License | 5 votes |
def botaoReceberParcela(self, tabela, row, col, funcao, texto, status): item = QtWidgets.QPushButton() # item.setFixedWidth(70) # item.setFixedHeight(30) item.setCursor(QtGui.QCursor(Qt.PointingHandCursor)) if status == 1: item.setDisabled(True) item.setFocusPolicy(Qt.NoFocus) item.setFlat(Qt.NoItemFlags) item.setStyleSheet("QPushButton{\n" "background-color: #7AB32E;\n" "border-radius: 2px;\n" "padding: 2px;\n" "border: none;\n" "text-transform: uppercase;\n" "font: 10px \"Arial\";\n" "}\n" "QPushButton:hover{\n" "background-color: #40a286\n" "}" ) item.setText(texto) font = QtGui.QFont() font.setFamily("Tahoma") font.setPointSize(10) item.setFont(font) icon1 = QtGui.QIcon() icon1.addPixmap(QtGui.QPixmap( self.resourcepath('Images/money.png')), QtGui.QIcon.Normal, QtGui.QIcon.Off) item.setIcon(icon1) tabela.setCellWidget(row, col, item) item.clicked.connect(funcao) # Input receber/pagar parcela compra e venda
Example #19
Source File: qt_backend.py From VirtScreen with GNU General Public License v3.0 | 5 votes |
def y(self): cursor = QCursor().pos() return cursor.y()
Example #20
Source File: qomui_gui.py From qomui with GNU General Public License v3.0 | 5 votes |
def start_progress_bar(self, bar, server=None): action = bar if bar == "upgrade": text = "Upgrading Qomui" elif bar == "connecting": text = "Connecting to {}".format(server) bar = server elif bar == "connecting_bypass": text = "Connecting to {}".format(server) bar = server else: text = "Importing {}".format(bar) QtWidgets.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.WaitCursor)) try: getattr(self, "{}Bar".format(bar)) self.stop_progress_bar(bar) except AttributeError: pass setattr(self, "{}Bar".format(bar), widgets.ProgressBarWidget()) self.vLayoutMain.addWidget(getattr(self, "{}Bar".format(bar))) getattr(self, "{}Bar".format(bar)).setText(text, action=action) getattr(self, "{}Bar".format(bar)).abort.connect(self.abort_action)
Example #21
Source File: Worker.py From PyRAT with Mozilla Public License 2.0 | 5 votes |
def guirun(cls, viewer, title=None): if not hasattr(pyrat, "app"): QtCore.pyqtRemoveInputHook() app = QtWidgets.QApplication(sys.argv) para_backup = copy.deepcopy(cls.para) # keep a deep copy of the default parameters res = 1 if len(cls.para) > 0: if title is None: title = cls().name wid = pyrat.viewer.Dialogs.FlexInputDialog(cls.para, parent=viewer, title=title, doc=cls.__doc__) res = wid.exec_() if res == 1: plugin = cls() # instance with new parameters setattr(cls, 'para', para_backup) # copy back the defaults if hasattr(pyrat, "app"): viewer.statusBar.setMessage(message=' ' + plugin.name + ' ', colour='R') QtWidgets.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.BusyCursor)) if pyrat._debug is False: try: layers = plugin.run() scaling_hint = plugin.scaling_hint del plugin if hasattr(pyrat, "app"): viewer.updateViewer(layer=layers, method=scaling_hint) except Exception as ex: cls.crash_handler(ex) else: layers = plugin.run() scaling_hint = plugin.scaling_hint del plugin if hasattr(pyrat, "app"): viewer.updateViewer(layer=layers, method=scaling_hint) if hasattr(pyrat, "app"): viewer.statusBar.setMessage(message=' Ready ', colour='G') QtWidgets.QApplication.restoreOverrideCursor()
Example #22
Source File: app.py From tinydecred with ISC License | 5 votes |
def getButton(self, size, text, tracked=True): """ Get a button of the requested size. Size can be one of [TINY, SMALL, MEDIUM, LARGE]. The button is assigned a style in accordance with the current template. By default, the button is tracked and appropriately updated if the template is updated. Args: size (str): One of [TINY, SMALL, MEDIUM, LARGE]. text (str): The text displayed on the button. tracked (bool): default True. Whether to track the button. If it's a one time use button, as for a dynamically generated dialog, the button should not be tracked. Returns: QPushButton: An initilized Qt pushable button. """ button = QtWidgets.QPushButton(text, self.appWindow) button.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor)) if self.settings[DB.theme].decode() == Q.LIGHT_THEME: button.setProperty("button-style-class", Q.LIGHT_THEME) if size == TINY: button.setProperty("button-size-class", TINY) elif size == SMALL: button.setProperty("button-size-class", SMALL) elif size == MEDIUM: button.setProperty("button-size-class", MEDIUM) elif size == LARGE: button.setProperty("button-size-class", LARGE) if tracked: self.trackedCssItems.append(button) return button
Example #23
Source File: screens.py From tinydecred with ISC License | 5 votes |
def __init__(self, acct): """ Args: acct (Account): A Decred account. """ super().__init__() self.account = acct dim = 11 self.lockedIcon = SVGWidget("locked", h=dim).grab() self.unlockedIcon = SVGWidget("unlocked", h=dim).grab() self.src = QtCore.QRectF(0, 0, dim, dim) self.setProperty("button-style-class", Q.LIGHT_THEME) self.setProperty("button-size-class", SMALL) self.setText(acct.name) self.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
Example #24
Source File: main.py From controleEstoque with MIT License | 5 votes |
def botaoTabela(self, tabela, row, col, funcao, bg): item = QtWidgets.QPushButton() # item.setFixedWidth(30) # item.setFixedHeight(30) item.setCursor(QtGui.QCursor(Qt.PointingHandCursor)) item.setFocusPolicy(Qt.NoFocus) item.setFlat(Qt.NoItemFlags) item.setStyleSheet("QPushButton{\n" "background-color: #1E87F0;\n" "border-radius: 2px;\n" "padding: 2px;\n" "color: #FFF;\n" "font: 10px \"Tahoma\" Bold\n" "}\n" "QPushButton:hover{\n" "background-color: #40a286\n" "}") item.setText("EDITAR") icon1 = QtGui.QIcon() icon1.addPixmap(QtGui.QPixmap( self.resourcepath('Images/editar.png')), QtGui.QIcon.Normal, QtGui.QIcon.Off) item.setIcon(icon1) tabela.setCellWidget(row, col, item) item.clicked.connect(funcao) # Botão Remove Item
Example #25
Source File: main.py From controleEstoque with MIT License | 5 votes |
def botaoRemoveItem(self, tabela, row, col, funcao, bg): item = QtWidgets.QPushButton() # item.setFixedWidth(30) # item.setFixedHeight(30) item.setCursor(QtGui.QCursor(Qt.PointingHandCursor)) item.setFocusPolicy(Qt.NoFocus) item.setFlat(Qt.NoItemFlags) item.setStyleSheet("QPushButton{\n" "background-color: " + bg + ";\n" "border-radius: 2px;\n" "padding: 2px;\n" "}\n" "QPushButton:hover{\n" "background-color: #40a286\n" "}") item.setText("") icon1 = QtGui.QIcon() icon1.addPixmap(QtGui.QPixmap( self.resourcepath('Images/edit-delete.png')), QtGui.QIcon.Normal, QtGui.QIcon.Off) item.setIcon(icon1) tabela.setCellWidget(row, col, item) item.clicked.connect(funcao) # data e Status entrega tabela compra / venda
Example #26
Source File: breathing_dlg.py From mindfulness-at-the-computer with GNU General Public License v3.0 | 5 votes |
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 #27
Source File: thumbnail.py From kawaii-player with GNU General Public License v3.0 | 5 votes |
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 #28
Source File: audioattframe.py From dunya-desktop with GNU General Public License v3.0 | 5 votes |
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 #29
Source File: HelpButton.py From pyleecan with Apache License 2.0 | 5 votes |
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 #30
Source File: guisignals.py From kawaii-player with GNU General Public License v3.0 | 5 votes |
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))