Questions tagged [qpushbutton]

QPushButton is a Qt library class that represents ordinary push buttons, and gives the API to manipulate them.

QPushButton offers a set of functions to manipulate the button's appearance and behavior.

A minimalistic QPushButton example will look like this:

#include <QtGui>
#include <QApplication>

int main(int argc, char *argv[])
{
    QApplication a( argc, argv );
    QPushButton * myButton = new QPushButton("Hello, World!");
    myButton->show();
    return a.exec();
}

One of QPushButton's most notable properties is Checkable, which can be accessed via setCheckable( bool ) function. If this option is set to true, the QPushButton becomes a toggle button which can be toggles on and off, and will stay in the corresponding state until toggled again.

The official Qt documentation can be found here for Qt 4.8 and here for Qt 5.

631 questions
2
votes
1 answer

Align icon on the right and center the text in a QPushButton

I'm trying to align the icon to the right and center the text in a QPushButton, but I'm not satisfied with the result for now. I would also like the icon to be completely to the right of the QPushButton and not centered with the text. Likewise I…
ekdmekdm
  • 171
  • 1
  • 9
2
votes
1 answer

change color PNG Image QPushbutton

I tried to change a color of my PNG image after set its color by QtWidgets.QColorDialog. with Python ---> to Nevertheless, when I apply my code the result is : It change the background of my PNG image The png source is here: DMX_Led I write…
2
votes
1 answer

Pyqt5 List QtPushbutton add border-image

I'm using Python 3 ( Pycharm ) with Pyqt5 (Windows 10) I need to use a list of QPushbutton. I managed to change the color of button, it's ok. Nevertheless, I couldn't change the image of border-image (same QT), into my function to add button…
2
votes
2 answers

How to set Stylesheet for only one side of border in QLineEdit and QPushButton?

I tried to create a combo box manually. So a line edit should be combined with a (dropdown) push button. Therefore I want to hide the right border of line edit and left border of push button. I tried with…
trangan
  • 341
  • 8
  • 22
2
votes
1 answer

PyQt5: Maintain previously drawn drawings/line when new ones are drawn

I am having trouble maintaining previously drawn lines after I draw a new line. Right now if I click one button it will draw a line but once I click the second button a new line is drawn and the initial one is removed. I would like that both…
riyadude
  • 337
  • 6
  • 18
2
votes
1 answer

PyQt5: How to open a new Dialog with button click

import sys from PyQt5.QtCore import pyqtSlot from PyQt5.QtWidgets import QApplication, QDialog from PyQt5.uic import loadUi class LoginPage(QDialog): def __init__(self): super(LoginPage, self).__init__() loadUi('LoginPage.ui',…
Renegade
  • 75
  • 1
  • 1
  • 9
2
votes
1 answer

Create a 2-line (not wrap) QPushButton

I must create a QPushButton that contains an icon and 2 lines of text. Ideally I should be able to put the icon either on the left side (on one design) or in the center, above the text (for another design in another view). The 2 lines of text I need…
Thalia
  • 13,637
  • 22
  • 96
  • 190
2
votes
2 answers

QPushButton with transparent background

How to do transparent background in QPushButton? I have a background picture and I want to make the button transparent. I tried to use: reg_screen_var.new_account.setStyleSheet("QPushButton {color: #F6F6F6; background:…
geneus
  • 21
  • 1
  • 3
2
votes
1 answer

How to disable/enable button based on selection from `Qtableview`

I have a QTableView and a button. When the row is selected from QTableView I want button to enable and if the row is not selected then it should disable. can anyone tell how doing it
Chaya
  • 137
  • 11
2
votes
1 answer

Draw QFrame around QPushButton PyQt5

I am unable to get a QFrame to completely surround a QPushButton Like a Border. It only frames the top and left side of the button. I was wondering what I'm doing wrong with the frame. import sys from PyQt5.QtGui import * from PyQt5.QtWidgets…
Austin Russell
  • 417
  • 4
  • 17
2
votes
1 answer

How to make background of cell widget inside QTableWidget not selectable?

The answer https://stackoverflow.com/a/24909605/3125006 shows how to add a QPushButton into a QTableWidget cell. This works perfectly. But then the background area around the PushButton is selectable. (Background turns into selection color when…
Codev
  • 1,040
  • 2
  • 14
  • 31
2
votes
2 answers

PyQt5 GUI runs with no errors but window doesn't appear

The problem is that when I run the PyQt5 GUI after adding resource file and adding PushButtons with border-images on them, mainwindow does not launch and no errors either. I converted the main window UI to Python with following command: pyuic5…
Luis Martinez
  • 45
  • 1
  • 8
2
votes
0 answers

Creating and accessing buttons dynamically PyQt5

I want to create buttons after some processing according to the results, and I want them to be clickable. Here's what I tried : for action in actions: name = action[2] button = QPushButton(name, self.timelineFrame) dir =…
Hall
  • 29
  • 2
2
votes
1 answer

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

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…
alphanumeric
  • 17,967
  • 64
  • 244
  • 392
2
votes
1 answer

PyQt Localization: Translating a text through QPushButton w/ use of .po file

So I've tried researching for solutions for this what-seem-to-be simple question I have but to my surprise, I could not find anything about it. Anyway, I would like to translate a specific text from English to Irish and vice versa when the specific…
madLad
  • 155
  • 1
  • 2
  • 11