Python PyQt5.QtCore.Qt.PointingHandCursor() Examples

The following are 30 code examples of PyQt5.QtCore.Qt.PointingHandCursor(). 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.QtCore.Qt , or try the search function .
Example #1
Source File: addition.py    From MusicBox with MIT License 7 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
Source File: videoslider.py    From vidcutter with GNU General Public License v3.0 7 votes vote down vote up
def keyPressEvent(self, event: QKeyEvent) -> None:
        qApp.sendEvent(self.parent, event)

    # def mouseMoveEvent(self, event: QMouseEvent) -> None:
    #     opt = QStyleOptionSlider()
    #     self.initStyleOption(opt)
    #     handle = self.style().subControlRect(QStyle.CC_Slider, opt, QStyle.SC_SliderHandle, self)
    #     if handle.x() <= event.pos().x() <= (handle.x() + handle.width()):
    #         self.setCursor(Qt.PointingHandCursor)
    #         self._handleHover = True
    #     else:
    #         self.unsetCursor()
    #         self._handleHover = False
    #     self.initStyle()
    #     super(VideoSlider, self).mouseMoveEvent(event) 
Example #3
Source File: CColorSlider.py    From CustomWidgets with GNU General Public License v3.0 7 votes vote down vote up
def __init__(self, types, parent=None, color=Qt.black):
        """
        :param types:                    渐变类型(0-透明,1-彩虹)
        :param parent:
        """
        super(CColorSlider, self).__init__(Qt.Horizontal, parent)
        self.setObjectName('Custom_Color_Slider')
        self.setCursor(Qt.PointingHandCursor)
        self.valueChanged.connect(self.onValueChanged)
        self._types = types
        self._color = color
        self._isFirstShow = True
        self._imageRainbow = None                       # 彩虹背景图
        self._imageAlphaColor = None                    # 带颜色透明图
        self._imageAlphaTmp = None                      # 透明方格
        self._imageAlpha = None                         # 带颜色透明背景和方格合成图
        self._imageCircle = None                        # 圆形滑块图
        self._imageCircleHover = None                   # 圆形滑块悬停图
        self.setToolTip('彩虹色' if self._types == self.TypeRainbow else '透明度') 
Example #4
Source File: foldArea.py    From Hydra with GNU General Public License v3.0 7 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 #5
Source File: botonRedondo.py    From PyQt5 with MIT License 6 votes vote down vote up
def initUI(self):

      # ================== WIDGET QPUSHBUTTON ====================

        buttonRedondo = QPushButton("2019", self)
        buttonRedondo.setToolTip("Botón redondo")
        buttonRedondo.setCursor(Qt.PointingHandCursor)

        buttonRedondo.setFixedWidth(58)
        buttonRedondo.setFixedHeight(58)
        buttonRedondo.setMask(QRegion(QRect(-1, -1, 59, 59), QRegion.Ellipse))

        buttonRedondo.setStyleSheet("QPushButton {background-color: yellow; border: 1.8px solid black; "
                                    "border-radius: 29.4px} QPushButton:pressed "
                                    "{background-color: white;}")
        
        buttonRedondo.move(171, 80)

      # =================== EVENTO QPUSHBUTTON ===================

        buttonRedondo.clicked.connect(self.botonPresionado)

  # ======================= FUNCIONES ============================ 
Example #6
Source File: QLabel_clickable.py    From PyQt5 with MIT License 6 votes vote down vote up
def initUI(self):

      # ==================== WIDGET QLABEL =======================
        
        self.labelImagen = QLabelClickable(self)
        self.labelImagen.setGeometry(15, 15, 118, 130)
        self.labelImagen.setToolTip("Imagen")
        self.labelImagen.setCursor(Qt.PointingHandCursor)

        self.labelImagen.setStyleSheet("QLabel {background-color: white; border: 1px solid "
                                       "#01DFD7; border-radius: 5px;}")

        self.pixmapImagen = QPixmap("Qt.png").scaled(112, 128, Qt.KeepAspectRatio,
                                                     Qt.SmoothTransformation)
        self.labelImagen.setPixmap(self.pixmapImagen)
        self.labelImagen.setAlignment(Qt.AlignCenter)

      # ===================== EVENTO QLABEL ======================

      # Llamar función al hacer clic o doble clic sobre el label
        self.labelImagen.clicked.connect(self.Clic)

  # ======================= FUNCIONES ============================ 
Example #7
Source File: CColorItems.py    From CustomWidgets with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, colors, *args, **kwargs):
        super(CColorItems, self).__init__(*args, **kwargs)
        self.setItemDelegate(StyledItemDelegate(self))
        self.setEditTriggers(self.NoEditTriggers)
        self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.setFlow(self.LeftToRight)
        self.setWrapping(True)
        self.setResizeMode(self.Adjust)
        self.setSpacing(6)
        self.setCursor(Qt.PointingHandCursor)
        self.setFrameShape(self.NoFrame)
        self._model = QStandardItemModel(self)
        self.setModel(self._model)

        for color in colors:
            self.addColor(color) 
Example #8
Source File: mostrarImagen.py    From PyQt5 with MIT License 5 votes vote down vote up
def initUI(self):

      # ==================== WIDGET QLABEL =======================
        
        self.labelImagen = QLabelClickable(self)
        self.labelImagen.setGeometry(15, 15, 118, 130)
        self.labelImagen.setToolTip("Imagen")
        self.labelImagen.setCursor(Qt.PointingHandCursor)

        self.labelImagen.setStyleSheet("QLabel {background-color: white; border: 1px solid "
                                       "#01DFD7; border-radius: 5px;}")
        
        self.labelImagen.setAlignment(Qt.AlignCenter)

      # ================= WIDGETS QPUSHBUTTON ====================

        buttonSeleccionar = QPushButton("Seleccionar", self)
        buttonSeleccionar.setToolTip("Seleccionar imagen")
        buttonSeleccionar.setCursor(Qt.PointingHandCursor)
        buttonSeleccionar.setGeometry(143, 15, 120, 25)

        buttonEliminar = QPushButton("Eliminar", self)
        buttonEliminar.setToolTip("Eliminar imagen")
        buttonEliminar.setCursor(Qt.PointingHandCursor)
        buttonEliminar.setGeometry(143, 45, 120, 25)

      # ===================== EVENTO QLABEL ======================

      # Llamar función al hacer clic sobre el label
        self.labelImagen.clicked.connect(self.seleccionarImagen)

      # ================== EVENTOS QPUSHBUTTON ===================

        buttonSeleccionar.clicked.connect(self.seleccionarImagen)
        buttonEliminar.clicked.connect(lambda: self.labelImagen.clear())
     

  # ======================= FUNCIONES ============================ 
Example #9
Source File: main.py    From controleEstoque with MIT License 5 votes vote down vote up
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 #10
Source File: Messagebox.py    From Hydra with 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 #11
Source File: HotPlaylist.py    From PyQt with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, cover_path, cover_title, video_url, *args, **kwargs):
        super(CoverLabel, self).__init__(*args, **kwargs)
#         super(CoverLabel, self).__init__(
#             '<html><head/><body><img src="{0}"/></body></html>'.format(os.path.abspath(cover_path)), *args, **kwargs)
        self.setCursor(Qt.PointingHandCursor)
        self.setScaledContents(True)
        self.setMinimumSize(220, 308)
        self.setMaximumSize(220, 308)
        self.cover_path = cover_path
        self.cover_title = cover_title
        self.video_url = video_url
        self.setPixmap(QPixmap(cover_path)) 
Example #12
Source File: HotPlaylist.py    From PyQt with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, cover_path, cover_title, video_url, *args, **kwargs):
        super(CoverLabel, self).__init__(*args, **kwargs)
        self.setCursor(Qt.PointingHandCursor)
        self.setScaledContents(True)
        self.setMinimumSize(220, 308)
        self.setMaximumSize(220, 308)
        self.cover_path = cover_path
        self.cover_title = cover_title
        self.video_url = video_url
        self.setPixmap(QPixmap(cover_path)) 
Example #13
Source File: HotPlaylist.py    From PyQt with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, cover_path, cover_title, video_url, *args, **kwargs):
        super(CoverLabel, self).__init__(*args, **kwargs)
#         super(CoverLabel, self).__init__(
#             '<html><head/><body><img src="{0}"/></body></html>'.format(os.path.abspath(cover_path)), *args, **kwargs)
        self.setCursor(Qt.PointingHandCursor)
        self.setScaledContents(True)
        self.setMinimumSize(220, 308)
        self.setMaximumSize(220, 308)
        self.cover_path = cover_path
        self.cover_title = cover_title
        self.video_url = video_url
        self.setPixmap(QPixmap(cover_path)) 
Example #14
Source File: SimulatorLabelTableView.py    From urh with GNU General Public License v3.0 5 votes vote down vote up
def mouseMoveEvent(self, e: QMouseEvent):
        index = self.indexAt(e.pos())
        if self.model().link_index(index):
            self.setCursor(Qt.PointingHandCursor)
        else:
            self.unsetCursor() 
Example #15
Source File: main.py    From controleEstoque with MIT License 5 votes vote down vote up
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 #16
Source File: main.py    From controleEstoque with MIT License 5 votes vote down vote up
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 #17
Source File: HelpButton.py    From pyleecan with 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 #18
Source File: TestCFramelessWidget.py    From CustomWidgets with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, *args, **kwargs):
        super(TestCFramelessBase, self).__init__(*args, **kwargs)
        self.resize(500, 400)
        layout = QVBoxLayout(self)
        layout.setSpacing(0)
        # 添加自定义标题栏
        layout.addWidget(CTitleBar(self, title='CTitleBar'))
        layout.addWidget(QLineEdit('输入框', self))
        # 底部空白占位
        layout.addWidget(
            QWidget(self, objectName='bottomWidget', cursor=Qt.PointingHandCursor)) 
Example #19
Source File: CSlider.py    From CustomWidgets with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, *args, **kwargs):
        super(CSlider, self).__init__(*args, **kwargs)
        self.setCursor(Qt.PointingHandCursor)
        self.setStyleSheet(Style) 
Example #20
Source File: custom_dialogs.py    From parsec-cloud with GNU Affero General Public License v3.0 5 votes vote down vote up
def __init__(self, message, button_texts, radio_mode=False):
        super().__init__()
        self.setupUi(self)
        self.status = None
        self.dialog = None
        self.label_message.setText(message)
        for text in button_texts:
            b = Button(text)
            b.clicked_self.connect(self._on_button_clicked)
            b.setCursor(Qt.PointingHandCursor)
            if radio_mode:
                self.layout_radios.addWidget(b)
            else:
                self.layout_buttons.insertWidget(1, b) 
Example #21
Source File: custom_widgets.py    From parsec-cloud with 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 #22
Source File: custom_widgets.py    From parsec-cloud with 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 #23
Source File: switch_button.py    From parsec-cloud with GNU Affero General Public License v3.0 5 votes vote down vote up
def enterEvent(self, event):  # pylint: disable=invalid-name
        self.setCursor(Qt.PointingHandCursor)
        super().enterEvent(event) 
Example #24
Source File: mediastream.py    From vidcutter with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, text: str, checkbox: StreamSelectorCheckBox, is_icon: bool=False, parent=None):
        super(StreamSelectorLabel, self).__init__(parent)
        self.checkbox = checkbox
        self.setAttribute(Qt.WA_Hover, True)
        self.setText(text)
        self.setToolTip(self.checkbox.toolTip())
        self.setCursor(Qt.PointingHandCursor)
        if is_icon:
            self.setFixedSize(18, 18)
            self.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        else:
            self.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Fixed) 
Example #25
Source File: mediastream.py    From vidcutter with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, stream_index: int, tooltip: str, parent):
        super(StreamSelectorCheckBox, self).__init__(parent)
        self.parent = parent
        self.setObjectName('streamcheckbox')
        self.setCursor(Qt.PointingHandCursor)
        self.setToolTip(tooltip)
        self.setChecked(self.parent.config[stream_index])
        self.stateChanged.connect(lambda state, index=stream_index: self.updateConfig(index, state == Qt.Checked)) 
Example #26
Source File: settings.py    From vidcutter with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent=None):
        super(LogsPage, self).__init__(parent)
        self.parent = parent
        self.setObjectName('settingslogspage')
        verboseCheckbox = QCheckBox('Enable verbose logging', self)
        verboseCheckbox.setToolTip('Detailed log ouput to log file and console')
        verboseCheckbox.setCursor(Qt.PointingHandCursor)
        verboseCheckbox.setChecked(self.parent.parent.parent.verboseLogs)
        verboseCheckbox.stateChanged.connect(self.setVerboseLogs)
        verboseLabel = QLabel('''
            <b>ON:</b> includes detailed logs from video player (MPV) and backend services
            <br/>
            <b>OFF:</b> includes errors and important messages to log and console
        ''', self)
        verboseLabel.setObjectName('verboselogslabel')
        verboseLabel.setTextFormat(Qt.RichText)
        verboseLabel.setWordWrap(True)
        logsLayout = QVBoxLayout()
        logsLayout.addWidget(verboseCheckbox)
        logsLayout.addWidget(verboseLabel)
        logsGroup = QGroupBox('Logging')
        logsGroup.setLayout(logsLayout)
        mainLayout = QVBoxLayout()
        mainLayout.setSpacing(15)
        mainLayout.addWidget(logsGroup)
        mainLayout.addStretch(1)
        self.setLayout(mainLayout) 
Example #27
Source File: guardarImagen.py    From PyQt5 with MIT License 4 votes vote down vote up
def initUI(self):

      # ==================== WIDGET QLABEL =======================
        
        self.labelImagen = QLabelClickable(self)
        self.labelImagen.setGeometry(15, 15, 168, 180)
        self.labelImagen.setToolTip("Imagen")
        self.labelImagen.setCursor(Qt.PointingHandCursor)

        self.labelImagen.setStyleSheet("QLabel {background-color: white; border: 1px solid "
                                       "#01DFD7; border-radius: 2px;}")
        
        self.labelImagen.setAlignment(Qt.AlignCenter)

      # ==================== WIDGETS QLABEL ======================

        labelNombre = QLabel("Nombre de usuario", self)
        labelNombre.move(193, 15)

      # ================== WIDGETS QLINEEDIT =====================

        self.lineEditNombre = QLineEdit(self)
        self.lineEditNombre.setGeometry(193, 30, 192, 25)

      # ================= WIDGETS QPUSHBUTTON ====================

        buttonSeleccionar = QPushButton("Seleccionar", self)
        buttonSeleccionar.setToolTip("Seleccionar imagen")
        buttonSeleccionar.setCursor(Qt.PointingHandCursor)
        buttonSeleccionar.setGeometry(15, 200, 168, 25)

        buttonBuscar = QPushButton("Buscar", self)
        buttonBuscar.setToolTip("Buscar usuario")
        buttonBuscar.setCursor(Qt.PointingHandCursor)
        buttonBuscar.setGeometry(193, 60, 93, 25)

        buttonGuardar = QPushButton("Guardar", self)
        buttonGuardar.setToolTip("Guardar usuario")
        buttonGuardar.setCursor(Qt.PointingHandCursor)
        buttonGuardar.setGeometry(292, 60, 93, 25)

      # ===================== EVENTO QLABEL ======================

      # Llamar función al hacer clic sobre el label
        self.labelImagen.clicked.connect(self.seleccionarImagen)

      # ================== EVENTOS QPUSHBUTTON ===================

        buttonSeleccionar.clicked.connect(self.seleccionarImagen)
        buttonBuscar.clicked.connect(self.Buscar)
        buttonGuardar.clicked.connect(self.Guardar)
     

  # ======================= FUNCIONES ============================ 
Example #28
Source File: guardarImagen.py    From PyQt5 with MIT License 4 votes vote down vote up
def initUI(self):

      # ==================== WIDGET QLABEL =======================
        
        self.labelImagen = QLabelClickable(self)
        self.labelImagen.setGeometry(15, 15, 168, 180)
        self.labelImagen.setToolTip("Imagen")
        self.labelImagen.setCursor(Qt.PointingHandCursor)

        self.labelImagen.setStyleSheet("QLabel {background-color: white; border: 1px solid "
                                       "#01DFD7; border-radius: 2px;}")
        
        self.labelImagen.setAlignment(Qt.AlignCenter)

      # ==================== WIDGETS QLABEL ======================

        labelNombre = QLabel("Nombre de usuario", self)
        labelNombre.move(193, 15)

      # ================== WIDGETS QLINEEDIT =====================

        self.lineEditNombre = QLineEdit(self)
        self.lineEditNombre.setGeometry(193, 30, 192, 25)

      # ================= WIDGETS QPUSHBUTTON ====================

        buttonSeleccionar = QPushButton("Seleccionar", self)
        buttonSeleccionar.setToolTip("Seleccionar imagen")
        buttonSeleccionar.setCursor(Qt.PointingHandCursor)
        buttonSeleccionar.setGeometry(15, 200, 168, 25)

        buttonBuscar = QPushButton("Buscar", self)
        buttonBuscar.setToolTip("Buscar usuario")
        buttonBuscar.setCursor(Qt.PointingHandCursor)
        buttonBuscar.setGeometry(193, 60, 93, 25)

        buttonGuardar = QPushButton("Guardar", self)
        buttonGuardar.setToolTip("Guardar usuario")
        buttonGuardar.setCursor(Qt.PointingHandCursor)
        buttonGuardar.setGeometry(292, 60, 93, 25)

      # ===================== EVENTO QLABEL ======================

      # Llamar función al hacer clic sobre el label
        self.labelImagen.clicked.connect(self.seleccionarImagen)

      # ================== EVENTOS QPUSHBUTTON ===================

        buttonSeleccionar.clicked.connect(self.seleccionarImagen)
        buttonBuscar.clicked.connect(self.Buscar)
        buttonGuardar.clicked.connect(self.Guardar)
     

  # ======================= FUNCIONES ============================ 
Example #29
Source File: recuperarImagen.py    From PyQt5 with MIT License 4 votes vote down vote up
def initUI(self):

      # ==================== WIDGET QLABEL =======================
        
        self.labelImagen = QLabelClickable(self)
        self.labelImagen.setGeometry(15, 15, 168, 180)
        self.labelImagen.setToolTip("Imagen")
        self.labelImagen.setCursor(Qt.PointingHandCursor)

        self.labelImagen.setStyleSheet("QLabel {background-color: white; border: 1px solid "
                                       "#01DFD7; border-radius: 2px;}")
        
        self.labelImagen.setAlignment(Qt.AlignCenter)

      # ==================== WIDGETS QLABEL ======================

        labelNombre = QLabel("Nombre de usuario", self)
        labelNombre.move(193, 15)

      # ================== WIDGETS QLINEEDIT =====================

        self.lineEditNombre = QLineEdit(self)
        self.lineEditNombre.setGeometry(193, 30, 192, 25)

      # ================= WIDGETS QPUSHBUTTON ====================

        buttonSeleccionar = QPushButton("Seleccionar", self)
        buttonSeleccionar.setToolTip("Seleccionar imagen")
        buttonSeleccionar.setCursor(Qt.PointingHandCursor)
        buttonSeleccionar.setGeometry(15, 200, 168, 25)

        buttonBuscar = QPushButton("Buscar", self)
        buttonBuscar.setToolTip("Buscar usuario")
        buttonBuscar.setCursor(Qt.PointingHandCursor)
        buttonBuscar.setGeometry(193, 60, 93, 25)

        buttonGuardar = QPushButton("Guardar", self)
        buttonGuardar.setToolTip("Guardar usuario")
        buttonGuardar.setCursor(Qt.PointingHandCursor)
        buttonGuardar.setGeometry(292, 60, 93, 25)

      # ===================== EVENTO QLABEL ======================

      # Llamar función al hacer clic sobre el label
        self.labelImagen.clicked.connect(self.seleccionarImagen)

      # ================== EVENTOS QPUSHBUTTON ===================

        buttonSeleccionar.clicked.connect(self.seleccionarImagen)
        buttonBuscar.clicked.connect(self.Buscar)
        buttonGuardar.clicked.connect(self.Guardar)
     

  # ======================= FUNCIONES ============================ 
Example #30
Source File: CPaginationBar.py    From CustomWidgets with GNU General Public License v3.0 4 votes vote down vote up
def _calculate(self):
        """重新计算并更新按钮
        """
        if self.totalPages > self.totalButtons:
            button1 = False
            button5 = False
            if self.currentPage - 1 > 3:
                button1 = True
                self._updateButton(1, -2)
            else:
                self._updateButton(1, 2)
                self._updateButton(2, 3)
                self._updateButton(3, 4)
                self._updateButton(4, 5)

            if self.totalPages - self.currentPage > 3:
                button5 = True
                self._updateButton(5, -1)
            else:
                self._updateButton(2, self.totalPages - 4)
                self._updateButton(3, self.totalPages - 3)
                self._updateButton(4, self.totalPages - 2)
                self._updateButton(5, self.totalPages - 1)

            if button1 and button5:
                self._updateButton(2, self.currentPage - 1)
                self._updateButton(3, self.currentPage)
                self._updateButton(4, self.currentPage + 1)

        for button in self._buttons:
            page = button.property('page')
            button.setEnabled(self.currentPage != page)
            button.setCursor(
                Qt.PointingHandCursor if button.isEnabled() else Qt.ArrowCursor)

        self.buttonPrevious.setEnabled(self.currentPage > 1)
        self.buttonNext.setEnabled(self.currentPage < self.totalPages)

        # 这里ForbiddenCursor不会生效,这可能是一个Bug,当按钮不可用时忽略了鼠标样式
        self.buttonPrevious.setCursor(
            Qt.PointingHandCursor if self.buttonPrevious.isEnabled() else Qt.ForbiddenCursor)
        self.buttonNext.setCursor(
            Qt.PointingHandCursor if self.buttonNext.isEnabled() else Qt.ForbiddenCursor)