Commit 5db527a0 authored by Kai Uwe Broulik's avatar Kai Uwe Broulik Committed by Kai Uwe Broulik
Browse files

effects/mousemark: Port away from KPluralHandlingSpinBox



It's the only user of KTextWidgets in the entire repository.

Signed-off-by: default avatarEike Hein <eike.hein@mbition.io>
parent 8f219218
Pipeline #141459 passed with stage
in 13 minutes and 31 seconds
......@@ -90,7 +90,6 @@ find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS
KCMUtils
NewStuff
Service
TextWidgets
XmlGui
)
......
......@@ -33,7 +33,6 @@ target_link_libraries(kwin_mousemark_config
KF5::CoreAddons
KF5::GlobalAccel
KF5::I18n
KF5::TextWidgets
KF5::XmlGui
KWinEffectsInterface
)
......@@ -39,8 +39,6 @@ MouseMarkEffectConfig::MouseMarkEffectConfig(QWidget* parent, const QVariantList
{
m_ui = new MouseMarkEffectConfigForm(this);
m_ui->kcfg_LineWidth->setSuffix(ki18ncp("Suffix", " pixel", " pixels"));
QVBoxLayout* layout = new QVBoxLayout(this);
layout->addWidget(m_ui);
......@@ -66,7 +64,9 @@ MouseMarkEffectConfig::MouseMarkEffectConfig(QWidget* parent, const QVariantList
m_ui->editor->addCollection(m_actionCollection);
load();
connect(m_ui->kcfg_LineWidth, qOverload<int>(&QSpinBox::valueChanged), this, [this]() {
updateSpinBoxSuffix();
});
}
MouseMarkEffectConfig::~MouseMarkEffectConfig()
......@@ -75,6 +75,13 @@ MouseMarkEffectConfig::~MouseMarkEffectConfig()
m_ui->editor->undo();
}
void MouseMarkEffectConfig::load()
{
KCModule::load();
updateSpinBoxSuffix();
}
void MouseMarkEffectConfig::save()
{
qDebug() << "Saving config of MouseMark" ;
......@@ -89,6 +96,11 @@ void MouseMarkEffectConfig::save()
interface.reconfigureEffect(QStringLiteral("mousemark"));
}
void MouseMarkEffectConfig::updateSpinBoxSuffix()
{
m_ui->kcfg_LineWidth->setSuffix(i18ncp("Suffix", " pixel", " pixels", m_ui->kcfg_LineWidth->value()));
}
} // namespace
#include "mousemark_config.moc"
......@@ -33,9 +33,12 @@ public:
explicit MouseMarkEffectConfig(QWidget* parent = nullptr, const QVariantList& args = QVariantList());
~MouseMarkEffectConfig() override;
void load() override;
void save() override;
private:
void updateSpinBoxSuffix();
MouseMarkEffectConfigForm* m_ui;
KActionCollection* m_actionCollection;
};
......
......@@ -54,7 +54,7 @@
</widget>
</item>
<item row="1" column="1">
<widget class="KPluralHandlingSpinBox" name="kcfg_LineWidth">
<widget class="QSpinBox" name="kcfg_LineWidth">
<property name="minimum">
<number>1</number>
</property>
......@@ -103,11 +103,6 @@
<header>kshortcutseditor.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>KPluralHandlingSpinBox</class>
<extends>QSpinBox</extends>
<header>kpluralhandlingspinbox.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment