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 merge KeyReleaseEvent with Button

How to merge KeyReleaseEvent and QPushButton using signal. I mean whenever user will press enter key button should call some function using SLOT. So what i have to use in the signal? void mywindow::keyReleaseEvent(QKeyEvent *event) { …
Suresh
  • 745
  • 4
  • 11
  • 25
0
votes
0 answers

Running WampServer using a QPushButton

i am trying to run wampserver using a QPushbutton : when i click on a QPushbutton i have a SLOT runnig void LoginFenetre::lancerWampServer(){ //QProcess::startDetached("\"G:/Games/3DM-dhredgoyear/Launcher.exe\""); QString wampPath =…
0
votes
1 answer

How to insert QPushButton into a QLabel (PyQt4)?

I want to add buttons into a text on pyqt4. But I don't find any solution or an example codes.
kadir_cakir
  • 1,013
  • 1
  • 16
  • 22
0
votes
1 answer

PySide: base on the groupbox example of PySide-Example , issue An error native Qt signal is not callable

Base on the groupbox example of PySide-Example, I add a clicked slot to the pushButton, such as: def createPushButtonGroup(self): ... pushButton = QtGui.QPushButton("&Normal Button") …
tao4yu
  • 316
  • 1
  • 5
  • 16
0
votes
1 answer

PySide: How Could I trigger the current clicked QPushbutton, not other later added

I am new to PySide. In my program, I encountered a problem that when I click one button, it triggers other button later added. Thanks! self.addContentButton = QtGui.QPushButton('Add') …
tao4yu
  • 316
  • 1
  • 5
  • 16
0
votes
1 answer

Push button for QTableView

I would like add QPushButtons to my QTableView. How can this be done with Qt? Is it possible to specify which column holds the button If I use QItemDelegate?
user476566
  • 1,319
  • 3
  • 26
  • 42
0
votes
1 answer

PyQt: Sorting buttons inside QGridLayout

I want to make grid of 8 buttons (2x4) and be able to move through this buttons using keyboard arrows. If I simply make a grid layout and put the pushbuttons in corresponding coordinates, i get the layout that looks as it should but I can only move…
speedyTeh
  • 247
  • 1
  • 8
  • 22
0
votes
2 answers

link QPushButton width to another QPushButton

I created a GUI width Qt Creator (Qt 5.0.1), of course also making use of layouts. For aesthetical reasons, I would like a QPushButton to be of the same width as another QPushButton placed in some other corner of the GUI. This other button changes…
Chris
  • 981
  • 4
  • 14
  • 29
0
votes
1 answer

Qt PushButton exec widgets

I have a checkable pushbutton set to exec/close a dialog widget that I have created. My idea is when the pushbutton is checked, it will close the dialog widget. If it's not checked, it should open the dialog widget. But I am unable to get it to…
Wallace
  • 293
  • 1
  • 9
  • 18
0
votes
1 answer

Qt C++ Custom Slot

I'm having trouble with making custom slots in Qt. Code: class.h file: public slots: void resetUrl(){ this->load(QUrl("http://www.google.com")); } main.cpp file: #include #include QWebView *web = new…
Connor M
  • 331
  • 3
  • 5
  • 18
0
votes
4 answers

QPushButton Main Gui

I'm beginning with Qt and I do not understand something. Here is my code: #include #include #include #include QApplication a(argc, argv); QMainWindow *mWin = new…
Connor M
  • 331
  • 3
  • 5
  • 18
0
votes
2 answers

Adding image to QPushButton on Qt

I'm fairly new to C++ in general, so I need a little help with Qt. I'm trying to add an image to a PushButton, and I keep having problems with it. Here is an example of what I have: #include QPushButton *button; button = new…
Connor M
  • 331
  • 3
  • 5
  • 18
0
votes
3 answers

Huge "Grid" of PushButtons lags awfully, buttons can't be enabled

In my project, I have 256 tiny PushButtons in one 16x16 grid layout. (Yeah that took forever.) Editing and running my program now is very laggy. Also, for some strange reason, Qt will not let me enable any of the buttons, but other buttons to the…
mrg95
  • 2,371
  • 11
  • 46
  • 89
0
votes
1 answer

python pyqt4 contextMenu on multiple pushButtons

I'm trying to build off this example that I've came across from here: Right click contextMenu on QPushButton How would I get this to work when I'm creating the button dynamically? I can't figure out a way to dynamically create the method…
0
votes
1 answer

(Qt C++) QPushButton setIcon() not working

I'm working on a project that has 40 checkable push buttons in a group and I want the icon of one button to change depending on a value I define. I'm not creating a new pushbutton, just changing the icon of the current one. So I'm testing it by…
mrg95
  • 2,371
  • 11
  • 46
  • 89