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

Subclassing of QPushButton

I've been looking for a way of subclassing QPushButton, so I can connect 'clicked' signal when constructing new button, like: Btn = CustomButtonClass('Text', clicked='lambda: self.func(par)') So far - without any success. I guess the thing is to…
user5532682
0
votes
2 answers

How to create a button for each element in a list and put it in a scroll-area?

I have a list which gets one element each time user opens a file. I need to create a button with the file's name (element from the list), each time this file is appended to a list, and put this button into a scroll-area. The problem is that I…
Julia Cooper
  • 13
  • 1
  • 3
0
votes
2 answers

How to set QStyleOptionButton like a checkbox with custom icons

I have a custom Delegate class which inherits from QStyledItemDelegate. In its paint() event, I would like to add QStyleOptionButton which should be checkable. Is it possible? For example, it denotes visibility property with an icon of eye; and when…
vicrucann
  • 1,703
  • 1
  • 24
  • 34
0
votes
1 answer

Change the background color of a QPushButton with QPropertyAnimation

I'm trying to apply a soft color change to a QPushButton clicked event. My first approach with QPropertyAnimation works like a charm. header: class myAnim : public QWidget { Q_OBJECT Q_PROPERTY(QColor color READ color WRITE…
MichaW.
  • 21
  • 4
0
votes
1 answer

Qt handling QPushButton Autorepeat() behavior with isAutoRepeat()

I'm new to QT and am making a widget that interfaces with a pre-existing gui. I'd like to have my widget continuously output one signal while the user has a pushbutton pressed and then continuously output another when it is released. By enabling…
scott-eddy
  • 128
  • 1
  • 5
0
votes
1 answer

My Qt 5.5 QPushButton Button not showing up in window (Win7)

I'm doing the Udemy C++ Qt tutorial. The idea is to have a QPushButton button in a window. When I run this, I get an empty window. Using Qt 5.5 in Win7. Here are my files: main.cpp #include #include"S_S.h" int main(int argc, char…
0
votes
1 answer

Controlling Object That MousePressEvent Returns in PyQt

I have a lot of qlabels that display images. When click this qlabels mousePressEvent returns which object clicked and I show this images in another qlabel with big size.Then I can delete image using qpushbutton.If users click more qlabels and then…
Cahit Yıldırım
  • 499
  • 1
  • 10
  • 26
0
votes
0 answers

Pushbutton requires two clicks to register click

In our Project written in QT, we have multiple widgets. The first one is "login", and after successful log in, the "login" widget closes and create a "main menu" widget. "Main menu" widget has 5 push buttons that represent menu options and clicking…
KMC
  • 1,677
  • 3
  • 26
  • 55
0
votes
1 answer

How can I combine an LED and a piezzo with a push button on arduino?

I would like to know how i can combine in one code my LED and piezzo buzzer. I want to stop the music as soon as I push the push button, and to turn on a light(LED) at the same moment. My code is not working, could you pleasy tell what I should do? …
tom
  • 23
  • 1
  • 7
0
votes
2 answers

How to enter a character to QLineEdits from QPushButtons depending on the focus in Qt

I am using Qt Creator to make a UI.UI consists of two or more QLineEdits and ten QPushButtons to input 0-9 numberic characters to QLineEdits. How can I enter 0-9 number strings in both QLineEdits one by one. If I press QPushButton with label '5'and…
Saad Rafey
  • 531
  • 2
  • 6
  • 18
0
votes
0 answers

QPushButton setEnabled(false) does not gray out the button with lambda

I discovered a very curious thing. I have a big MainWindow class that does a lot of computations with a GUI. In order to keep the GUI responsive, I created a thread for a QTimer that updates the GUI every n milliseconds and another thread for the…
Michael
  • 876
  • 9
  • 29
0
votes
2 answers

Retrieving QPushButton from QWidget

I have a QPushButton with related icon, and I add it to a scene: QPushButton *button = new QPushButton; button->setIcon(QIcon(myIcon)); buttonWidget = detail->scene()->addWidget(button); // buttonWidget is declared globally and is a…
Laurent Crivello
  • 3,809
  • 6
  • 45
  • 89
0
votes
1 answer

Connect QListWidget-Scrollbar and Pushbutton

I'm looking for a Way to connect the Scrollbar of a QListWidget with a QPushbutton. So that I can use two QPushbuttons to scroll up and down. I only find the scrollToTop() and scrollToBottom() functions, but they scroll all the way and I only want…
0
votes
1 answer

MATLAB: export data from checkboxes created by a loop for from a pushbutton

After making a code which creates a window with a figure and some (ii) checkboxes loading some data (one data per checkbox), I would like to export them by a pushbutton only if the checkbox matching a set of data is ticked. First, I have created…
0
votes
1 answer

How can I create a QPushButton with a custom (triangular) shape in Qt 5.5?

How can I create a triangular pushbutton in Qt? What is the most simplest way of executing this? I use the designer to create buttons and not code. Also, I read somewhere that shapes may be changed as long as the frame of the button is still…
Outsmash
  • 77
  • 8