[X2Go-Commits] [x2goclient] 02/12: helpdialog.cpp: try harder to set a monospaced font.
git-admin at x2go.org
git-admin at x2go.org
Fri Apr 24 01:32:17 CEST 2015
This is an automated email from the git hooks/post-receive script.
x2go pushed a commit to branch master
in repository x2goclient.
commit 739e2e1cc31e9b662db568417ae8a27fbc3a7bb8
Author: Mihai Moldovan <ionic at ionic.de>
Date: Thu Apr 23 23:26:04 2015 +0200
helpdialog.cpp: try harder to set a monospaced font.
---
debian/changelog | 1 +
src/helpdialog.cpp | 19 +++++++++++++++++--
2 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index 1be98b7..d993c2e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -299,6 +299,7 @@ x2goclient (4.0.4.0-0x2go1) UNRELEASED; urgency=low
- helpdialog.cpp: use QT_VERSION macro to select either a monospaced or
typewriter font (Qt < 4.7.0 only supports TypeWriter.)
- x2goutils.{cpp,h}: add new font_is_monospaced() helper.
+ - helpdialog.cpp: try harder to set a monospaced font.
[ Fernando Pedemonte ]
* New upstream release (4.0.4.0):
diff --git a/src/helpdialog.cpp b/src/helpdialog.cpp
index 3fa478f..4a1936f 100644
--- a/src/helpdialog.cpp
+++ b/src/helpdialog.cpp
@@ -18,18 +18,33 @@
#include <QtGlobal>
#include "helpdialog.h"
+#include "x2goutils.h"
HelpDialog::HelpDialog (QWidget *parent): QDialog (parent) {
setupUi (this);
}
void HelpDialog::setText (QString text) {
+ /* Try real hard to get a monospaced font. */
QFont font ("monospace");
+
+ if (!font_is_monospaced (font)) {
#if QT_VERSION >= 0x040700
- font.setStyleHint (QFont::Monospace);
+ font.setStyleHint (QFont::Monospace);
#else
- font.setStyleHint (QFont::TypeWriter);
+ font.setStyleHint (QFont::TypeWriter);
#endif
+ }
+
+ if (!font_is_monospaced (font)) {
+ font.setFamily ("Courier New");
+ }
+
+ if (!font_is_monospaced (font)) {
+ font.setFamily ("Courier");
+ }
+
+ /* If the font is not monospaced by now, there's not much else we can do... */
plainTextEdit->setFont (font);
plainTextEdit->setTabStopWidth (30);
--
Alioth's /srv/git/code.x2go.org/x2goclient.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient.git
More information about the x2go-commits
mailing list