14 QWidget( parent ), m_matrix( matrix ) {
16 QGridLayout* layout =
new QGridLayout;
17 layout->setContentsMargins( {} );
18 layout->setSpacing( 0 );
19 for (
long i = 0; i < m_matrix.rows(); ++i ) {
20 for (
int j = 0; j < m_matrix.cols(); ++j ) {
21 auto& elem = m_matrix( i, j );
23 auto spinbox =
new QDoubleSpinBox();
24 spinbox->setDecimals( dec );
27 spinbox->setValue( elem );
28 layout->addWidget( spinbox, i, j );
29 auto updateMatrixOnChange = [
this, &elem](
double value ) {
31 emit valueChanged( m_matrix );
34 QOverload<double>::of( &QDoubleSpinBox::valueChanged ),
35 updateMatrixOnChange );