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

QPushButton with menu - drop from right side

I have a long QPushButton (well, a subclass of one) with a menu attached. The drop-down menu indicator is on the right side of the button, but when pressed the menu drops down from the bottom-left corner. This seems to me like it will be clunky and…
Nicolas Holthaus
  • 7,763
  • 4
  • 42
  • 97
0
votes
2 answers

QT - connecting wrong button from member QWidget

I have a main window which opens a new window and connects a button from the new window to a "close" function. The problem arises when that new window has more than one button; it will always connect the last created button instead of the explicited…
Noel
  • 730
  • 6
  • 15
0
votes
1 answer

Coordinates of QPushButton in QList

I have created a QList of QPushButton that I have assigned to a slot function. But I would like to get coordinates of the button which is clicked in the list. For example, pushbutton n°5 is clicked, it return me (25,150). listButton = new…
Templeton Peck
  • 151
  • 1
  • 3
  • 10
0
votes
1 answer

Pressing qpushbutton when qprocessevent waitforfinished

I need to run an external application by pressing a button and freeze the main application. Using the below code when the main application is freezed the button on it seems to enqueue the event (or the main application). When the main application…
SNC
  • 59
  • 2
  • 15
0
votes
1 answer

Qt: get text from button in QTableWidget

I have QTableWidget in my Qt application, and I add buttons to it like that: QPushButton *startButton = new QPushButton("start"); ui->tableWidget_tvConnection->setCellWidget(row, col, startButton); connect(startButton, SIGNAL(clicked()), this,…
floppydisk
  • 248
  • 3
  • 11
0
votes
1 answer

Erase all the inputs with a button

I use for loop to create several QLineEdits, and going to create a button which can erase everything written in all the QLineEdits. It means if I type something in every QLine, and click the button can clear all the lines. My question is how to…
EricBkc
  • 369
  • 2
  • 4
  • 12
0
votes
1 answer

How to turn off QAbstractButton animateClick when lineEdit has focus

I am new to QT GUI programming and I am using QT Creator. The problem I am seeing is with my pushbutton and line edit when the user presses the enter key. My program opens a groupbox and allows the user to enter a password and press ok or cancel.…
Ivory244
  • 975
  • 1
  • 8
  • 12
0
votes
2 answers

How to enable a down arrow on QPushButton?

With QPushButton you can add a menu using the setMenu() method and it will then draw a down arrow on the button (depending on the style settings). Is it possible to enable the drawing of the same down arrow by some other method? I would like to use…
glennr
  • 2,069
  • 2
  • 26
  • 37
0
votes
1 answer

QPushButton resize animation

I want to animate a QPushButton resize, is there a way to know when the button will be resized and what will be the final size so i can set the final value for the animation? Thanks
Rui Sebastião
  • 855
  • 1
  • 18
  • 36
0
votes
3 answers

How to re-add pressed/clicked effect to QPushButton?

When I set a background color for a QPushButton at its stylesheet, it loses pressed/clicked effect. How can I fix this? How can I re-add this effect?
Oğuzhan Türk
  • 360
  • 2
  • 9
  • 21
0
votes
1 answer

Play the sound when click the pushbutton in matlab GUI

I am trying to play the audio in synchronization with moving line on graph of audio after click on pushbutton in GUI matlab. the code for the above task is fs = 44100; durT = 3; %seconds durS = fs*durT; %samples x = randn(durS, 1); dt =…
user3168654
  • 95
  • 1
  • 11
0
votes
2 answers

How to set push-button to keyboard interrupt in PyQt

While running program through the terminal we can stop the program by pressing 'Ctrl+c' and it will show the message as 'KeyboardInterrupt' . So, is there any way to do the sane thing by clicking the push-button in PyQt.
lkkkk
  • 1,999
  • 4
  • 23
  • 29
0
votes
1 answer

QT - Swapping Icons

I made a simple program to demonstrate my issues with attempting to use the QIcon swap() function. I am trying to swap the icons on two QPushButtons using this function, but it doesnt seem to be working. mainwindow.h #ifndef MAINWINDOW_H #define…
halexh
  • 3,021
  • 3
  • 19
  • 19
0
votes
1 answer

Getting seleted menu item

I am implementing run time menu on a button(QPushButton) in my app user has to make choice between ftp and http when he click on upload button. QMenu menu(this);…
bhupinder
  • 315
  • 1
  • 6
  • 23
0
votes
1 answer

Change color of push button

I am trying to create the game Battleship in MATLAB r2013. I want to change the color of a push button with a function (without clicking it) in order to understand when the PC hit my panel of ships. Does anyone have any idea how I can do this? I…