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

Python how to proof a boolean expression in a loop and cancel loop when button clicked

Hello i have a Python program with a function "startAutomation" and inside this funtion i have the loop: for i,j in zip(int_datadelta, int_timedelta): Att1.SetAttenuation(i) # Set attenuation print('Set Attenuation: ',i) lcd.display(i) …
Rafa
  • 31
  • 1
3
votes
3 answers

PySide: QPushButton stays highlighted after pressing it

In my tool, when the user pushes a button a popup window is created. My issue is that the button that the user presses to bring up the window stays highlighted (as if I have my mouse over it) on popup creation and remains that way even after the…
Mike Bourbeau
  • 481
  • 11
  • 29
3
votes
5 answers

How to add a button with image and transparent background to QVideoWidget?

I created a pushbutton in front of a video (use QVideoWidget and QMediaPlayer). I am using an image with a transparent background to set image button. How can I set a QPushbutton to be transparent, but the image inside to be visible? I have tried…
vee sivee
  • 53
  • 1
  • 1
  • 10
3
votes
2 answers

Qt keyPressEvent, "Hold", and keyReleaseEvent Handling with Buttons/Mouse Clicks

I am writing a Qt program to simulate a piece of hardware and I would like to simulate button press, hold, and release events. In my application, I'd like to handle input from both the keyboard and mouse clicks to make things convenient to the user…
GrandAdmiral
  • 1,348
  • 2
  • 24
  • 52
3
votes
2 answers

Tagging Qt Widgets

Is it possible to tag Qt Widgets? I am generating QPushButtons programmatically and as far as I know, there is no way to differentiate them. I checked the documentation and couldn't find anything. What would be an alternative? for(int i = 0; i <…
Tim Tuffley
  • 605
  • 1
  • 6
  • 20
3
votes
1 answer

Qt : icon messing the width of QPushButton - Adjusting icon

I currently use the following style-sheet property for a dynamically created QPushButton string mystyle = "QPushButton { border: 1px solid #8f8f91; border-radius: 1px; min-width: 90px; min-height: 18px;}" The QPushButton also has an icon next to…
MistyD
  • 16,373
  • 40
  • 138
  • 240
3
votes
2 answers

How to tell when a QPushButton is clicked in a QButtonGroup

In my project, I have 40 QPushButtons all put into a QButtonGroup like this: QButtonGroup* group = new…
mrg95
  • 2,371
  • 11
  • 46
  • 89
3
votes
0 answers

How to set Qt pushbutton like this

I try to write a simple Player with Qt. I try to set Play button look like this Use stylesheet or use a QPixmap like a button. My code is playCtrl = new…
midCat
  • 123
  • 4
  • 13
3
votes
3 answers

Qt - Connected but doesn't work

I have problem with one class in my project, after click appears new window with QTableWidget and QPushButton, after clicking the button I should have "test" on stdout, but nothing shows, here are parts of this code: Header: class ClientsSelector :…
agilob
  • 6,082
  • 3
  • 33
  • 49
3
votes
2 answers

Qt- How to display the Text Edit String in a List View?

I have a QTextEdit , 2 QPushButtons (Add n Remove Buttons) and a QListView. When i am entering the text in the Text Edit and click the Add Button, the Text should be added in the List View. Then, if I select any one of the added text from the List…
New Moon
  • 787
  • 6
  • 21
  • 35
3
votes
1 answer

Touch screen Qt Application

I am developing a application with Qt. I have a push button and I'm using signal/slot for setting a different text. The problem is that I want to use it with touch screen. I have the coordinates when I touch the screen. So far I can change the text…
Hanelore Ianoseck
  • 594
  • 1
  • 5
  • 12
3
votes
1 answer

how can I keep a QPushbutton selected and then find what is selected in a grid of buttons (pyQt)

#!!/usr/bin/python # Qt modules from PyQt4 import QtCore, QtGui import sys class gui(QtGui.QDialog): def __init__(self, parent=None): QtGui.QDialog.__init__(self, parent) self.setWindowTitle('Grid of buttons') …
user1571144
  • 825
  • 1
  • 7
  • 5
2
votes
1 answer

Qt Python - in a list of buttons change color of all buttons up until the one that was clicked

I have a list of Qt buttons like this: self.buttons = [button1, button2, button3] When one is clicked, I want all the buttons that come before the one that was clicked in the list to change their colors. I made a for loop to loop through the buttons…
2
votes
1 answer

QT widgets, rounded selected corner only

I can set a QT QPushButton to rounded button by setting "border-radius" in style sheet, however i just want to set only the right edge (top and bottom right) corner of the button to rounded. How to do it?
curiousJorgeXX
  • 363
  • 1
  • 10
2
votes
1 answer

Would it be possible to create a class using elements from PYQT5

I am attempting to create a GUI keyboard. I am using QPushButton to replicate the keys. I am not focusing on linking it to MIDI yet. However, I was wondering if it is possible to create a Class using properties of QPushButton. By that I mean…