structured bindings are awesome!
This commit is contained in:
parent
efa8d26ada
commit
966620429e
@ -12,17 +12,18 @@ SetDialog::SetDialog(QWidget* parent) :
|
|||||||
|
|
||||||
QFormLayout* layout = findChild<QFormLayout*>("layout");
|
QFormLayout* layout = findChild<QFormLayout*>("layout");
|
||||||
|
|
||||||
auto addSpinBox = [&](QString label, int value)
|
using Bindable = std::tuple<QSpinBox*&, int, const char*>;
|
||||||
|
for (auto[spinBox, value, label] : {
|
||||||
|
Bindable{ flushDelay, TextThread::flushDelay, FLUSH_DELAY },
|
||||||
|
Bindable{ maxBufferSize, TextThread::maxBufferSize, MAX_BUFFER_SIZE },
|
||||||
|
Bindable{ defaultCodepage, TextThread::defaultCodepage, DEFAULT_CODEPAGE }
|
||||||
|
})
|
||||||
{
|
{
|
||||||
auto spinbox = new QSpinBox(this);
|
spinBox = new QSpinBox(this);
|
||||||
spinbox->setMaximum(INT_MAX);
|
spinBox->setMaximum(INT_MAX);
|
||||||
spinbox->setValue(value);
|
spinBox->setValue(value);
|
||||||
layout->insertRow(0, label, spinbox);
|
layout->insertRow(0, label, spinBox);
|
||||||
return spinbox;
|
}
|
||||||
};
|
|
||||||
flushDelay = addSpinBox(FLUSH_DELAY, TextThread::flushDelay);
|
|
||||||
maxBufferSize = addSpinBox(MAX_BUFFER_SIZE, TextThread::maxBufferSize);
|
|
||||||
defaultCodepage = addSpinBox(DEFAULT_CODEPAGE, TextThread::defaultCodepage);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SetDialog::~SetDialog()
|
SetDialog::~SetDialog()
|
||||||
|
Loading…
Reference in New Issue
Block a user