Use specific monospace fonts as fallback on Mac OS X.

Qt (4.8.6) doesn't seem to be able to resolve the generic monospace
font family.

Closes #214
This commit is contained in:
Felix Geyer 2014-11-02 11:18:51 +01:00
parent 4cdb9a645d
commit 87468b648b
2 changed files with 12 additions and 1 deletions

View File

@ -45,7 +45,13 @@ void PasswordComboBox::setEcho(bool echo)
// add fake item to show visual indication that a popup is available
addItem("");
setStyleSheet("QComboBox { font-family: monospace; }");
#ifdef Q_OS_MAC
// Qt on Mac OS doesn't seem to know the generic monospace family (tested with 4.8.6)
setStyleSheet("QComboBox { font-family: monospace,Menlo,Monaco; }");
#else
setStyleSheet("QComboBox { font-family: monospace,Courier; }");
#endif
}
else {
// clear items so the combobox indicates that no popup menu is available

View File

@ -56,7 +56,12 @@ void PasswordEdit::updateStylesheet()
QString stylesheet("QLineEdit { ");
if (echoMode() == QLineEdit::Normal) {
#ifdef Q_OS_MAC
// Qt on Mac OS doesn't seem to know the generic monospace family (tested with 4.8.6)
stylesheet.append("font-family: monospace,Menlo,Monaco; ");
#else
stylesheet.append("font-family: monospace; ");
#endif
}
if (m_basePasswordEdit && !passwordsEqual()) {