Make addon prefixes & suffixes help window platform independent

Also use a style  sheet to set the font as  widget level font settings
are overriden when the global default font is changed in settings.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@5553 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Bill Somerville 2015-06-08 14:30:31 +00:00
parent a524b90f88
commit 05a060c740
2 changed files with 14 additions and 19 deletions

View File

@ -18,6 +18,7 @@
#include <QHostInfo>
#include "revision_utils.hpp"
#include "qt_helpers.hpp"
#include "soundout.h"
#include "plotter.h"
#include "echoplot.h"
@ -3774,31 +3775,25 @@ void MainWindow::on_actionShort_list_of_add_on_prefixes_and_suffixes_triggered()
msgBox("Cannot open \"" + f.fileName () + "\" for reading:" + f.errorString ());
return;
}
m_prefixes.reset (new QTextEdit);
m_prefixes->setReadOnly(true);
m_prefixes.reset (new QLabel {
QTextStream {&f}.readAll ()
, nullptr
, Qt::WindowCloseButtonHint | Qt::WindowMinimizeButtonHint
});
m_prefixes->setWindowTitle(QApplication::applicationName () +
" - " + tr ("Prefixes"));
m_prefixes->setTextFormat (Qt::PlainText);
m_prefixes->setMargin (10);
m_prefixes->setBackgroundRole (QPalette::Base);
m_prefixes->setAutoFillBackground (true);
// Formatting in columns thanks to Sandro, IW3RAB:
m_prefixes->setWordWrapMode (QTextOption::NoWrap);
QFont font;
font.setFamily("Courier");
font.setStyleHint(QFont::Monospace);
font.setFixedPitch(true);
font.setPointSize(10); //as for decoded text
m_prefixes->setFont(font);
m_prefixes->setWindowTitle(QApplication::applicationName () +
" - " + tr ("Prefixes"));
m_prefixes->setGeometry(QRect(45,50,750,450));
Qt::WindowFlags flags = Qt::WindowCloseButtonHint |
Qt::WindowMinimizeButtonHint;
m_prefixes->setWindowFlags(flags);
QTextStream s(&f);
QString t;
for(int i=0; i<100; i++) {
t=s.readLine();
m_prefixes->append(t);
if(s.atEnd()) break;
}
m_prefixes->setStyleSheet (font_as_stylesheet (font));
}
m_prefixes->showNormal();
}

View File

@ -275,7 +275,7 @@ private:
QScopedPointer<LogQSO> m_logDlg;
QScopedPointer<Astro> m_astroWidget;
QScopedPointer<QTextEdit> m_shortcuts;
QScopedPointer<QTextEdit> m_prefixes;
QScopedPointer<QLabel> m_prefixes;
QScopedPointer<QTextEdit> m_mouseCmnds;
QScopedPointer<MessageAveraging> m_msgAvgWidget;