|
Krita Source Code Documentation
|
Functions | |
| void | install (QSpinBox *spinBox, std::function< QString(int)> messageFn) |
| void | setText (KisSelectionPropertySliderBase *spinBox, const QStringView textTemplate)=delete |
| void | setText (QDoubleSpinBox *spinBox, const QStringView textTemplate) |
| void | setText (QSpinBox *spinBox, const QStringView textTemplate) |
| template<typename TSpinBox > | |
| static void | setTextGeneric (TSpinBox *spinBox, const QStringView textTemplate) |
| bool | update (QSpinBox *spinBox) |
| KRITAWIDGETUTILS_EXPORT void KisSpinBoxI18nHelper::install | ( | QSpinBox * | spinBox, |
| std::function< QString(int)> | messageFn ) |
Handles pluralization of prefix/suffix of QSpinBox-like widgets using an i18n string in the form of prefix {n} suffix. This uses the valueChanged signal to automatically update the text.
In case the valueChanged signal wouldn't be emitted (i.e. signals are blocked), call KisSpinBoxI18nHelper::update to update the text.
| spinBox | The QSpinBox to handle. |
| messageFn | A function (usually a lambda expression) that receives the current value to be shown and returns a localized QString in the form of prefix {n} suffix. The prefix and suffix of spinBox will be set accordingly. |
Definition at line 37 of file KisSpinBoxI18nHelper.cpp.
|
delete |
Deleted overload - KisSelectionPropertySlider contains special handling to switch its prefix/suffix internally. Do not use KisSpinBoxI18nHelper::setText to directly set the prefix/suffix. Use KisSelectionPropertySliderBase::setTextTemplates instead.
| KRITAWIDGETUTILS_EXPORT void KisSpinBoxI18nHelper::setText | ( | QDoubleSpinBox * | spinBox, |
| QStringView | textTemplate ) |
Set the prefix/suffix of a QDoubleSpinbox-like widget using an i18n string in the form of prefix {n} suffix. This is only done once immediately.
| spinbox | The QDoubleSpinBox to set prefix/suffix on. |
| textTemplate | The text in the form of prefix{n}suffix, usually passed through i18n or i18nc. |
Definition at line 85 of file KisSpinBoxI18nHelper.cpp.
References setTextGeneric().
| KRITAWIDGETUTILS_EXPORT void KisSpinBoxI18nHelper::setText | ( | QSpinBox * | spinBox, |
| QStringView | textTemplate ) |
Set the prefix/suffix of a QSpinbox-like widget using an i18n string in the form of prefix {n} suffix. This is only done once immediately. If plural handling is required, use install instead.
| spinbox | The QSpinBox to set prefix/suffix on. |
| textTemplate | The text in the form of prefix{n}suffix, usually passed through i18n or i18nc. |
Definition at line 80 of file KisSpinBoxI18nHelper.cpp.
References setTextGeneric().
|
static |
Definition at line 67 of file KisSpinBoxI18nHelper.cpp.
| KRITAWIDGETUTILS_EXPORT bool KisSpinBoxI18nHelper::update | ( | QSpinBox * | spinBox | ) |
Manually updates the prefix/suffix of a spinbox with its current value, in case signals are blocked for the spinbox while its value is being changed.
| spinBox | The QSpinBox to update. |
Definition at line 48 of file KisSpinBoxI18nHelper.cpp.