mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2025-07-03 10:25:15 -04:00
Sort out decoded text font and font changes
git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@5159 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
parent
4b0d7f2d18
commit
868ce60f7e
@ -2,6 +2,9 @@
|
|||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
|
#include <QTextCharFormat>
|
||||||
|
#include <QFont>
|
||||||
|
#include <QTextCursor>
|
||||||
|
|
||||||
#include "qt_helpers.hpp"
|
#include "qt_helpers.hpp"
|
||||||
|
|
||||||
@ -14,6 +17,20 @@ DisplayText::DisplayText(QWidget *parent) :
|
|||||||
viewport ()->setCursor (Qt::ArrowCursor);
|
viewport ()->setCursor (Qt::ArrowCursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DisplayText::setContentFont(QFont const& font)
|
||||||
|
{
|
||||||
|
document ()->setDefaultFont (font);
|
||||||
|
QTextCharFormat format;
|
||||||
|
format.setFont (font);
|
||||||
|
selectAll ();
|
||||||
|
auto cursor = textCursor ();
|
||||||
|
cursor.mergeCharFormat (format);
|
||||||
|
cursor.clearSelection ();
|
||||||
|
cursor.movePosition (QTextCursor::End);
|
||||||
|
setTextCursor (cursor);
|
||||||
|
ensureCursorVisible ();
|
||||||
|
}
|
||||||
|
|
||||||
void DisplayText::mouseDoubleClickEvent(QMouseEvent *e)
|
void DisplayText::mouseDoubleClickEvent(QMouseEvent *e)
|
||||||
{
|
{
|
||||||
bool ctrl = (e->modifiers() & Qt::ControlModifier);
|
bool ctrl = (e->modifiers() & Qt::ControlModifier);
|
||||||
@ -36,6 +53,7 @@ void DisplayText::_insertText(const QString text, const QString bg)
|
|||||||
moveCursor (QTextCursor::End);
|
moveCursor (QTextCursor::End);
|
||||||
append (s);
|
append (s);
|
||||||
moveCursor (QTextCursor::End);
|
moveCursor (QTextCursor::End);
|
||||||
|
ensureCursorVisible ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@ class DisplayText : public QTextEdit
|
|||||||
public:
|
public:
|
||||||
explicit DisplayText(QWidget *parent = 0);
|
explicit DisplayText(QWidget *parent = 0);
|
||||||
|
|
||||||
|
void setContentFont (QFont const&);
|
||||||
void insertLineSpacer();
|
void insertLineSpacer();
|
||||||
void displayDecodedText(DecodedText decodedText, QString myCall, bool displayDXCCEntity,
|
void displayDecodedText(DecodedText decodedText, QString myCall, bool displayDXCCEntity,
|
||||||
LogBook logBook, QColor color_CQ, QColor color_MyCall,
|
LogBook logBook, QColor color_CQ, QColor color_MyCall,
|
||||||
|
@ -596,9 +596,9 @@ void MainWindow::readSettings()
|
|||||||
|
|
||||||
void MainWindow::setDecodedTextFont (QFont const& font)
|
void MainWindow::setDecodedTextFont (QFont const& font)
|
||||||
{
|
{
|
||||||
|
ui->decodedTextBrowser->setContentFont (font);
|
||||||
|
ui->decodedTextBrowser2->setContentFont (font);
|
||||||
auto style_sheet = font_as_stylesheet (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->decodedTextLabel->setStyleSheet (ui->decodedTextLabel->styleSheet () + style_sheet);
|
||||||
ui->decodedTextLabel2->setStyleSheet (ui->decodedTextLabel2->styleSheet () + style_sheet);
|
ui->decodedTextLabel2->setStyleSheet (ui->decodedTextLabel2->styleSheet () + style_sheet);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user