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 connect a QPushButton to a function

I want to create a simple program with a PyQt GUI. For this I used Qt Designer, and I made a window with a push-button named OpenImage. Moreover, I have a file named rony.py that has a function show. So I want that when the user clicks the button,…
0
votes
1 answer

Changing fluently brightness of QPushButton icon

I found a function to make QImage brighter and used in my Qt application. I want to show simple "animation" of making button step by step brighter and than again step by step back to initial state after user click it. Here my code: void…
WJuz
  • 37
  • 1
  • 6
0
votes
1 answer

Signal to it's own instance doesn't work

I connected the clicked(bool) event from QPushButton to a private slot mySlot() of my own Widget. But the slot is never called (I placed a breakpoint in mySlot()). I'm using c++ and Qt5. I wrote a minimal version of my code: MyLayout.h class…
Felix
  • 105
  • 1
  • 7
0
votes
1 answer

Qt QSpinbox and QPushButton to Arduino

I am a new leaner of Qt. Here's the project I am doing right now, I would like to adjust the LED luminosity from Qt's GUI. All I need are the QSpinBox to enter the value of luminosity(0~255) and the QPushButton to confirm the value and send this…
0
votes
0 answers

Gradient across column of QPushButtons

I have a column of 4 QPushButtons which change their background colour when they are selected. They should all be the same colour - The stylesheet code is the same for the each of them; ui->button1->setStyleSheet("QPushButton { background: rgb(225,…
easty
  • 35
  • 6
0
votes
1 answer

Unexpected behavior on QWidget while the event filtering

Just i've tested the following codes on QPushButton and on QWidget and i've encountered with different behaviors. But why? MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) , ui(new Ui::MainWindow) { ui->setupUi(this); …
user5255670
0
votes
0 answers

Make a ComboBox by clicking on a pushButton

I want to create a combo box by clicking on a push button. class Ui_Dialog(object): def setupUi(self, Dialog): self.Dialog=Dialog self.Dialog.setObjectName(_fromUtf8("Dialog")) self.Dialog.resize(681, 408) …
Hamid
  • 13
  • 4
0
votes
0 answers

Qt: Morph-ing QPushButton into QCommandLinkButton makes related icon to be partially displayed

I am using Qt5 on Windows 7. In my current app I had a QPushButton with an icon on it, some sort of speaker icon, like presented below: So far so good, but I wanted the above push-button to be morph-ed into a QCommandLinkButton, as it has a very…
סטנלי גרונן
  • 2,917
  • 23
  • 46
  • 68
0
votes
1 answer

How to click multiple times on QRadioButton but only run function once?

I have 2 radio buttons. The first one, radio1, is connected to a function func() and inside this function connects a push button, pushButton, to another function print_me(). This is the code stripped down: radio =…
Joseph
  • 586
  • 1
  • 13
  • 32
0
votes
3 answers

Turkish character in QPushButton text

I am using Qt 4.8.6 with vs2010. I create a form and inserted QPushbutton with text "İleri". It is Ok when program starts. After I change text in code: ui.btSenaryoIleri->setText("İleri"); it becomes Yleri. Should I change some settings in code?
mucisk
  • 247
  • 5
  • 13
0
votes
1 answer

PyQt5 mousetracking not working

I've found an example that changing a QPushButton's icon when mouse is hover on it. I tried to convert it to my codes, but there are some problems. First check the example I found, it's really short. http://paste.ubuntu.com/17302717/ These codes…
GLHF
  • 3,835
  • 10
  • 38
  • 83
0
votes
2 answers

Connecting QPushButon to a method in another class in PyQt

I am trying to connect a QPushButton created in class A with a method created in class B . This is my code: class A(QMainWindow): def __init__(self): super(QMainWindow, self).__init__() #A lot of stuff in here def Button(self): …
Pablo Flores
  • 667
  • 1
  • 13
  • 33
0
votes
2 answers

Qt Button Focus

I got any visible focus on buttons in Qt while press Tab key. I was unchecked the auto default & default property of push buttons. Help me to solve this. Thanks in advance !
0
votes
0 answers

Highlight / Focus Color QCheckbox, QRadiobutton, QPushbutton

at the moment I am "playing" with C++ QT and Stylesheets. Normally I found everything in the documenttion, but unfortunatly the following problem not: ExamplePic In the example Picture you'll see my edited QPushButtons, QChecksBoxes and…
ThW
  • 11
  • 1
0
votes
1 answer

QPushButton background color dynamically

I have a QPushButton on which I would like to set the background color. I can use stylesheets for this: m_iconButton->setStyleSheet("QPushButton {" "background-color: red " "}"); However I…
Frank
  • 2,446
  • 7
  • 33
  • 67