diff --git a/AUTHORS b/AUTHORS
index 9d7b5369b6..6ff7cbddb7 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -362,6 +362,12 @@ Icons from the Elementary icon theme (GPLv3)
* src/tiled/images/32/dialog-error.png
* src/tiled/images/32/dialog-warning.png
+Icons from the GNOME project (CC0 1.0 Universal)
+* src/tiled/resources/images/scalable/text-bold-symbolic.svg
+* src/tiled/resources/images/scalable/text-italic-symbolic.svg
+* src/tiled/resources/images/scalable/text-underline-symbolic.svg
+* src/tiled/resources/images/scalable/text-strikethrough-symbolic.svg
+
Tilesets:
diff --git a/src/tiled/resources/images/scalable/text-bold-symbolic.svg b/src/tiled/resources/images/scalable/text-bold-symbolic.svg
new file mode 100644
index 0000000000..bdbddea8d2
--- /dev/null
+++ b/src/tiled/resources/images/scalable/text-bold-symbolic.svg
@@ -0,0 +1,2 @@
+
+
diff --git a/src/tiled/resources/images/scalable/text-italic-symbolic.svg b/src/tiled/resources/images/scalable/text-italic-symbolic.svg
new file mode 100644
index 0000000000..9fa6e67de6
--- /dev/null
+++ b/src/tiled/resources/images/scalable/text-italic-symbolic.svg
@@ -0,0 +1,2 @@
+
+
diff --git a/src/tiled/resources/images/scalable/text-strikethrough-symbolic.svg b/src/tiled/resources/images/scalable/text-strikethrough-symbolic.svg
new file mode 100644
index 0000000000..6df152de47
--- /dev/null
+++ b/src/tiled/resources/images/scalable/text-strikethrough-symbolic.svg
@@ -0,0 +1,2 @@
+
+
diff --git a/src/tiled/resources/images/scalable/text-underline-symbolic.svg b/src/tiled/resources/images/scalable/text-underline-symbolic.svg
new file mode 100644
index 0000000000..ff520eb3c7
--- /dev/null
+++ b/src/tiled/resources/images/scalable/text-underline-symbolic.svg
@@ -0,0 +1,2 @@
+
+
diff --git a/src/tiled/varianteditor.cpp b/src/tiled/varianteditor.cpp
index 93ec5f6934..abbd8bd2bb 100644
--- a/src/tiled/varianteditor.cpp
+++ b/src/tiled/varianteditor.cpp
@@ -37,6 +37,7 @@
#include
#include
#include
+#include
namespace Tiled {
@@ -284,53 +285,78 @@ QWidget *ColorProperty::createEditor(QWidget *parent)
QWidget *FontProperty::createEditor(QWidget *parent)
{
auto editor = new QWidget(parent);
- auto layout = new QVBoxLayout(editor);
auto fontComboBox = new QFontComboBox(editor);
+
auto sizeSpinBox = new QSpinBox(editor);
- auto boldCheckBox = new QCheckBox(tr("Bold"), editor);
- auto italicCheckBox = new QCheckBox(tr("Italic"), editor);
- auto underlineCheckBox = new QCheckBox(tr("Underline"), editor);
- auto strikeoutCheckBox = new QCheckBox(tr("Strikeout"), editor);
- auto kerningCheckBox = new QCheckBox(tr("Kerning"), editor);
sizeSpinBox->setRange(1, 999);
sizeSpinBox->setSuffix(tr(" px"));
sizeSpinBox->setKeyboardTracking(false);
+
+ auto bold = new QToolButton(editor);
+ bold->setIcon(QIcon(QStringLiteral("://images/scalable/text-bold-symbolic.svg")));
+ bold->setToolTip(tr("Bold"));
+ bold->setCheckable(true);
+
+ auto italic = new QToolButton(editor);
+ italic->setIcon(QIcon(QStringLiteral("://images/scalable/text-italic-symbolic.svg")));
+ italic->setToolTip(tr("Italic"));
+ italic->setCheckable(true);
+
+ auto underline = new QToolButton(editor);
+ underline->setIcon(QIcon(QStringLiteral("://images/scalable/text-underline-symbolic.svg")));
+ underline->setToolTip(tr("Underline"));
+ underline->setCheckable(true);
+
+ auto strikeout = new QToolButton(editor);
+ strikeout->setIcon(QIcon(QStringLiteral("://images/scalable/text-strikethrough-symbolic.svg")));
+ strikeout->setToolTip(tr("Strikethrough"));
+ strikeout->setCheckable(true);
+
+ auto kerning = new QCheckBox(tr("Kerning"), editor);
+
+ auto layout = new QVBoxLayout(editor);
layout->setContentsMargins(QMargins());
layout->setSpacing(Utils::dpiScaled(3));
layout->addWidget(fontComboBox);
layout->addWidget(sizeSpinBox);
- layout->addWidget(boldCheckBox);
- layout->addWidget(italicCheckBox);
- layout->addWidget(underlineCheckBox);
- layout->addWidget(strikeoutCheckBox);
- layout->addWidget(kerningCheckBox);
+
+ auto buttonsLayout = new QHBoxLayout;
+ buttonsLayout->setContentsMargins(QMargins());
+ buttonsLayout->addWidget(bold);
+ buttonsLayout->addWidget(italic);
+ buttonsLayout->addWidget(underline);
+ buttonsLayout->addWidget(strikeout);
+ buttonsLayout->addStretch();
+
+ layout->addLayout(buttonsLayout);
+ layout->addWidget(kerning);
auto syncEditor = [=] {
const auto font = value();
const QSignalBlocker fontBlocker(fontComboBox);
const QSignalBlocker sizeBlocker(sizeSpinBox);
- const QSignalBlocker boldBlocker(boldCheckBox);
- const QSignalBlocker italicBlocker(italicCheckBox);
- const QSignalBlocker underlineBlocker(underlineCheckBox);
- const QSignalBlocker strikeoutBlocker(strikeoutCheckBox);
- const QSignalBlocker kerningBlocker(kerningCheckBox);
+ const QSignalBlocker boldBlocker(bold);
+ const QSignalBlocker italicBlocker(italic);
+ const QSignalBlocker underlineBlocker(underline);
+ const QSignalBlocker strikeoutBlocker(strikeout);
+ const QSignalBlocker kerningBlocker(kerning);
fontComboBox->setCurrentFont(font);
sizeSpinBox->setValue(font.pixelSize());
- boldCheckBox->setChecked(font.bold());
- italicCheckBox->setChecked(font.italic());
- underlineCheckBox->setChecked(font.underline());
- strikeoutCheckBox->setChecked(font.strikeOut());
- kerningCheckBox->setChecked(font.kerning());
+ bold->setChecked(font.bold());
+ italic->setChecked(font.italic());
+ underline->setChecked(font.underline());
+ strikeout->setChecked(font.strikeOut());
+ kerning->setChecked(font.kerning());
};
auto syncProperty = [=] {
auto font = fontComboBox->currentFont();
font.setPixelSize(sizeSpinBox->value());
- font.setBold(boldCheckBox->isChecked());
- font.setItalic(italicCheckBox->isChecked());
- font.setUnderline(underlineCheckBox->isChecked());
- font.setStrikeOut(strikeoutCheckBox->isChecked());
- font.setKerning(kerningCheckBox->isChecked());
+ font.setBold(bold->isChecked());
+ font.setItalic(italic->isChecked());
+ font.setUnderline(underline->isChecked());
+ font.setStrikeOut(strikeout->isChecked());
+ font.setKerning(kerning->isChecked());
setValue(font);
};
@@ -339,11 +365,11 @@ QWidget *FontProperty::createEditor(QWidget *parent)
connect(this, &Property::valueChanged, fontComboBox, syncEditor);
connect(fontComboBox, &QFontComboBox::currentFontChanged, this, syncProperty);
connect(sizeSpinBox, qOverload(&QSpinBox::valueChanged), this, syncProperty);
- connect(boldCheckBox, &QCheckBox::toggled, this, syncProperty);
- connect(italicCheckBox, &QCheckBox::toggled, this, syncProperty);
- connect(underlineCheckBox, &QCheckBox::toggled, this, syncProperty);
- connect(strikeoutCheckBox, &QCheckBox::toggled, this, syncProperty);
- connect(kerningCheckBox, &QCheckBox::toggled, this, syncProperty);
+ connect(bold, &QAbstractButton::toggled, this, syncProperty);
+ connect(italic, &QAbstractButton::toggled, this, syncProperty);
+ connect(underline, &QAbstractButton::toggled, this, syncProperty);
+ connect(strikeout, &QAbstractButton::toggled, this, syncProperty);
+ connect(kerning, &QAbstractButton::toggled, this, syncProperty);
return editor;
}