UI: Use Qt standard buttons in source properties

Use the Qt standard buttons in the source properties dialog to make the
UI consistent.  Also remove the right alignment of the button box to
allow Qt to align standard buttons on the left side of the dialog.

Closes jp9000/obs-studio#1013
This commit is contained in:
Christoph Hohmann
2017-08-22 14:41:54 +02:00
committed by jp9000
parent 76b6266689
commit 27a8f69eea

View File

@@ -49,13 +49,15 @@ OBSBasicProperties::OBSBasicProperties(QWidget *parent, OBSSource source_)
int cy = (int)config_get_int(App()->GlobalConfig(), "PropertiesWindow",
"cy");
QPushButton *b;
b = buttonBox->addButton(QTStr("OK"), QDialogButtonBox::AcceptRole);
buttonBox->addButton(QTStr("Cancel"), QDialogButtonBox::RejectRole);
buttonBox->addButton(QTStr("Defaults"), QDialogButtonBox::ResetRole);
buttonBox->setObjectName(QStringLiteral("buttonBox"));
buttonBox->setStandardButtons(QDialogButtonBox::Ok |
QDialogButtonBox::Cancel |
QDialogButtonBox::RestoreDefaults);
b->setDefault(true);
buttonBox->button(QDialogButtonBox::Ok)->setText(QTStr("OK"));
buttonBox->button(QDialogButtonBox::Cancel)->setText(QTStr("Cancel"));
buttonBox->button(QDialogButtonBox::RestoreDefaults)->
setText(QTStr("Defaults"));
if (cx > 400 && cy > 400)
resize(cx, cy);
@@ -92,7 +94,7 @@ OBSBasicProperties::OBSBasicProperties(QWidget *parent, OBSSource source_)
setLayout(new QVBoxLayout(this));
layout()->addWidget(windowSplitter);
layout()->addWidget(buttonBox);
layout()->setAlignment(buttonBox, Qt::AlignRight | Qt::AlignBottom);
layout()->setAlignment(buttonBox, Qt::AlignBottom);
view->show();
installEventFilter(CreateShortcutFilter());