]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiMathMatrix.cpp
QDialogButtonBox for the remaining dialogs.
[lyx.git] / src / frontends / qt4 / GuiMathMatrix.cpp
index 8106629d994a045fbb99e9a24503548fb35bc46f..3a9768b0943bd4491baa21a3b27b9fa63971deb8 100644 (file)
@@ -63,15 +63,17 @@ GuiMathMatrix::GuiMathMatrix(GuiView & lv)
 {
        setupUi(this);
 
+       for (int i = 0; *VertAligns[i]; ++i)
+               valignCO->addItem(qt_(VertAligns[i]));
+       for (int i = 0; *DecoChars[i]; ++i)
+               decorationCO->addItem(qt_(DecoChars[i]));
+
        table->setMinimumSize(100, 100);
        rowsSB->setValue(5);
        columnsSB->setValue(5);
        valignCO->setCurrentIndex(1);
        decorationCO->setCurrentIndex(0);
 
-       connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
-       connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
-
        connect(table, SIGNAL(rowsChanged(int)),
                rowsSB, SLOT(setValue(int)));
        connect(table, SIGNAL(colsChanged(int)),
@@ -91,11 +93,6 @@ GuiMathMatrix::GuiMathMatrix(GuiView & lv)
        connect(decorationCO, SIGNAL(activated(int)),
                this, SLOT(decorationChanged(int)));
 
-       for (int i = 0; *VertAligns[i]; ++i)
-               valignCO->addItem(qt_(VertAligns[i]));
-       for (int i = 0; *DecoChars[i]; ++i)
-               decorationCO->addItem(qt_(DecoChars[i]));
-
        bc().setPolicy(ButtonPolicy::IgnorantPolicy);
 }
 
@@ -124,6 +121,21 @@ void GuiMathMatrix::change_adaptor()
 }
 
 
+void GuiMathMatrix::on_buttonBox_clicked(QAbstractButton * button)
+{
+       switch (buttonBox->standardButton(button)) {
+       case QDialogButtonBox::Ok:
+               slotOK();
+               break;
+       case QDialogButtonBox::Cancel:
+               slotClose();
+               break;
+       default:
+               break;
+       }
+}
+
+
 void GuiMathMatrix::slotOK()
 {
        int const nx = columnsSB->value();
@@ -131,7 +143,7 @@ void GuiMathMatrix::slotOK()
        // a matrix without a decoration is an array,
        // otherwise it is an AMS matrix
        // decorated matrices cannot have a vertical alignment
-       
+
        char const c = v_align_c[valignCO->currentIndex()];
        QString const sh = halignED->text();
        string const str = fromqstr(