+ connect(ls, SIGNAL(valueChanged(int)), rs, SLOT(setValue(int)),
+ Qt::UniqueConnection);
+ connect(rs, SIGNAL(valueChanged(int)), ls, SLOT(setValue(int)),
+ Qt::UniqueConnection);
+ rs->setValue(ls->value());
+ } else {
+ ls->disconnect(rs);
+ rs->disconnect(ls);
+ }
+
+ updateTeXCode(sizeCO->currentIndex());
+}
+
+void GuiDelimiter::on_swapPB_clicked()
+{
+ // Get current math symbol for each side.
+ MathSymbol const & lms =
+ mathSymbol(getDelimiterName(leftLW->currentItem()));
+ MathSymbol const & rms =
+ mathSymbol(getDelimiterName(rightLW->currentItem()));
+
+ // Swap and match.
+ char_type const lc = doMatch(rms.unicode);
+ char_type const rc = doMatch(lms.unicode);
+
+ // Convert back to QString to locate them in the widget.
+ MathSymbol const & nlms = mathSymbol(texName(lc));
+ MathSymbol const & nrms = mathSymbol(texName(rc));
+ QString lqs(nlms.fontcode ?
+ QChar(nlms.fontcode) : toqstr(docstring(1, nlms.unicode)));
+ QString rqs(nrms.fontcode ?
+ QChar(nrms.fontcode) : toqstr(docstring(1, nrms.unicode)));
+
+ // Handle unencoded "symbol" of "(None)".
+ if (lqs.toStdString() == "?")
+ lqs = qt_("(None)");
+ if(rqs.toStdString() == "?")
+ rqs = qt_("(None)");
+
+ // Locate matching QListWidgetItem.
+ QList<QListWidgetItem *> lwi = leftLW->findItems(lqs, Qt::MatchExactly);
+ QList<QListWidgetItem *> rwi = rightLW->findItems(rqs, Qt::MatchExactly);
+
+ // Select.
+ leftLW->setCurrentItem(lwi.first());
+ rightLW->setCurrentItem(rwi.first());
+