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
2 answers

How to keep Qt Widgets responsive to keyboard and mouse while handling Windows Events?

My app have a QLineEdit and a QPushButton which not respond properly to inputs of keyboard and mouse (the QLineEdit is not receiving the keyboard inputs, and both the QLineEdit and QPushButton are not receiving mouse inputs) when my app is handling…
Antonio Dias
  • 2,751
  • 20
  • 40
0
votes
1 answer

Drawing QPushButton text off the button

I am creating a custom QPushButton. If the button has an icon I want the icon centered on the button. If the button has text I want the text centered on the button. I can handle both of those cases. If the button contains both an icon and text I…
0
votes
1 answer

QTPushbutton:hover only working on click

I am using a stlyesheet to style my qt pushbutton when the mouse moves over it. However, the hover event only fires when I CLICK on the button, nothing happens when I hover my mouse over it Trackbox { background: #FFFFFF;} QPushButton { position:…
joshua-anderson
  • 4,458
  • 5
  • 35
  • 56
0
votes
1 answer

1 QPushButton control 2 action from 2 different class

This is a pyside GUI, I have created 2 panel in 2 different .py files, main.py and sub.py each panel will display a we browser 'QWebView'. Currently when user press the button on main.py it will redirect the user to a page e.g "www.google" and user…
0
votes
2 answers

Using setWhatIsThis in Qt with QPushButton

I need to show a "help text" when the mouse is over a pushbutton, I googled and I tried some code but in vain. Can anyone correct it to me? if (event->type() == QEvent::Enter) { if (obj == q1) { iarm->printStatus("hi"); // For…
user1807367
0
votes
1 answer

Qt: display dynamically composed non-English text on Labels or buttons

I am trying to display some dynamically generated hindi text on a QPushbutton. Please have a look at the following code: char nam[] = { 40, 9, 62, 9, 46, 9 }; QString nameStringInHindi(QString::fromRawData((QChar *)nam, 3)); qDebug() <<…
jestin
  • 15
  • 3
0
votes
1 answer

QT: how to create a new button when signal is emitted

I want to create a SLOT() that creates a QPushButton (or a QLineEdit) widget on my Gui (on the same frame) whenever a SIGNAL(clicked()) is emitted from a specific PushButton on my Gui. for example: when I press on "exit" a new "thanks" button…
McLan
  • 2,552
  • 9
  • 51
  • 85
0
votes
1 answer

PyQt4: Using a QPushButton widget to delete an item from QList widget

I am learning PyQt4 (I am using version 4.4.4) and I'm pretty new to Python (Python 2.5). I have a GUI with a QListWidget and a QPushButton. I want a user to be able to click to select an entry in the list and then click the QPushButton and have the…
0
votes
0 answers

css properties in a pushbutton are not overridden in :checked ? (Qt qss)

I use this in Qt 4. The code for both: QPushButton#groupBoxTitleExpand { min-height: 25px; max-height: 25px; border-style: solid; border-width: 0px 17px 0px 3px; border-image: url(:/image.png) 0 17 0 3 fill repeat; }…
Darkgaze
  • 2,280
  • 6
  • 36
  • 59
0
votes
2 answers

Qt: Signal and slots and Q_OBJECT

I have written a program in Qt, it works fine, but clicking on push buttons does not work. When I use Q_OBJECT just after the class declaration, it gives me compilation errors. Here is my code: #include #include
shivshnkr
  • 1,435
  • 1
  • 13
  • 19
0
votes
1 answer

create a slot in qt to react to a click of a pushbutton

I have a start/stop button which i want to control which tab is being shown in the tabWidget. here's how I'm doing it. // Control START/STOP actions void gui::start_stop() { if (acquisition == 0) { acquisition = 1; …
SamuelNLP
  • 4,038
  • 9
  • 59
  • 102
0
votes
1 answer

Customise QPushButton with an image

I am using Qt5 and having some problems in setting the back ground image of a QPushButton. I am using Qt Creator and Design to drag and drop the QPushButton. After that I created a source folder and placed an image in that directory and I googled…
rotating_image
  • 3,046
  • 4
  • 28
  • 46
0
votes
1 answer

Trouble Connecting QPushButton Signal to QGraphicsView Slot

I'm having trouble connecting a signal in a QPushButton to a slot in my QGraphicsView. My Push Button Header: class Button : public QPushButton { Q_OBJECT public://public constructors / destructors Button(Game_state * game_state,…
JonMorehouse
  • 1,313
  • 6
  • 14
  • 34
0
votes
1 answer

Qt - How to expand or Collapse my QTableView

I have a QTableView with some items in it. If i click on any row, that particular row has to expand with some QPushButtons in it. I had attached the screen shot of it. How can i achieve this? Need ur help. Thanks in Advance.
New Moon
  • 787
  • 6
  • 21
  • 35
-1
votes
1 answer

How to edit the name of a dynamically added pushbutton inside a qframe

I have added few pushbuttons dynamically inside a qframe,but I want to edit the names of the pushbuttons. QPushButton* newButton = new QPushButton("new button " +…
Neocoder_1
  • 49
  • 1
  • 13