qtoolbutton

PyQt QToolButton not updating icon when in focus

删除回忆录丶 提交于 2021-02-02 10:12:08
问题 I'm having a problem updating the icon of a button set with QToolButton . The idea is to use the button for a movie player. To play, one presses the button and the icon changes to pause. When pressed again, play is paused and the icon reverts to play. I have some working code, but the problem is that the icon is not updating consistently. If I keep the Qt window in focus, it takes one or two button presses to change the icon to the intended image, by which time the actual image is not the

PyQt QToolButton not updating icon when in focus

二次信任 提交于 2021-02-02 10:03:55
问题 I'm having a problem updating the icon of a button set with QToolButton . The idea is to use the button for a movie player. To play, one presses the button and the icon changes to pause. When pressed again, play is paused and the icon reverts to play. I have some working code, but the problem is that the icon is not updating consistently. If I keep the Qt window in focus, it takes one or two button presses to change the icon to the intended image, by which time the actual image is not the

PyQt QToolButton not updating icon when in focus

别等时光非礼了梦想. 提交于 2021-02-02 10:03:34
问题 I'm having a problem updating the icon of a button set with QToolButton . The idea is to use the button for a movie player. To play, one presses the button and the icon changes to pause. When pressed again, play is paused and the icon reverts to play. I have some working code, but the problem is that the icon is not updating consistently. If I keep the Qt window in focus, it takes one or two button presses to change the icon to the intended image, by which time the actual image is not the

PyQt QToolButton not updating icon when in focus

孤者浪人 提交于 2021-02-02 10:03:02
问题 I'm having a problem updating the icon of a button set with QToolButton . The idea is to use the button for a movie player. To play, one presses the button and the icon changes to pause. When pressed again, play is paused and the icon reverts to play. I have some working code, but the problem is that the icon is not updating consistently. If I keep the Qt window in focus, it takes one or two button presses to change the icon to the intended image, by which time the actual image is not the

How to insert a button inside a QLineEdit

人盡茶涼 提交于 2019-12-17 18:47:15
问题 I need help inserting a button inside in a QLineEdit that can call a function. For example, like this google image: 回答1: Below is a nearly direct translation of the Qt code from here. Differences: button is always visible clicking on the button emits buttonClicked(bool) signal Code: from PyQt4 import QtGui, QtCore class ButtonLineEdit(QtGui.QLineEdit): buttonClicked = QtCore.pyqtSignal(bool) def __init__(self, icon_file, parent=None): super(ButtonLineEdit, self).__init__(parent) self.button =

Python Create a real circle button in pyqt5

本小妞迷上赌 提交于 2019-12-01 12:23:25
I try to create a circle button but in fact pyqt still creates a square button.All examples found just creates square buttons and put a round image in it but still when i try to hide background of the button it fails.I also try to add some hover function but this should work afterwords so you can skip it.My code is here: from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5.QtWidgets import QAction from PyQt5.QtGui import QPalette # from video import VideoWindow import sys class HoverButton(QtWidgets.QToolButton): def __init__(self, parent=None): super(HoverButton, self).__init__(parent) self

Python Create a real circle button in pyqt5

青春壹個敷衍的年華 提交于 2019-12-01 11:12:19
问题 I try to create a circle button but in fact pyqt still creates a square button.All examples found just creates square buttons and put a round image in it but still when i try to hide background of the button it fails.I also try to add some hover function but this should work afterwords so you can skip it.My code is here: from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5.QtWidgets import QAction from PyQt5.QtGui import QPalette # from video import VideoWindow import sys class HoverButton

How to insert a button inside a QLineEdit

好久不见. 提交于 2019-11-28 10:30:37
I need help inserting a button inside in a QLineEdit that can call a function. For example, like this google image: Avaris Below is a nearly direct translation of the Qt code from here . Differences: button is always visible clicking on the button emits buttonClicked(bool) signal Code: from PyQt4 import QtGui, QtCore class ButtonLineEdit(QtGui.QLineEdit): buttonClicked = QtCore.pyqtSignal(bool) def __init__(self, icon_file, parent=None): super(ButtonLineEdit, self).__init__(parent) self.button = QtGui.QToolButton(self) self.button.setIcon(QtGui.QIcon(icon_file)) self.button.setStyleSheet(