+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 == "?")
+ lqs = qt_("(None)");
+ if(rqs == "?")
+ 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());
+
+ updateTeXCode(sizeCO->currentIndex());
+}
+