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
3
votes
1 answer

Link a pushbutton to run a .py file

What I want to do is to be able to open grid.py by clicking on the button on main.py. Preferably by keeping the same structure (ui file and the main and grid python files). Thank you, So, I've created a simple UI interface that contains only a push…
Creek Barbara
  • 637
  • 1
  • 7
  • 29
3
votes
1 answer

qpushbutton icon left alignment text center alignment

I can not correctly align icons and button texts. I have generate the app gui with Designer, by default they appear like this: I add some code, win.pb_ejecutar.setStyleSheet("QPushButton { text-align: left; }") And I've got this but what I need…
Josse
  • 33
  • 1
  • 7
3
votes
1 answer

How to create a vertical (rotated) button in Qt with C++

I'd like to create a vertical button in Qt (using C++, not Python), with text rotated 90º either clockwise or counterclockwise. It doesn't seem to be possible with a standard QPushButton. How could I do it?
José Tomás Tocino
  • 9,873
  • 5
  • 44
  • 78
3
votes
1 answer

Making A QPushButton round C++

I'm trying a code to make a QPushButton looking round , this code seems to be working, but after execution , it show me only the half of the ellipse, can anybody help me to figure out why is show only the half of it, its about the m_bouton1 ? I did…
3
votes
0 answers

How to make circle shape QToolButton with outside border?

I have implemented some circle shape QToolButtons using stylesheets; everything is working fine, except that I haven't found a way to add an outside border instead. At the moment QT only supports CSS 2 meaning that I'm not able to use the box-shadow…
3
votes
1 answer

Creating PyQt5 buttons in a loop: all buttons trigger the same callback

I should mention that I've read these but I'm still unable to achieve my goal: [Using a dictionary in a for loop to create buttons doesn't work [QtCore.QObject.connect in a loop only affects the last instance My goal is to make a linux 'launcher'…
tscv11
  • 55
  • 1
  • 7
3
votes
2 answers

QTableView doesn't update edited cell when button is clicked

I am using a QTableView as a row input method: user fills the fields and then clicks on "Carica" button to perform the insertion (he's not supposed to full fill the entire row). Suppose the user inserts (as in the image) the first field and then…
Francesco Pegoraro
  • 778
  • 13
  • 33
3
votes
1 answer

When a QPushButton is clicked, it fires twice

I used PyQt5 for a project and have the following snippet (button is a QPushButton) def on_receive(self, query): print("receiving", query) datapackages = json.loads(query) for button, datapackage in zip(self.buttonArray, datapackages): …
Narusan
  • 482
  • 1
  • 5
  • 18
3
votes
3 answers

Qt table widget, button to delete row

I have a QTableWidget and for all rows I set a setCellWidget at one column to a button. I would like to connect this button to a function that delets this row. I tried this code, which does not work, because if I simply click my button I do not…
user7431005
  • 3,899
  • 4
  • 22
  • 49
3
votes
1 answer

How to implement a tri state button using Qt

I need to create a button which has three states: unclicked intermediate clicked The logic I want to implement with this button is that whenever this button is clicked, I want the system to go to the intermediate state and wait for an event. In…
lferasu
  • 185
  • 2
  • 10
3
votes
1 answer

Adding function to button Using Pyqt5

I am new to using QT designer and PYQT5 and I am having issues with adding a function to the add to cart button I have made on the GUI. The button is suppose to take the style from the dropdown box , the name , the color and the size of the item and…
Negus
  • 41
  • 1
  • 4
3
votes
2 answers

Qt Stylesheets : Unable to use ID Selector

I am learning to use the Qt Stylesheet to add different styles to my application. I looked online and saw the Qt Documentation which said that you can use something called ID Selector that can apply the theme to certain objects. This is how I…
Hung Truong
  • 401
  • 1
  • 3
  • 12
3
votes
1 answer

Accessing dynamically created buttons in PyQT5

Sirs. I have pretty much simple PyQT5 app. I have dynamically created buttons and connected to some function. class App(QWidget): ... def createButtons(self): ... for param in params: …
3
votes
1 answer

Qt - Pushbutton click not always working

I have a QT App and have currently added a new QPushButton. I have connected the button properly with: QObject::connect(ui->myButton, SIGNAL(clicked()), this, SLOT(SendResetEchoRequest())); Most of the time it is working when i click it calls the…
Ingo Holder
  • 37
  • 1
  • 5
3
votes
1 answer

Change The background color of a QPushButton progressively and in a time duration?

I am tired of searching ! i subclassed a Button from QPushbutton and set my QSS to it.the style is desired. all i want is when the button is hover (enterevent happen) the button's color change over a specific time (for example 0.2 sec) not…
IMAN4K
  • 1,265
  • 3
  • 24
  • 42