mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-18 10:01:57 -05:00
ed2f4ee226
Several issues mainly related to the rather complex interaction of style sheets and widget properties with respect to fonts. Font setting on the astro window should now be consistent and not overridden by application style sheet driven font settings. Decoded text font setting should now be consistent and not revert back to Courier 10 on the next decode after a font change. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@5179 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
27 lines
687 B
C++
27 lines
687 B
C++
#include "qt_helpers.hpp"
|
|
|
|
#include <QString>
|
|
#include <QFont>
|
|
|
|
QString font_as_stylesheet (QFont const& font)
|
|
{
|
|
QString font_weight;
|
|
switch (font.weight ())
|
|
{
|
|
case QFont::Light: font_weight = "light"; break;
|
|
case QFont::Normal: font_weight = "normal"; break;
|
|
case QFont::DemiBold: font_weight = "demibold"; break;
|
|
case QFont::Bold: font_weight = "bold"; break;
|
|
case QFont::Black: font_weight = "black"; break;
|
|
}
|
|
return QString {
|
|
" font-family: %1;\n"
|
|
" font-size: %2pt;\n"
|
|
" font-style: %3;\n"
|
|
" font-weight: %4;\n"}
|
|
.arg (font.family ())
|
|
.arg (font.pointSize ())
|
|
.arg (font.styleName ())
|
|
.arg (font_weight);
|
|
}
|