use QDilaogButtonBox for Ok/Cancel buttons
This commit is contained in:
@ -98,14 +98,10 @@ AxisEdit::AxisEdit( Axis* ax )
|
||||
h->addWidget(btnPos);
|
||||
v->addWidget( keyBox );
|
||||
|
||||
h = new QHBoxLayout();
|
||||
btnOkay = new QPushButton("&Okay", this);
|
||||
connect(btnOkay, SIGNAL( clicked() ), this, SLOT( accept()));
|
||||
h->addWidget(btnOkay);
|
||||
btnCancel = new QPushButton("&Cancel", this);
|
||||
connect(btnCancel, SIGNAL( clicked() ), this, SLOT( reject()));
|
||||
h->addWidget(btnCancel);
|
||||
v->addLayout(h);
|
||||
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this);
|
||||
connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
|
||||
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
|
||||
v->addWidget(buttonBox);
|
||||
|
||||
modeChanged( axis->mode );
|
||||
transferCurveChanged( axis->transferCurve );
|
||||
@ -131,8 +127,8 @@ void AxisEdit::gradientChanged( bool on ) {
|
||||
}
|
||||
}
|
||||
|
||||
void AxisEdit::modeChanged( int index ) {
|
||||
if (index == Axis::Keyboard) {
|
||||
void AxisEdit::modeChanged( Axis::Mode mode ) {
|
||||
if (mode == Axis::Keyboard) {
|
||||
mouseBox->setEnabled(false);
|
||||
keyBox->setEnabled(true);
|
||||
}
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include <QCheckBox>
|
||||
#include <QDoubleSpinBox>
|
||||
#include <QLabel>
|
||||
#include <QDialogButtonBox>
|
||||
//for my home-brewed widgets
|
||||
#include "joyslider.h"
|
||||
#include "keycode.h"
|
||||
@ -24,7 +25,7 @@ class AxisEdit : public QDialog {
|
||||
protected slots:
|
||||
//slots for GUI events
|
||||
void gradientChanged( bool on );
|
||||
void modeChanged( int index );
|
||||
void modeChanged( Axis::Mode mode );
|
||||
void transferCurveChanged( int index );
|
||||
void throttleChanged( int index );
|
||||
void accept();
|
||||
@ -40,7 +41,6 @@ class AxisEdit : public QDialog {
|
||||
QDoubleSpinBox *spinSensitivity;
|
||||
KeyButton *btnNeg, *btnPos;
|
||||
JoySlider *slider;
|
||||
QPushButton *btnOkay, *btnCancel;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include <QVBoxLayout>
|
||||
|
||||
ButtonEdit::ButtonEdit(Button* butt)
|
||||
:QDialog(0) {
|
||||
: QDialog(0) {
|
||||
setModal(true);
|
||||
//build the dialog!
|
||||
button = butt;
|
||||
@ -16,26 +16,22 @@ ButtonEdit::ButtonEdit(Button* butt)
|
||||
v->setMargin(5);
|
||||
v->setSpacing(5);
|
||||
|
||||
BKKey = new KeyButton( button->getName(), button->keycode, this, true, button->useMouse);
|
||||
v->addWidget(BKKey);
|
||||
btnKey = new KeyButton( button->getName(), button->keycode, this, true, button->useMouse);
|
||||
v->addWidget(btnKey);
|
||||
|
||||
QHBoxLayout* h = new QHBoxLayout();
|
||||
CSticky = new QCheckBox("&Sticky", this);
|
||||
CSticky->setChecked(button->sticky);
|
||||
h->addWidget(CSticky);
|
||||
CRapid = new QCheckBox("&Rapid Fire", this);
|
||||
CRapid->setChecked(button->rapidfire);
|
||||
h->addWidget(CRapid);
|
||||
chkSticky = new QCheckBox("&Sticky", this);
|
||||
chkSticky->setChecked(button->sticky);
|
||||
h->addWidget(chkSticky);
|
||||
chkRapid = new QCheckBox("&Rapid Fire", this);
|
||||
chkRapid->setChecked(button->rapidfire);
|
||||
h->addWidget(chkRapid);
|
||||
v->addLayout(h);
|
||||
|
||||
h = new QHBoxLayout();
|
||||
BOkay = new QPushButton("&Okay", this);
|
||||
connect(BOkay, SIGNAL( clicked() ), this, SLOT( accept()));
|
||||
h->addWidget(BOkay);
|
||||
BCancel = new QPushButton("&Cancel", this);
|
||||
connect(BCancel, SIGNAL( clicked() ), this, SLOT( reject()));
|
||||
h->addWidget(BCancel);
|
||||
v->addLayout(h);
|
||||
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this);
|
||||
connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
|
||||
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
|
||||
v->addWidget(buttonBox);
|
||||
}
|
||||
|
||||
void ButtonEdit::show() {
|
||||
@ -51,11 +47,11 @@ void ButtonEdit::accept() {
|
||||
else {
|
||||
if (CRapid->isChecked()) takeTimer(button);
|
||||
}*/
|
||||
button->rapidfire = CRapid->isChecked();
|
||||
button->sticky = (CSticky->isChecked());
|
||||
button->rapidfire = chkRapid->isChecked();
|
||||
button->sticky = chkSticky->isChecked();
|
||||
//if the user chose a mouse button...
|
||||
button->useMouse = BKKey->choseMouse();
|
||||
button->keycode = BKKey->getValue();
|
||||
button->useMouse = btnKey->choseMouse();
|
||||
button->keycode = btnKey->getValue();
|
||||
|
||||
QDialog::accept();
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
#include <QPushButton>
|
||||
#include <QCheckBox>
|
||||
#include <QDialogButtonBox>
|
||||
|
||||
//we need to edit a Button
|
||||
#include "button.h"
|
||||
@ -20,10 +21,8 @@ class ButtonEdit : public QDialog {
|
||||
void accept();
|
||||
protected:
|
||||
Button *button;
|
||||
KeyButton *BKKey;
|
||||
QPushButton *BKey, *BMouse, *BOkay, *BCancel;
|
||||
QPushButton **BMKey;
|
||||
QCheckBox *CSticky, *CRapid;
|
||||
KeyButton *btnKey;
|
||||
QCheckBox *chkSticky, *chkRapid;
|
||||
};
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user