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

How to get Reference of UI QPushButton runtime

Any one idea how to get reference of QPushButton defined in QT .ui file. We can create button QPushButton btnOK = new QPushButton("OK", this); this I know. But how can I link it with button reference in .ui file. Any suggestion!
CoDe
  • 11,056
  • 14
  • 90
  • 197
0
votes
1 answer

PySide: Create popup based on location of button and window's edge

I'd like to create a popup at the position of a clicked button and also offset that popup along the left edge of the existing window. Right now I'm getting the position of the button fine, but it seems that the position of the window is off a little…
Mike Bourbeau
  • 481
  • 11
  • 29
0
votes
2 answers

connect QPushButton and QComboBox

How can I connect a QPushButton and a QComboBox? I created a SLOT that accepts 2 parameters, a pointer to the QComboBox and the index of the selected item: void modificaExp::eliminaExp(QComboBox *combo,int value) { ...... …
ale666
  • 17
  • 1
0
votes
1 answer

Qt - I have a QPushButton QVector, which one was pressed?

I have QLineEdits and QCheckBoxes QVectors - I also have a QPushButton QVector which when an element is pressed, the corresponding QLineEdit and QCheckBox are also removed. How can I find out which button was pressed to determine which index to…
0
votes
1 answer

Same style for QPushButton and QToolButton during mouse-over

Is it possible to make QPushButton and QToolButton look identical during mouse-over, i.e. the look and feel for hover events? I don't use custom stylesheets, but there is a global application setting: QtGui.QApplication.setStyle("plastique") I'm…
0
votes
1 answer

How to associate the selected item of Combobox to write into a file

Basically I have a line-edit box which take the user input such as comma separated values and on clicking the push-button it write all the values of line-edit box to a text file. But same feature I want to achieve through combobox. So whenever one…
Chinmoy
  • 493
  • 1
  • 5
  • 16
0
votes
1 answer

QPushButton dimensions change when Stylesheet is apllied

When I apply a style sheet on QPushButton its dimensions change. This is my style sheet declaration. QPushButton { background-color: rgb(175, 187, 199); color: black; border-width: 1px; border-top: 1px solid white; border-left: 1px…
user1371961
  • 271
  • 1
  • 2
  • 14
0
votes
1 answer

PyQt: display QPushButton that looks like the down-arrow button in QComboBox

In PyQt4, I want to present a QPushButton that looks like the down-arrow button in QComboBox. Feasible, and if so, how? I don't need help getting my new widget-combination acting like a QComboBox (see below). I only want the QPushButton…
Johnny Utahh
  • 2,389
  • 3
  • 25
  • 41
0
votes
1 answer

QMainwindow doesn't show when I clicked a qpushbutton into a QWidget

I have a QWidget (login form) and QMainWindow(main form). the problem is when I clicked a qpushbutton into the qwidget the QmainWindow should appear, but It doesn't. class Ui_frmInicial(QWidget): def __init__(self): …
GSandro_Strongs
  • 773
  • 3
  • 11
  • 24
0
votes
1 answer

deleting a parent widget through a child QPushButton pyqt

It's been a while I'm searching all over the internet for that, but still couldn't get the answer... basically I have a QVBoxLayout which contains several frames - and each frame contains a button which function is to delete its parent frame. The…
0
votes
1 answer

Incompatible Sender/ Receiver arguments

I want to write a Signalmapper. It should connect a button to a function. This function should get the clicked Qpushbutton itself. void StrategicWidget::addTransporterImages(int i,unsigned int numberTransporters) { Planet* p =…
ansanders
  • 7
  • 1
  • 9
0
votes
2 answers

Qt disabling dynamic buttons

I am trying to disable button previously chosen by user void pracownik2::on_pushButton_4_clicked(){ this->setWindowTitle("EKRAN"); QWidget *centralWidget = new QWidget; int licznik=1; QString licz; //QString kolumny =…
CentusDBWA
  • 11
  • 4
0
votes
1 answer

Qt couting checked buttons made dynamically

I am trying to count how many buttons have been checked void pracownik2::on_pushButton_4_clicked() { this->setWindowTitle("EKRAN"); QWidget *centralWidget = new QWidget; int licznik=1; QString licz; …
CentusDBWA
  • 11
  • 4
0
votes
0 answers

Qt click button causes crash

Everytime i click my QPushButton which I have added with the UI Designer, the button stays clicked and the application crashes. When I remove the slot which the 'clicked()' signal of the button is connected to, I can click the button and the…
0
votes
1 answer

Qt C++, action on clicking QPushButton made dynamically

In one of my windows I made a button responsible for creating dynamic array of buttons. After they are made I can't make 'anul' button close the window Here's the code QWidget *centralWidget = new QWidget; int licznik=1; QString…
CentusDBWA
  • 11
  • 4