17 #include <QFontComboBox>
22 #include <QVBoxLayout>
23 #include "../../backend/config/btconfig.h"
24 #include "../../backend/config/btconfigcore.h"
25 #include "../../util/btassert.h"
26 #include "../../util/btconnect.h"
27 #include "../../util/cresmgr.h"
28 #include "../display/btcolorwidget.h"
29 #include "../display/btfontsizewidget.h"
33 class QTextCharFormat;
48 , m_handingFormatChangeFromEditor(false)
50 QVBoxLayout * verticalLayout =
new QVBoxLayout(
this);
65 [
this](QTextCharFormat
const &) {
75 m_actions.underline->setChecked(f.underline());
146 m_actions.italic->setToolTip(tr(
"Italic"));
147 m_actions.underline->setText(tr(
"Underline"));
148 m_actions.underline->setToolTip(tr(
"Underline"));
149 m_actions.alignLeft->setText(tr(
"Left"));
150 m_actions.alignLeft->setToolTip(tr(
"Align left"));
151 m_actions.alignCenter->setText(tr(
"Center"));
152 m_actions.alignCenter->setToolTip(tr(
"Align center"));
153 m_actions.alignRight->setText(tr(
"Right"));
154 m_actions.alignRight->setToolTip(tr(
"Align right"));
175 CResMgr::displaywindows::writeWindow::boldText::icon());
180 [
this](
bool const checked) {
181 if (!m_handingFormatChangeFromEditor)
182 m_htmlTextEdit->setFontWeight(
183 checked ? QFont::Bold : QFont::Normal);
189 CResMgr::displaywindows::writeWindow::italicText::icon());
191 m_actions.italic->setChecked(f.italic());
194 [
this](
bool const checked) {
195 if (!m_handingFormatChangeFromEditor)
196 m_htmlTextEdit->setFontItalic(checked);
202 CResMgr::displaywindows::writeWindow::underlinedText::icon());
204 m_actions.underline->setChecked(f.underline());
207 [
this](
bool const checked) {
208 if (!m_handingFormatChangeFromEditor)
209 m_htmlTextEdit->setFontUnderline(checked);
215 CResMgr::displaywindows::writeWindow::alignLeft::icon());
219 [
this](
bool const set) {
220 if (!m_handingFormatChangeFromEditor
222 && (m_htmlTextEdit->alignment() != Qt::AlignLeft))
224 m_htmlTextEdit->setAlignment(Qt::AlignLeft);
225 alignmentChanged(Qt::AlignLeft);
230 m_actions.alignCenter =
new QAction(
this);
231 m_actions.alignCenter->setIcon(
232 CResMgr::displaywindows::writeWindow::alignCenter::icon());
233 m_actions.alignCenter->setCheckable(
true);
235 BT_CONNECT(m_actions.alignCenter, &QAction::toggled,
236 [
this](
bool const set) {
237 if (!m_handingFormatChangeFromEditor
239 && (m_htmlTextEdit->alignment() != Qt::AlignHCenter))
241 m_htmlTextEdit->setAlignment(Qt::AlignHCenter);
242 alignmentChanged(Qt::AlignHCenter);
247 m_actions.alignRight =
new QAction(
this);
248 m_actions.alignRight->setIcon(
249 CResMgr::displaywindows::writeWindow::alignRight::icon());
250 m_actions.alignRight->setCheckable(
true);
252 BT_CONNECT(m_actions.alignRight, &QAction::toggled,
253 [
this](
bool const set) {
254 if (!m_handingFormatChangeFromEditor
256 && (m_htmlTextEdit->alignment() != Qt::AlignRight))
258 m_htmlTextEdit->setAlignment(Qt::AlignRight);
259 alignmentChanged(Qt::AlignRight);
271 if (a & Qt::AlignLeft) {
274 else if ((a & Qt::AlignHCenter) || (a & Qt::AlignCenter)) {
277 else if (a & Qt::AlignRight) {
282 qWarning(
"unknown alignment %i", a);
300 [
this](QFont
const & font) {
306 Qt::DirectConnection);
313 [
this](
int const newSize) {
316 static_cast<qreal
>(newSize));
320 Qt::DirectConnection);
328 Qt::DirectConnection);
331 Qt::DirectConnection);
BtConfig & btConfig()
This is a shortchand for BtConfig::getInstance().
BtConfigCore group(Prefix &&prefix) const &
void setValue(QString const &key, T const &value)
Sets a value for a key.
BtConfigCore session() const
BtEditTextPage(BtEditTextWizard &parent)
BtEditTextWizard & m_wizard
QTextEdit * m_plainTextEdit
void cleanupPage() final override
bool validatePage() final override
BtFontSizeWidget * m_fontSizeWidget
BtColorWidget * m_fontColorChooser
void setText(const QString &text)
void alignmentChanged(int)
QFontComboBox * m_fontFamilyComboBox
void signalFontColorChanged(const QColor &)
void signalFontChanged(const QFont &)
struct BtEditTextPage::@8 m_actions
void initializePage() final override
bool m_handingFormatChangeFromEditor
void setFont(const QFont &font)
QTextEdit * m_htmlTextEdit
void signalFontSizeChanged(int)
The Edit Text wizard for editing the personal commentary.
auto const CHTMLWriteDisplayFontColorKey
auto const CHTMLWriteDisplayFontKey
auto const CHTMLWriteDisplayGroup