mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-27 14:48:46 -05:00
3327625346
Colours behave like other configuration items and changes are only applied when the Settings UI is dismissed via the "OK" button. Simplified font settings and use style sheets consistently to set the application and decoded text fonts. This is necessary because any UI widget that has a style sheet applied does not honor a font set by QWidget::setFont() even if there is no font setting in the style sheet, this is broken behaviour IMHO but that is the way Qt currently works. Use a style sheet to style the frequency display and clock. This is necessary to allow fonts to be cascaded through parent style sheets and still be overridden on these widgets. Simplify the decoded text widgets, there is no need to use the QTextBrowser as a super class since the simpler QTextEdit set as read-only is sufficient. Also removed colour setting via a background brush as it doesn't work and the HTML 'bgcolor' attribute works correctly. Change to UI properties of the decoded text widgets to allow horizontal scrolling if required, this allows larger fonts to be used without truncating decoded messages. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@4957 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
27 lines
695 B
C++
27 lines
695 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 {"* {\n"
|
|
" 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);
|
|
}
|