NC/Edit text objects on double click (#1578)

* Edit existing text objects

(cherry picked from commit 3d6edca21b5615481d0ab409801baeafb523ce72)

* Add 'info' to the panel for the text tool object

(cherry picked from commit 2b633f560e46a0112d70653f6c55da5e97ce4cc8)

* Add 'info' to the panel for the CircleCount tool object

(cherry picked from commit 5ff5b667c1d6c534fe447618f9938a4581f0c9f2)

* Set text settings active in the Tool Settings panel on edit text

(cherry picked from commit a020a3504c0d02bbca4bb870e12e80ee87d64f75)

* Set font family in the Tool Settings panel on edit text object

(cherry picked from commit 70fe9bd5e79f39d544ed2d7848d05492da9b52bd)

Co-authored-by: Yuriy Puchkov <yuriy.puchkov@namecheap.com>
This commit is contained in:
Yurii Puchkov
2021-04-26 21:31:11 +03:00
committed by GitHub
parent 949f570303
commit 63045e4b02
11 changed files with 139 additions and 47 deletions

View File

@@ -12,19 +12,24 @@
TextConfig::TextConfig(QWidget* parent)
: QWidget(parent)
, m_layout(nullptr)
, m_fontsCB(nullptr)
, m_strikeOutButton(nullptr)
, m_underlineButton(nullptr)
, m_weightButton(nullptr)
, m_italicButton(nullptr)
{
m_layout = new QVBoxLayout(this);
QFontDatabase fontDB;
QComboBox* fontsCB = new QComboBox();
connect(fontsCB,
m_fontsCB = new QComboBox();
connect(m_fontsCB,
&QComboBox::currentTextChanged,
this,
&TextConfig::fontFamilyChanged);
fontsCB->addItems(fontDB.families());
m_fontsCB->addItems(fontDB.families());
// TODO save family in config
int index = fontsCB->findText(font().family());
fontsCB->setCurrentIndex(index);
setFontFamily(font().family());
QString iconPrefix = ColorUtils::colorIsDark(palette().windowText().color())
? PathInfo::blackIconPath()
@@ -67,7 +72,7 @@ TextConfig::TextConfig(QWidget* parent)
m_italicButton->setToolTip(tr("Italic"));
QHBoxLayout* modifiersLayout = new QHBoxLayout();
m_layout->addWidget(fontsCB);
m_layout->addWidget(m_fontsCB);
modifiersLayout->addWidget(m_strikeOutButton);
modifiersLayout->addWidget(m_underlineButton);
modifiersLayout->addWidget(m_weightButton);
@@ -75,6 +80,11 @@ TextConfig::TextConfig(QWidget* parent)
m_layout->addLayout(modifiersLayout);
}
void TextConfig::setFontFamily(const QString& fontFamily)
{
m_fontsCB->setCurrentIndex(m_fontsCB->findText(fontFamily));
}
void TextConfig::setUnderline(const bool u)
{
m_underlineButton->setChecked(u);