qpushbutton

How to make QPushButton not to be triggered by Enter keyboard key

此生再无相见时 提交于 2020-06-27 03:49:26
问题 The code below creates a single dialog window with 5 buttons. Each button is connected to onClick function. If I hit 'Enter' keyboard key one of the buttons is triggered and it onClick function is executed. How to change the buttons properties so the buttons call for onClick function only when they are clicked and do not respond to Enter keyboard key? from PyQt4 import QtGui def onClick(): print 'button clicked' dialog = QtGui.QDialog() dialog.setLayout(QtGui.QVBoxLayout()) for i in range(5):

How to use TAB Key to focus one of two qpushbutton

天涯浪子 提交于 2020-04-16 06:44:38
问题 In a widget I put two QPushButton (let's say "OK" at left and "EXIT" at right). They regularly work when I press them using the mouse. Suppose I want to switch from one to the other using TAB key: is it possible? And how can do this? 回答1: On some platforms, keyboard focus navigation among buttons is a default behavior, but on some it isn't. If you wish keyboard navigation on all platforms, the buttons should have a Qt::StrongFocus policy set on them. Note that the shortcut used to trigger the

How to use TAB Key to focus one of two qpushbutton

天涯浪子 提交于 2020-04-16 06:44:24
问题 In a widget I put two QPushButton (let's say "OK" at left and "EXIT" at right). They regularly work when I press them using the mouse. Suppose I want to switch from one to the other using TAB key: is it possible? And how can do this? 回答1: On some platforms, keyboard focus navigation among buttons is a default behavior, but on some it isn't. If you wish keyboard navigation on all platforms, the buttons should have a Qt::StrongFocus policy set on them. Note that the shortcut used to trigger the

How to use TAB Key to focus one of two qpushbutton

倖福魔咒の 提交于 2020-04-16 06:44:03
问题 In a widget I put two QPushButton (let's say "OK" at left and "EXIT" at right). They regularly work when I press them using the mouse. Suppose I want to switch from one to the other using TAB key: is it possible? And how can do this? 回答1: On some platforms, keyboard focus navigation among buttons is a default behavior, but on some it isn't. If you wish keyboard navigation on all platforms, the buttons should have a Qt::StrongFocus policy set on them. Note that the shortcut used to trigger the

How to set animated icon to QPushButton in Qt5?

佐手、 提交于 2020-02-17 07:44:28
问题 QPushButton can have icon, but I need to set animated icon to it. How to do this? I created new class implemented from QPushButton but how to replace icon from QIcon to QMovie ? 回答1: This can be accomplished without subclassing QPushButton by simply using the signal / slot mechanism of Qt. Connect the frameChanged signal of QMovie to a custom slot in the class that contains this QPushButton . This function will apply the current frame of the QMovie as the icon of the QPushButton . It should

PyQt Button Selection

本秂侑毒 提交于 2020-01-30 01:39:34
问题 I have a PyQt GUI set up that has a selection of QPushButtons and a QLineEdit text box (among other things). The text box is set up so as to call a function upon returnPressed(). My problem is that when I click on the text box and put in text, one of the buttons becomes selected which means that when I press enter in the text box it activates both the button and the text box function. Is there a way around this? Some way to stop any buttons from being selected while the text box is being

QPushButton not blinking

时间秒杀一切 提交于 2020-01-17 16:39:40
问题 Inspired by Label on QToolBar, possible? I'm trying to develop it. But my button do not blink on click, why? I see in the other app looks like the button color gets gray during the click (while pressed) and the normal button gets blue. But my button which is just all an image don't have any behavior during the click. On the left side is the toolbar using QAction (question linked above) and on the right side is the code below. QApplication a(argc, argv); QMainWindow w; QToolBar barA; barA

PySide: How Could I trigger the current clicked QPushbutton, not other later added

南笙酒味 提交于 2020-01-13 07:12:32
问题 I am new to PySide. In my program, I encountered a problem that when I click one button, it triggers other button later added. Thanks! self.addContentButton = QtGui.QPushButton('Add') self.addContentButton.clicked.connect(self.addContent) def addContent(self): ''' slot to add a row that include a lineedit, combobox, two buttons ''' self.contentTabHBoxWdgt = QtGui.QWidget() self.contentName = QtGui.QLineEdit('line edit') self.conetentTypeBox = QtGui.QComboBox() self.conetentTypeBox.addItem(

qt how to know that a pushbutton is clicked?

大兔子大兔子 提交于 2020-01-13 05:36:07
问题 I'm trying to do a program which makes some operations with sounds. My question is that I have 3 Play pushbutton and 3 label. I want that whichever I click on the Play button, the sound whose name is in the label that is near the pushbutton should play. I have a play slot without any parameter. So, how can I connect to every play button with every label respectively? Actually, I can write 3 different play function, but since I have some other functions, it will be too long and confusing. Also