6 #include <QKeySequence>
8 #include <QRegularExpression>
10 #include <QStringBuilder>
13 #include "ui_settingstextmessagestyle.h"
49 void CSettingsTextMessageStyle::changeFont()
51 if (!m_fontSettingsDialog)
61 this->setFontFamilySizeStyle(familySizeStyle);
66 void CSettingsTextMessageStyle::changeStyle()
68 if (!m_textEditDialog)
70 m_textEditDialog =
new CTextEditDialog(
this);
71 m_textEditDialog->
resize(400, 300);
83 bool CSettingsTextMessageStyle::setFontFamilySizeStyle(
const QStringList &familySizeStlye)
85 if (familySizeStlye.
size() != 3) {
return false; }
86 static const QString f(
"font-family: \"%1\"; font-size: %2; font-style: %3");
89 u
"table { " % f.
arg(familySizeStlye.
at(0), familySizeStlye.
at(1), familySizeStlye.
at(2)) % u
" }";
90 this->replaceTableStyle(tableStyle);
94 void CSettingsTextMessageStyle::replaceTableStyle(
const QString &newTableStyle)
98 style.replace(re, newTableStyle);
104 if (this->changeFontSize(
false)) { emit this->
changed(); }
109 if (this->changeFontSize(
true)) { emit this->
changed(); }
112 bool CSettingsTextMessageStyle::changeFontSize(
bool increase)
118 if (matches.
size() != 2) {
return false; }
121 int ptSize = matches.
last().toInt(&ok);
122 if (!ok) {
return false; }
126 if (ptSize > 16) {
return false; }
131 if (ptSize < 6) {
return false; }
138 this->replaceTableStyle(tableStyle);
void setWithColorSelection(bool withColor)
With color selection.
QStringList getFamilySizeStyle() const
Family, size and style.
virtual ~CSettingsTextMessageStyle()
Destructor.
CSettingsTextMessageStyle(QWidget *parent=nullptr)
Constructor.
QStringList getFamilySizeStyle() const
Fmily, size and style.
void fontSizeMinus()
Font size.
void changed()
Font or style changed from within the component.
void resetStyle()
Reset style.
void fontSizePlus()
Font size.
QTextEdit * textEdit() const
Access to text edit.
High level reusable GUI components.
QList< T >::const_reference at(qsizetype i) const const
QList< T >::reference front()
qsizetype size() const const
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
QStringList capturedTexts() const const
QString arg(Args &&... args) const const
QString number(double n, char format, int precision)
QString & replace(QChar before, QChar after, Qt::CaseSensitivity cs)
void setPlainText(const QString &text)
QString toPlainText() const const