Added text alignment (#1892)
This commit is contained in:
@@ -5,80 +5,86 @@
|
||||
<file>img/app/org.flameshot.Flameshot.png</file>
|
||||
<file>img/app/flameshot.png</file>
|
||||
<file>img/app/keyboard.svg</file>
|
||||
<file>img/material/black/delete.svg</file>
|
||||
<file>img/material/black/undo-variant.svg</file>
|
||||
<file>img/material/black/text.svg</file>
|
||||
<file>img/material/black/square.svg</file>
|
||||
<file>img/material/black/square-outline.svg</file>
|
||||
<file>img/material/black/size_indicator.svg</file>
|
||||
<file>img/material/black/redo-variant.svg</file>
|
||||
<file>img/material/black/pin.svg</file>
|
||||
<file>img/material/black/pencil.svg</file>
|
||||
<file>img/material/black/open_with.svg</file>
|
||||
<file>img/material/black/name_edition.svg</file>
|
||||
<file>img/material/black/mouse.svg</file>
|
||||
<file>img/material/black/mouse-off.svg</file>
|
||||
<file>img/material/black/marker.svg</file>
|
||||
<file>img/material/black/line.svg</file>
|
||||
<file>img/material/black/graphics.svg</file>
|
||||
<file>img/material/black/format-text.svg</file>
|
||||
<file>img/material/black/format_underlined.svg</file>
|
||||
<file>img/material/black/format_strikethrough.svg</file>
|
||||
<file>img/material/black/format_italic.svg</file>
|
||||
<file>img/material/black/format_bold.svg</file>
|
||||
<file>img/material/black/exit-to-app.svg</file>
|
||||
<file>img/material/black/cursor-move.svg</file>
|
||||
<file>img/material/black/content-save.svg</file>
|
||||
<file>img/material/black/content-copy.svg</file>
|
||||
<file>img/material/black/config.svg</file>
|
||||
<file>img/material/black/colorize.svg</file>
|
||||
<file>img/material/black/cloud-upload.svg</file>
|
||||
<file>img/material/black/close.svg</file>
|
||||
<file>img/material/black/circle-outline.svg</file>
|
||||
<file>img/material/black/pixelate.svg</file>
|
||||
<file>img/material/black/arrow-bottom-left.svg</file>
|
||||
<file>img/material/white/undo-variant.svg</file>
|
||||
<file>img/material/white/text.svg</file>
|
||||
<file>img/material/white/square.svg</file>
|
||||
<file>img/material/white/square-outline.svg</file>
|
||||
<file>img/material/white/size_indicator.svg</file>
|
||||
<file>img/material/white/redo-variant.svg</file>
|
||||
<file>img/material/white/pin.svg</file>
|
||||
<file>img/material/white/pencil.svg</file>
|
||||
<file>img/material/white/open_with.svg</file>
|
||||
<file>img/material/white/name_edition.svg</file>
|
||||
<file>img/material/white/mouse.svg</file>
|
||||
<file>img/material/white/mouse-off.svg</file>
|
||||
<file>img/material/white/marker.svg</file>
|
||||
<file>img/material/white/line.svg</file>
|
||||
<file>img/material/white/graphics.svg</file>
|
||||
<file>img/material/white/format-text.svg</file>
|
||||
<file>img/material/white/format_underlined.svg</file>
|
||||
<file>img/material/white/format_strikethrough.svg</file>
|
||||
<file>img/material/white/format_italic.svg</file>
|
||||
<file>img/material/white/format_bold.svg</file>
|
||||
<file>img/material/white/exit-to-app.svg</file>
|
||||
<file>img/material/white/cursor-move.svg</file>
|
||||
<file>img/material/white/content-save.svg</file>
|
||||
<file>img/material/white/content-copy.svg</file>
|
||||
<file>img/material/white/config.svg</file>
|
||||
<file>img/material/white/colorize.svg</file>
|
||||
<file>img/material/white/cloud-upload.svg</file>
|
||||
<file>img/material/white/close.svg</file>
|
||||
<file>img/material/white/circle-outline.svg</file>
|
||||
<file>img/material/white/pixelate.svg</file>
|
||||
<file>img/material/white/arrow-bottom-left.svg</file>
|
||||
<file>img/material/black/centeralign.svg</file>
|
||||
<file>img/material/black/circle-outline.svg</file>
|
||||
<file>img/material/black/close.svg</file>
|
||||
<file>img/material/black/cloud-upload.svg</file>
|
||||
<file>img/material/black/colorize.svg</file>
|
||||
<file>img/material/black/config.svg</file>
|
||||
<file>img/material/black/content-copy.svg</file>
|
||||
<file>img/material/black/content-save.svg</file>
|
||||
<file>img/material/black/cursor-move.svg</file>
|
||||
<file>img/material/black/delete.svg</file>
|
||||
<file>img/material/black/exit-to-app.svg</file>
|
||||
<file>img/material/black/format-text.svg</file>
|
||||
<file>img/material/black/format_bold.svg</file>
|
||||
<file>img/material/black/format_italic.svg</file>
|
||||
<file>img/material/black/format_strikethrough.svg</file>
|
||||
<file>img/material/black/format_underlined.svg</file>
|
||||
<file>img/material/black/graphics.svg</file>
|
||||
<file>img/material/black/leftalign.svg</file>
|
||||
<file>img/material/black/line.svg</file>
|
||||
<file>img/material/black/marker.svg</file>
|
||||
<file>img/material/black/mouse-off.svg</file>
|
||||
<file>img/material/black/mouse.svg</file>
|
||||
<file>img/material/black/name_edition.svg</file>
|
||||
<file>img/material/black/open_with.svg</file>
|
||||
<file>img/material/black/pencil.svg</file>
|
||||
<file>img/material/black/pin.svg</file>
|
||||
<file>img/material/black/pixelate.svg</file>
|
||||
<file>img/material/black/redo-variant.svg</file>
|
||||
<file>img/material/black/rightalign.svg</file>
|
||||
<file>img/material/black/size_indicator.svg</file>
|
||||
<file>img/material/black/square-outline.svg</file>
|
||||
<file>img/material/black/square.svg</file>
|
||||
<file>img/material/black/text.svg</file>
|
||||
<file>img/material/black/undo-variant.svg</file>
|
||||
<file>img/material/black/circlecount-outline.svg</file>
|
||||
<file>img/material/white/circlecount-outline.svg</file>
|
||||
<file>img/material/black/shortcut.svg</file>
|
||||
<file>img/material/white/shortcut.svg</file>
|
||||
<file>img/material/black/filepath.svg</file>
|
||||
<file>img/material/white/filepath.svg</file>
|
||||
<file>img/material/black/plus.svg</file>
|
||||
<file>img/material/white/plus.svg</file>
|
||||
<file>img/material/black/minus.svg</file>
|
||||
<file>img/material/white/minus.svg</file>
|
||||
<file>img/material/black/invert.svg</file>
|
||||
<file>img/material/black/minus.svg</file>
|
||||
<file>img/material/black/plus.svg</file>
|
||||
<file>img/material/black/shortcut.svg</file>
|
||||
<file>img/material/white/arrow-bottom-left.svg</file>
|
||||
<file>img/material/white/centeralign.svg</file>
|
||||
<file>img/material/white/circle-outline.svg</file>
|
||||
<file>img/material/white/circlecount-outline.svg</file>
|
||||
<file>img/material/white/close.svg</file>
|
||||
<file>img/material/white/cloud-upload.svg</file>
|
||||
<file>img/material/white/colorize.svg</file>
|
||||
<file>img/material/white/config.svg</file>
|
||||
<file>img/material/white/content-copy.svg</file>
|
||||
<file>img/material/white/content-save.svg</file>
|
||||
<file>img/material/white/cursor-move.svg</file>
|
||||
<file>img/material/white/exit-to-app.svg</file>
|
||||
<file>img/material/white/filepath.svg</file>
|
||||
<file>img/material/white/format-text.svg</file>
|
||||
<file>img/material/white/format_bold.svg</file>
|
||||
<file>img/material/white/format_italic.svg</file>
|
||||
<file>img/material/white/format_strikethrough.svg</file>
|
||||
<file>img/material/white/format_underlined.svg</file>
|
||||
<file>img/material/white/graphics.svg</file>
|
||||
<file>img/material/white/invert.svg</file>
|
||||
<file>img/material/white/leftalign.svg</file>
|
||||
<file>img/material/white/line.svg</file>
|
||||
<file>img/material/white/marker.svg</file>
|
||||
<file>img/material/white/minus.svg</file>
|
||||
<file>img/material/white/mouse-off.svg</file>
|
||||
<file>img/material/white/mouse.svg</file>
|
||||
<file>img/material/white/name_edition.svg</file>
|
||||
<file>img/material/white/open_with.svg</file>
|
||||
<file>img/material/white/pencil.svg</file>
|
||||
<file>img/material/white/pin.svg</file>
|
||||
<file>img/material/white/pixelate.svg</file>
|
||||
<file>img/material/white/plus.svg</file>
|
||||
<file>img/material/white/redo-variant.svg</file>
|
||||
<file>img/material/white/rightalign.svg</file>
|
||||
<file>img/material/white/shortcut.svg</file>
|
||||
<file>img/material/white/size_indicator.svg</file>
|
||||
<file>img/material/white/square-outline.svg</file>
|
||||
<file>img/material/white/square.svg</file>
|
||||
<file>img/material/white/text.svg</file>
|
||||
<file>img/material/white/undo-variant.svg</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
29
data/img/material/black/centeralign.svg
Normal file
29
data/img/material/black/centeralign.svg
Normal file
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
viewBox="0 0 80 80"
|
||||
version="1.1">
|
||||
<rect
|
||||
style="fill:#000000"
|
||||
width="80"
|
||||
height="10"
|
||||
x="1"
|
||||
y="10" />
|
||||
<rect
|
||||
style="fill:#000000"
|
||||
width="60"
|
||||
height="10"
|
||||
x="10"
|
||||
y="30" />
|
||||
<rect
|
||||
style="fill:#000000"
|
||||
width="80"
|
||||
height="10"
|
||||
x="1"
|
||||
y="50" />
|
||||
<rect
|
||||
style="fill:#000000"
|
||||
width="60"
|
||||
height="10"
|
||||
x="10"
|
||||
y="70" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 529 B |
29
data/img/material/black/leftalign.svg
Normal file
29
data/img/material/black/leftalign.svg
Normal file
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
viewBox="0 0 80 80"
|
||||
version="1.1">
|
||||
<rect
|
||||
style="fill:#000000"
|
||||
width="80"
|
||||
height="10"
|
||||
x="1"
|
||||
y="10" />
|
||||
<rect
|
||||
style="fill:#000000"
|
||||
width="60"
|
||||
height="10"
|
||||
x="1"
|
||||
y="30" />
|
||||
<rect
|
||||
style="fill:#000000"
|
||||
width="80"
|
||||
height="10"
|
||||
x="1"
|
||||
y="50" />
|
||||
<rect
|
||||
style="fill:#000000"
|
||||
width="60"
|
||||
height="10"
|
||||
x="1"
|
||||
y="70" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 527 B |
29
data/img/material/black/rightalign.svg
Normal file
29
data/img/material/black/rightalign.svg
Normal file
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
viewBox="0 0 80 80"
|
||||
version="1.1">
|
||||
<rect
|
||||
style="fill:#000000"
|
||||
width="80"
|
||||
height="10"
|
||||
x="1"
|
||||
y="10" />
|
||||
<rect
|
||||
style="fill:#000000"
|
||||
width="60"
|
||||
height="10"
|
||||
x="20"
|
||||
y="30" />
|
||||
<rect
|
||||
style="fill:#000000"
|
||||
width="80"
|
||||
height="10"
|
||||
x="1"
|
||||
y="50" />
|
||||
<rect
|
||||
style="fill:#000000"
|
||||
width="60"
|
||||
height="10"
|
||||
x="20"
|
||||
y="70" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 529 B |
29
data/img/material/white/centeralign.svg
Normal file
29
data/img/material/white/centeralign.svg
Normal file
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
viewBox="0 0 80 80"
|
||||
version="1.1">
|
||||
<rect
|
||||
style="fill:#ffffff"
|
||||
width="80"
|
||||
height="10"
|
||||
x="1"
|
||||
y="10" />
|
||||
<rect
|
||||
style="fill:#ffffff"
|
||||
width="60"
|
||||
height="10"
|
||||
x="10"
|
||||
y="30" />
|
||||
<rect
|
||||
style="fill:#ffffff"
|
||||
width="80"
|
||||
height="10"
|
||||
x="1"
|
||||
y="50" />
|
||||
<rect
|
||||
style="fill:#ffffff"
|
||||
width="60"
|
||||
height="10"
|
||||
x="10"
|
||||
y="70" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 529 B |
29
data/img/material/white/leftalign.svg
Normal file
29
data/img/material/white/leftalign.svg
Normal file
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
viewBox="0 0 80 80"
|
||||
version="1.1">
|
||||
<rect
|
||||
style="fill:#ffffff"
|
||||
width="80"
|
||||
height="10"
|
||||
x="1"
|
||||
y="10" />
|
||||
<rect
|
||||
style="fill:#ffffff"
|
||||
width="60"
|
||||
height="10"
|
||||
x="1"
|
||||
y="30" />
|
||||
<rect
|
||||
style="fill:#ffffff"
|
||||
width="80"
|
||||
height="10"
|
||||
x="1"
|
||||
y="50" />
|
||||
<rect
|
||||
style="fill:#ffffff"
|
||||
width="60"
|
||||
height="10"
|
||||
x="1"
|
||||
y="70" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 527 B |
29
data/img/material/white/rightalign.svg
Normal file
29
data/img/material/white/rightalign.svg
Normal file
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
viewBox="0 0 80 80"
|
||||
version="1.1">
|
||||
<rect
|
||||
style="fill:#ffffff"
|
||||
width="80"
|
||||
height="10"
|
||||
x="1"
|
||||
y="10" />
|
||||
<rect
|
||||
style="fill:#ffffff"
|
||||
width="60"
|
||||
height="10"
|
||||
x="20"
|
||||
y="30" />
|
||||
<rect
|
||||
style="fill:#ffffff"
|
||||
width="80"
|
||||
height="10"
|
||||
x="1"
|
||||
y="50" />
|
||||
<rect
|
||||
style="fill:#ffffff"
|
||||
width="60"
|
||||
height="10"
|
||||
x="20"
|
||||
y="70" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 529 B |
@@ -18,6 +18,9 @@ TextConfig::TextConfig(QWidget* parent)
|
||||
, m_underlineButton(nullptr)
|
||||
, m_weightButton(nullptr)
|
||||
, m_italicButton(nullptr)
|
||||
, m_leftAlignButton(nullptr)
|
||||
, m_centerAlignButton(nullptr)
|
||||
, m_rightAlignButton(nullptr)
|
||||
{
|
||||
m_layout = new QVBoxLayout(this);
|
||||
|
||||
@@ -71,12 +74,42 @@ TextConfig::TextConfig(QWidget* parent)
|
||||
m_italicButton->setToolTip(tr("Italic"));
|
||||
QHBoxLayout* modifiersLayout = new QHBoxLayout();
|
||||
|
||||
m_leftAlignButton =
|
||||
new QPushButton(QIcon(iconPrefix + "leftalign.svg"), QLatin1String(""));
|
||||
m_leftAlignButton->setCheckable(true);
|
||||
connect(m_leftAlignButton, &QPushButton::clicked, this, [this] {
|
||||
alignmentChanged(Qt::AlignLeft);
|
||||
});
|
||||
m_leftAlignButton->setToolTip(tr("Left Align"));
|
||||
|
||||
m_centerAlignButton =
|
||||
new QPushButton(QIcon(iconPrefix + "centeralign.svg"), QLatin1String(""));
|
||||
m_centerAlignButton->setCheckable(true);
|
||||
connect(m_centerAlignButton, &QPushButton::clicked, this, [this] {
|
||||
alignmentChanged(Qt::AlignCenter);
|
||||
});
|
||||
m_centerAlignButton->setToolTip(tr("Center Align"));
|
||||
|
||||
m_rightAlignButton =
|
||||
new QPushButton(QIcon(iconPrefix + "rightalign.svg"), QLatin1String(""));
|
||||
m_rightAlignButton->setCheckable(true);
|
||||
connect(m_rightAlignButton, &QPushButton::clicked, this, [this] {
|
||||
alignmentChanged(Qt::AlignRight);
|
||||
});
|
||||
m_rightAlignButton->setToolTip(tr("Right Align"));
|
||||
|
||||
QHBoxLayout* alignmentLayout = new QHBoxLayout();
|
||||
alignmentLayout->addWidget(m_leftAlignButton);
|
||||
alignmentLayout->addWidget(m_centerAlignButton);
|
||||
alignmentLayout->addWidget(m_rightAlignButton);
|
||||
|
||||
m_layout->addWidget(m_fontsCB);
|
||||
modifiersLayout->addWidget(m_strikeOutButton);
|
||||
modifiersLayout->addWidget(m_underlineButton);
|
||||
modifiersLayout->addWidget(m_weightButton);
|
||||
modifiersLayout->addWidget(m_italicButton);
|
||||
m_layout->addLayout(modifiersLayout);
|
||||
m_layout->addLayout(alignmentLayout);
|
||||
}
|
||||
|
||||
void TextConfig::setFontFamily(const QString& fontFamily)
|
||||
@@ -113,3 +146,28 @@ void TextConfig::weightButtonPressed(const bool w)
|
||||
emit fontWeightChanged(QFont::Normal);
|
||||
}
|
||||
}
|
||||
|
||||
void TextConfig::setTextAlignment(Qt::AlignmentFlag alignment)
|
||||
{
|
||||
|
||||
switch (alignment) {
|
||||
case (Qt::AlignLeft):
|
||||
m_leftAlignButton->setChecked(true);
|
||||
m_centerAlignButton->setChecked(false);
|
||||
m_rightAlignButton->setChecked(false);
|
||||
break;
|
||||
|
||||
case (Qt::AlignCenter):
|
||||
m_leftAlignButton->setChecked(false);
|
||||
m_centerAlignButton->setChecked(true);
|
||||
m_rightAlignButton->setChecked(false);
|
||||
break;
|
||||
|
||||
case (Qt::AlignRight):
|
||||
m_leftAlignButton->setChecked(false);
|
||||
m_centerAlignButton->setChecked(false);
|
||||
m_rightAlignButton->setChecked(true);
|
||||
break;
|
||||
}
|
||||
emit alignmentChanged(alignment);
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ public:
|
||||
void setStrikeOut(const bool s);
|
||||
void setWeight(const int w);
|
||||
void setItalic(const bool i);
|
||||
void setTextAlignment(Qt::AlignmentFlag alignment);
|
||||
|
||||
signals:
|
||||
void fontFamilyChanged(const QString& f);
|
||||
@@ -27,7 +28,7 @@ signals:
|
||||
void fontStrikeOutChanged(const bool dashed);
|
||||
void fontWeightChanged(const QFont::Weight w);
|
||||
void fontItalicChanged(const bool italic);
|
||||
|
||||
void alignmentChanged(Qt::AlignmentFlag alignment);
|
||||
public slots:
|
||||
|
||||
private slots:
|
||||
@@ -40,4 +41,8 @@ private:
|
||||
QPushButton* m_underlineButton;
|
||||
QPushButton* m_weightButton;
|
||||
QPushButton* m_italicButton;
|
||||
|
||||
QPushButton* m_leftAlignButton;
|
||||
QPushButton* m_centerAlignButton;
|
||||
QPushButton* m_rightAlignButton;
|
||||
};
|
||||
|
||||
@@ -17,6 +17,7 @@ TextTool::TextTool(QObject* parent)
|
||||
if (!fontFamily.isEmpty()) {
|
||||
m_font.setFamily(ConfigHandler().fontFamily());
|
||||
}
|
||||
m_alignment = Qt::AlignRight;
|
||||
}
|
||||
|
||||
TextTool::~TextTool()
|
||||
@@ -28,6 +29,7 @@ void TextTool::copyParams(const TextTool* from, TextTool* to)
|
||||
{
|
||||
CaptureTool::copyParams(from, to);
|
||||
to->m_font = from->m_font;
|
||||
to->m_alignment = from->m_alignment;
|
||||
to->m_text = from->m_text;
|
||||
to->m_size = from->m_size;
|
||||
to->m_color = from->m_color;
|
||||
@@ -97,6 +99,7 @@ QWidget* TextTool::widget()
|
||||
m_widget->setTextColor(m_color);
|
||||
m_font.setPointSize(m_size + BASE_POINT_SIZE);
|
||||
m_widget->setFont(m_font);
|
||||
m_widget->setAlignment(m_alignment);
|
||||
m_widget->setText(m_text);
|
||||
m_widget->selectAll();
|
||||
connect(m_widget, &TextWidget::textUpdated, this, &TextTool::updateText);
|
||||
@@ -138,11 +141,16 @@ QWidget* TextTool::configurationWidget()
|
||||
&TextConfig::fontWeightChanged,
|
||||
this,
|
||||
&TextTool::updateFontWeight);
|
||||
|
||||
connect(
|
||||
m_confW, &TextConfig::alignmentChanged, this, &TextTool::updateAlignment);
|
||||
|
||||
m_confW->setFontFamily(m_font.family());
|
||||
m_confW->setItalic(m_font.italic());
|
||||
m_confW->setUnderline(m_font.underline());
|
||||
m_confW->setStrikeOut(m_font.strikeOut());
|
||||
m_confW->setWeight(m_font.weight());
|
||||
m_confW->setTextAlignment(m_alignment);
|
||||
return m_confW;
|
||||
}
|
||||
|
||||
@@ -168,6 +176,11 @@ CaptureTool* TextTool::copy(QObject* parent)
|
||||
&TextConfig::fontWeightChanged,
|
||||
tt,
|
||||
&TextTool::updateFontWeight);
|
||||
|
||||
connect(m_confW,
|
||||
&TextConfig::alignmentChanged,
|
||||
tt,
|
||||
&TextTool::updateAlignment);
|
||||
}
|
||||
copyParams(this, tt);
|
||||
return tt;
|
||||
@@ -191,10 +204,15 @@ void TextTool::process(QPainter& painter, const QPixmap& pixmap)
|
||||
painter.setFont(m_font);
|
||||
painter.setPen(m_color);
|
||||
if (!editMode()) {
|
||||
painter.drawText(m_textArea + QMargins(-val, -val, val, val), m_text);
|
||||
painter.drawText(
|
||||
m_textArea + QMargins(-val, -val, val, val), m_alignment, m_text);
|
||||
}
|
||||
painter.setFont(orig_font);
|
||||
painter.setPen(orig_pen);
|
||||
|
||||
if (m_widget) {
|
||||
m_widget->setAlignment(m_alignment);
|
||||
}
|
||||
}
|
||||
|
||||
void TextTool::drawObjectSelection(QPainter& painter)
|
||||
@@ -304,6 +322,14 @@ void TextTool::move(const QPoint& pos)
|
||||
m_textArea.moveTo(pos);
|
||||
}
|
||||
|
||||
void TextTool::updateAlignment(Qt::AlignmentFlag alignment)
|
||||
{
|
||||
m_alignment = alignment;
|
||||
if (m_widget) {
|
||||
m_widget->setAlignment(m_alignment);
|
||||
}
|
||||
}
|
||||
|
||||
const QPoint* TextTool::pos()
|
||||
{
|
||||
m_currentPos = m_textArea.topLeft();
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
#pragma once
|
||||
|
||||
#include "src/tools/capturetool.h"
|
||||
#include "textconfig.h"
|
||||
#include <QPoint>
|
||||
#include <QPointer>
|
||||
|
||||
class TextWidget;
|
||||
class TextConfig;
|
||||
|
||||
@@ -61,11 +61,13 @@ private slots:
|
||||
void updateFontStrikeOut(const bool s);
|
||||
void updateFontWeight(const QFont::Weight w);
|
||||
void updateFontItalic(const bool italic);
|
||||
void updateAlignment(Qt::AlignmentFlag alignment);
|
||||
|
||||
private:
|
||||
void closeEditor();
|
||||
|
||||
QFont m_font;
|
||||
Qt::AlignmentFlag m_alignment;
|
||||
QString m_text;
|
||||
QString m_textOld;
|
||||
int m_size;
|
||||
|
||||
@@ -39,18 +39,11 @@ void TextWidget::setFont(const QFont& f)
|
||||
adjustSize();
|
||||
}
|
||||
|
||||
void TextWidget::updateFont(const QFont& f)
|
||||
void TextWidget::setAlignment(Qt::AlignmentFlag alignment)
|
||||
{
|
||||
setFont(f);
|
||||
QTextEdit::setAlignment(alignment);
|
||||
adjustSize();
|
||||
}
|
||||
|
||||
void TextWidget::setFontPointSize(qreal s)
|
||||
{
|
||||
QFont f = font();
|
||||
f.setPointSize(s);
|
||||
setFont(f);
|
||||
}
|
||||
|
||||
void TextWidget::setTextColor(const QColor& c)
|
||||
{
|
||||
QString s(
|
||||
|
||||
@@ -22,9 +22,8 @@ signals:
|
||||
void textUpdated(const QString& s);
|
||||
|
||||
public slots:
|
||||
void updateFont(const QFont& f);
|
||||
void setTextColor(const QColor& c);
|
||||
void setFontPointSize(qreal s);
|
||||
void setAlignment(Qt::AlignmentFlag alignment);
|
||||
|
||||
private slots:
|
||||
void emitTextUpdated();
|
||||
|
||||
Reference in New Issue
Block a user