Bring colour settings into line with general configuration strategy

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
This commit is contained in:
Bill Somerville 2015-02-13 08:53:02 +00:00
parent a7b3951df5
commit 3327625346
9 changed files with 238 additions and 218 deletions

View File

@ -173,6 +173,7 @@ endif (APPLE)
# Project sources
#
set (wsjt_qt_CXXSRCS
qt_helpers.cpp
NetworkServerLookup.cpp
revision_utils.cpp
WFPalette.cpp

View File

@ -108,18 +108,22 @@
// call to broadcast the setting value change.
//
// 6) Add code to initialise_models() to load the widget control's
// data model with the current setting value.
// data model with the current value.
//
// 7) Add any required inter-field validation to the validate()
// 7) If there is no convenient data model field, add a data member to
// store the proposed new value. Ensure this member has a valid value
// on exit from read_settings().
//
// 8) Add any required inter-field validation to the validate()
// operation.
//
// 8) Add code to the accept() operation to extract the setting value
// 9) Add code to the accept() operation to extract the setting value
// from the widget control data model and load it into the
// Configuration::impl member that reflects the publicly visible
// setting state. If the setting value is dynamic; add a signal emit
// call to broadcast any changed state of the setting.
//
// 9) Add a settings write call to save the setting value to the
// 10) Add a settings write call to save the setting value to the
// settings database.
//
@ -152,8 +156,7 @@
#include <QColorDialog>
#include <QDebug>
#include "ui_Configuration.h"
#include "qt_helpers.hpp"
#include "SettingsGroup.hpp"
#include "FrequencyLineEdit.hpp"
#include "FrequencyItemDelegate.hpp"
@ -166,6 +169,7 @@
#include "pimpl_impl.hpp"
#include "ui_Configuration.h"
#include "moc_Configuration.cpp"
namespace
@ -385,6 +389,8 @@ private:
bool load_audio_devices (QAudio::Mode, QComboBox *, QAudioDeviceInfo *);
void update_audio_channels (QComboBox const *, int, QComboBox *, bool);
void set_application_font (QFont const&);
void initialise_models ();
bool open_rig ();
//bool set_mode ();
@ -456,11 +462,9 @@ private:
QDir save_directory_;
QFont font_;
bool font_changed_;
QFont next_font_;
QFont decoded_text_font_;
bool decoded_text_font_changed_;
QFont next_decoded_text_font_;
bool restart_sound_input_device_;
@ -517,10 +521,15 @@ private:
QString my_callsign_;
QString my_grid_;
QColor color_CQ_;
QColor next_color_CQ_;
QColor color_MyCall_;
QColor next_color_MyCall_;
QColor color_TxMsg_;
QColor next_color_TxMsg_;
QColor color_DXCC_;
QColor next_color_DXCC_;
QColor color_NewCall_;
QColor next_color_NewCall_;
qint32 id_interval_;
bool id_after_73_;
bool tx_QSY_allowed_;
@ -685,9 +694,6 @@ Configuration::impl::impl (Configuration * self, QSettings * settings, QWidget *
, self_ {self}
, ui_ {new Ui::configuration_dialog}
, settings_ {settings}
, font_ {QApplication::font ()}
, font_changed_ {false}
, decoded_text_font_changed_ {false}
, frequencies_ {
{
136130,
@ -994,8 +1000,6 @@ void Configuration::impl::initialise_models ()
ui_->labTx->setStyleSheet(QString("background: %1").arg(color_TxMsg_.name()));
ui_->labDXCC->setStyleSheet(QString("background: %1").arg(color_DXCC_.name()));
ui_->labNewCall->setStyleSheet(QString("background: %1").arg(color_NewCall_.name()));
font_changed_ = false;
decoded_text_font_changed_ = false;
ui_->CW_id_interval_spin_box->setValue (id_interval_);
ui_->PTT_method_button_group->button (rig_params_.PTT_method_)->setChecked (true);
ui_->save_path_display_label->setText (save_directory_.absolutePath ());
@ -1067,25 +1071,33 @@ void Configuration::impl::read_settings ()
my_callsign_ = settings_->value ("MyCall", "").toString ();
my_grid_ = settings_->value ("MyGrid", "").toString ();
color_CQ_ = settings_->value("colorCQ","#66ff66").toString();
color_MyCall_ = settings_->value("colorMyCall","#ff6666").toString();
color_TxMsg_ = settings_->value("colorTxMsg","#ffff00").toString();
color_DXCC_ = settings_->value("colorDXCC","#ff00ff").toString();
color_NewCall_ = settings_->value("colorNewCall","#ffaaff").toString();
next_color_CQ_ = color_CQ_ = settings_->value("colorCQ","#66ff66").toString();
next_color_MyCall_ = color_MyCall_ = settings_->value("colorMyCall","#ff6666").toString();
next_color_TxMsg_ = color_TxMsg_ = settings_->value("colorTxMsg","#ffff00").toString();
next_color_DXCC_ = color_DXCC_ = settings_->value("colorDXCC","#ff00ff").toString();
next_color_NewCall_ = color_NewCall_ = settings_->value("colorNewCall","#ffaaff").toString();
if (next_font_.fromString (settings_->value ("Font", QGuiApplication::font ().toString ()).toString ())
&& next_font_ != QGuiApplication::font ())
&& next_font_ != font_)
{
font_ = next_font_;
QApplication::setFont (font_);
set_application_font (font_);
}
else
{
next_font_ = font_;
}
if (next_decoded_text_font_.fromString (settings_->value ("DecodedTextFont", "Courier, 10").toString ())
&& decoded_text_font_ != next_decoded_text_font_)
&& next_decoded_text_font_ != decoded_text_font_)
{
decoded_text_font_ = next_decoded_text_font_;
Q_EMIT self_->decoded_text_font_changed (decoded_text_font_);
}
else
{
next_decoded_text_font_ = decoded_text_font_;
}
id_interval_ = settings_->value ("IDint", 0).toInt ();
@ -1480,20 +1492,24 @@ void Configuration::impl::accept ()
// parameters so extract values from models and make them live
//
if (font_changed_)
if (next_font_ != font_)
{
font_changed_ = false;
font_ = next_font_;
QApplication::setFont (font_);
set_application_font (font_);
}
if (decoded_text_font_changed_)
if (next_decoded_text_font_ != decoded_text_font_)
{
decoded_text_font_changed_ = false;
decoded_text_font_ = next_decoded_text_font_;
Q_EMIT self_->decoded_text_font_changed (decoded_text_font_);
}
color_CQ_ = next_color_CQ_;
color_MyCall_ = next_color_MyCall_;
color_TxMsg_ = next_color_TxMsg_;
color_DXCC_ = next_color_DXCC_;
color_NewCall_ = next_color_NewCall_;
rig_params_ = temp_rig_params; // now we can go live with the rig
// related configuration parameters
rig_is_dummy_ = TransceiverFactory::basic_transceiver_name_ == rig_params_.rig_name_;
@ -1657,47 +1673,62 @@ void Configuration::impl::message_box (QString const& reason, QString const& det
void Configuration::impl::on_font_push_button_clicked ()
{
next_font_ = QFontDialog::getFont (&font_changed_, this);
next_font_ = QFontDialog::getFont (0, next_font_, this);
}
void Configuration::impl::on_pbCQmsg_clicked()
{
color_CQ_ = QColorDialog::getColor("#6666ff");
ui_->labCQ->setStyleSheet(QString("background: %1").arg(color_CQ_.name()));
auto new_color = QColorDialog::getColor(next_color_CQ_, this, "CQ Messages Color");
if (new_color.isValid ())
{
next_color_CQ_ = new_color;
ui_->labCQ->setStyleSheet(QString("background: %1").arg(next_color_CQ_.name()));
}
}
void Configuration::impl::on_pbMyCall_clicked()
{
color_MyCall_ = QColorDialog::getColor("#ff6666");
ui_->labMyCall->setStyleSheet(QString("background: %1").arg(color_MyCall_.name()));
auto new_color = QColorDialog::getColor(next_color_MyCall_, this, "My Call Messages Color");
if (new_color.isValid ())
{
next_color_MyCall_ = new_color;
ui_->labMyCall->setStyleSheet(QString("background: %1").arg(next_color_MyCall_.name()));
}
}
void Configuration::impl::on_pbTxMsg_clicked()
{
color_TxMsg_ = QColorDialog::getColor("#ffff00");
ui_->labTx->setStyleSheet(QString("background: %1").arg(color_TxMsg_.name()));
auto new_color = QColorDialog::getColor(next_color_TxMsg_, this, "Tx Messages Color");
if (new_color.isValid ())
{
next_color_TxMsg_ = new_color;
ui_->labTx->setStyleSheet(QString("background: %1").arg(next_color_TxMsg_.name()));
}
}
void Configuration::impl::on_pbNewDXCC_clicked()
{
color_DXCC_ = QColorDialog::getColor("#ff00ff");
ui_->labDXCC->setStyleSheet(QString("background: %1").arg(color_DXCC_.name()));
auto new_color = QColorDialog::getColor(next_color_DXCC_, this, "New DXCC Messages Color");
if (new_color.isValid ())
{
next_color_DXCC_ = new_color;
ui_->labDXCC->setStyleSheet(QString("background: %1").arg(next_color_DXCC_.name()));
}
}
void Configuration::impl::on_pbNewCall_clicked()
{
color_NewCall_ = QColorDialog::getColor("#ffaaff");
ui_->labNewCall->setStyleSheet(QString("background: %1").arg(color_NewCall_.name()));
auto new_color = QColorDialog::getColor(next_color_NewCall_, this, "New Call Messages Color");
if (new_color.isValid ())
{
next_color_NewCall_ = new_color;
ui_->labNewCall->setStyleSheet(QString("background: %1").arg(next_color_NewCall_.name()));
}
}
void Configuration::impl::on_decoded_text_font_push_button_clicked ()
{
next_decoded_text_font_ = QFontDialog::getFont (&decoded_text_font_changed_
, decoded_text_font_
, this
next_decoded_text_font_ = QFontDialog::getFont (0, decoded_text_font_ , this
, tr ("WSJT-X Decoded Text Font Chooser")
#if QT_VERSION >= 0x050201
, QFontDialog::MonospacedFonts
@ -2313,6 +2344,11 @@ void Configuration::impl::update_audio_channels (QComboBox const * source_combo_
}
}
void Configuration::impl::set_application_font (QFont const& font)
{
qApp->setStyleSheet (qApp->styleSheet () + font_as_stylesheet (font));
}
// load all the supported rig names into the selection combo box
void Configuration::impl::enumerate_rigs ()
{

View File

@ -3,13 +3,15 @@
#include <QMouseEvent>
#include <QDateTime>
#include "qt_helpers.hpp"
#include "moc_displaytext.cpp"
DisplayText::DisplayText(QWidget *parent) :
QTextBrowser(parent)
QTextEdit(parent)
{
_fontWidth = 8; // typical
_maxDisplayedCharacters = 48; // a nominal safe(?) value
setReadOnly (true);
setCursorWidth (0);
}
void DisplayText::mouseDoubleClickEvent(QMouseEvent *e)
@ -17,26 +19,9 @@ void DisplayText::mouseDoubleClickEvent(QMouseEvent *e)
bool ctrl = (e->modifiers() & Qt::ControlModifier);
bool shift = (e->modifiers() & Qt::ShiftModifier);
emit(selectCallsign(shift,ctrl));
QTextBrowser::mouseDoubleClickEvent(e);
QTextEdit::mouseDoubleClickEvent(e);
}
void DisplayText::setFont(QFont const& font)
{
QFontMetrics qfm(font);
_fontWidth = qfm.averageCharWidth()+1; // the plus one is emperical
QTextBrowser::setFont(font);
}
void DisplayText::resizeEvent(QResizeEvent * event)
{
if (_fontWidth > 0 && _fontWidth < 999)
_maxDisplayedCharacters = width()/_fontWidth;
QTextBrowser::resizeEvent(event);
}
void DisplayText::insertLineSpacer()
{
QString tt="----------------------------------------";
@ -46,16 +31,11 @@ void DisplayText::insertLineSpacer()
void DisplayText::_insertText(const QString text, const QString bg)
{
QString tt = text.mid(0,_maxDisplayedCharacters); //truncate to max display chars
QString s = "<table border=0 cellspacing=0 width=100%><tr><td bgcolor=\"" +
bg + "\"><pre>" + tt + "</pre></td></tr></table>";
QTextCursor cursor = textCursor();
cursor.movePosition(QTextCursor::End);
QTextBlockFormat bf = cursor.blockFormat();
bf.setBackground(QBrush(QColor(bg)));
cursor.insertHtml(s);
this->setTextCursor(cursor);
bg + "\"><pre>" + text.trimmed () + "</pre></td></tr></table>";
moveCursor (QTextCursor::End);
append (s);
moveCursor (QTextCursor::End);
}
@ -74,7 +54,7 @@ void DisplayText::_appendDXCCWorkedB4(DecodedText& t1, QString& bg,
bool countryWorkedBefore;
logBook.match(/*in*/call,/*out*/countryName,callWorkedBefore,countryWorkedBefore);
int charsAvail = _maxDisplayedCharacters;
int charsAvail = 48;
// the decoder (seems) to always generate 40 chars. For a normal CQ call, the last five are spaces
// TODO this magic 36 characters is also referenced in MainWindow::doubleClickOnCall()

View File

@ -2,19 +2,17 @@
#ifndef DISPLAYTEXT_H
#define DISPLAYTEXT_H
#include <QTextBrowser>
#include <QTextEdit>
#include "logbook/logbook.h"
#include "decodedtext.h"
class DisplayText : public QTextBrowser
class DisplayText : public QTextEdit
{
Q_OBJECT
public:
explicit DisplayText(QWidget *parent = 0);
void setFont(QFont const& font);
void insertLineSpacer();
void displayDecodedText(DecodedText decodedText, QString myCall, bool displayDXCCEntity,
LogBook logBook, QColor color_CQ, QColor color_MyCall,
@ -30,11 +28,8 @@ public slots:
protected:
void mouseDoubleClickEvent(QMouseEvent *e);
void resizeEvent(QResizeEvent * event);
private:
int _fontWidth;
int _maxDisplayedCharacters;
void _insertText(const QString text, const QString bg);
void _appendDXCCWorkedB4(/*mod*/DecodedText& t1, QString &bg, LogBook logBook,
QColor color_CQ, QColor color_DXCC, QColor color_NewCall);

View File

@ -428,8 +428,6 @@ MainWindow::MainWindow(bool multiple, QSettings * settings, QSharedMemory *shdme
ui->label_9->setStyleSheet("QLabel{background-color: #aabec8}");
ui->label_10->setStyleSheet("QLabel{background-color: #aabec8}");
ui->labUTC->setStyleSheet("QLabel { background-color : black; color : yellow; }");
ui->labDialFreq->setStyleSheet("QLabel { background-color : black; color : yellow; }");
m_config.transceiver_online (true);
on_monitorButton_clicked (!m_config.monitor_off_at_startup ());
@ -563,10 +561,11 @@ void MainWindow::readSettings()
void MainWindow::setDecodedTextFont (QFont const& font)
{
ui->decodedTextBrowser->setFont (font);
ui->decodedTextBrowser2->setFont (font);
ui->decodedTextLabel->setFont (font);
ui->decodedTextLabel2->setFont (font);
auto style_sheet = font_as_stylesheet (font);
ui->decodedTextBrowser->setStyleSheet (ui->decodedTextBrowser->styleSheet () + style_sheet);
ui->decodedTextBrowser2->setStyleSheet (ui->decodedTextBrowser2->styleSheet () + style_sheet);
ui->decodedTextLabel->setStyleSheet (ui->decodedTextLabel->styleSheet () + style_sheet);
ui->decodedTextLabel2->setStyleSheet (ui->decodedTextLabel2->styleSheet () + style_sheet);
}
//-------------------------------------------------------------- dataSink()
@ -943,14 +942,11 @@ void MainWindow::displayDialFrequency ()
valid = true;
}
}
if (valid)
{
ui->labDialFreq->setStyleSheet("QLabel { background-color : black; color : yellow; }");
}
else
{
ui->labDialFreq->setStyleSheet("QLabel { background-color : red; color : yellow; }");
}
ui->labDialFreq->setProperty ("oob", !valid);
// the following sequence is necessary to update the style
ui->labDialFreq->style ()->unpolish (ui->labDialFreq);
ui->labDialFreq->style ()->polish (ui->labDialFreq);
ui->labDialFreq->update ();
ui->labDialFreq->setText (Radio::pretty_frequency_MHz_string (m_dialFreq));
}

View File

@ -45,6 +45,7 @@ namespace Ui {
class QSettings;
class QLineEdit;
class QFont;
class WideGraph;
class LogQSO;
class Transceiver;

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>770</width>
<height>491</height>
<height>541</height>
</rect>
</property>
<property name="sizePolicy">
@ -59,56 +59,6 @@
<property name="verticalSpacing">
<number>1</number>
</property>
<item row="4" column="0">
<widget class="DisplayText" name="decodedTextBrowser">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>200</width>
<height>100</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>600</width>
<height>1000</height>
</size>
</property>
<property name="font">
<font>
<family>Courier New</family>
<pointsize>10</pointsize>
</font>
</property>
<property name="frameShape">
<enum>QFrame::Panel</enum>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOn</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="html">
<string notr="true">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Courier New'; font-size:10pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="acceptRichText">
<bool>false</bool>
</property>
<property name="openLinks">
<bool>false</bool>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLabel" name="decodedTextLabel2">
<property name="minimumSize">
@ -293,40 +243,6 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="DisplayText" name="decodedTextBrowser2">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>200</width>
<height>100</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>600</width>
<height>1000</height>
</size>
</property>
<property name="font">
<font>
<family>Courier New</family>
<pointsize>10</pointsize>
</font>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOn</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="label_7">
<property name="maximumSize">
@ -393,6 +309,91 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="DisplayText" name="decodedTextBrowser">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>1</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>200</width>
<height>100</height>
</size>
</property>
<property name="acceptDrops">
<bool>false</bool>
</property>
<property name="frameShape">
<enum>QFrame::Panel</enum>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOn</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAsNeeded</enum>
</property>
<property name="undoRedoEnabled">
<bool>false</bool>
</property>
<property name="html">
<string notr="true">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="acceptRichText">
<bool>false</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="DisplayText" name="decodedTextBrowser2">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>1</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>200</width>
<height>100</height>
</size>
</property>
<property name="acceptDrops">
<bool>false</bool>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOn</enum>
</property>
<property name="undoRedoEnabled">
<bool>false</bool>
</property>
<property name="html">
<string notr="true">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="acceptRichText">
<bool>false</bool>
</property>
<property name="cursorWidth">
<number>0</number>
</property>
<property name="textInteractionFlags">
<set>Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
</layout>
</item>
<item>
@ -431,24 +432,12 @@ p, li { white-space: pre-wrap; }
</item>
<item>
<widget class="QPushButton" name="monitorButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>50</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Start monitoring</string>
</property>
@ -522,12 +511,6 @@ p, li { white-space: pre-wrap; }
</item>
<item>
<widget class="QPushButton" name="autoButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>50</width>
@ -558,12 +541,6 @@ p, li { white-space: pre-wrap; }
</item>
<item>
<widget class="QPushButton" name="stopTxButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>50</width>
@ -960,16 +937,21 @@ p, li { white-space: pre-wrap; }
<height>16777215</height>
</size>
</property>
<property name="font">
<font>
<pointsize>16</pointsize>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="toolTip">
<string>USB dial frequency</string>
</property>
<property name="styleSheet">
<string notr="true">QLabel {
font-family: MS Shell Dlg 2;
font-size: 16pt;
color : yellow;
background-color : black;
}
QLabel[oob=&quot;true&quot;] {
background-color: red;
}
</string>
</property>
<property name="text">
<string>14.078</string>
</property>
@ -1166,10 +1148,13 @@ p, li { white-space: pre-wrap; }
<height>60</height>
</size>
</property>
<property name="font">
<font>
<pointsize>16</pointsize>
</font>
<property name="styleSheet">
<string notr="true">QLabel {
font-family: MS Shell Dlg 2;
font-size: 16pt;
background-color : black;
color : yellow;
}</string>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
@ -2703,7 +2688,7 @@ list. The list can be maintained in Settings (F2).</string>
<customwidgets>
<customwidget>
<class>DisplayText</class>
<extends>QTextBrowser</extends>
<extends>QTextEdit</extends>
<header>displaytext.h</header>
</customwidget>
</customwidgets>
@ -2742,8 +2727,6 @@ list. The list can be maintained in Settings (F2).</string>
<tabstop>txb4</tabstop>
<tabstop>txb5</tabstop>
<tabstop>txb6</tabstop>
<tabstop>decodedTextBrowser</tabstop>
<tabstop>decodedTextBrowser2</tabstop>
<tabstop>genMsg</tabstop>
<tabstop>pbAnswerCaller</tabstop>
<tabstop>rbFreeText</tabstop>

26
qt_helpers.cpp Normal file
View File

@ -0,0 +1,26 @@
#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);
}

View File

@ -66,4 +66,6 @@ void throw_qstring (QString const& qs)
throw std::runtime_error (qs.toLocal8Bit ().data ());
}
QString font_as_stylesheet (QFont const&);
#endif