27 QVariant _value1, QVariant _value2, QVariant _testValue) {
73 qRegisterMetaType<SvgTextShortcutInfo>(
"SvgTextShortcutInfo");
74#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
75 QMetaType::registerEqualsComparator<SvgTextShortcutInfo>();
83 QVariant(400), QVariant(700), QVariant(500))
116 "svg_increase_font_size",
118 QVariant::fromValue(1),
true)
122 "svg_decrease_font_size",
124 QVariant::fromValue(1),
false)
128 "svg_format_underline",
133 "svg_format_strike_through",
140 QVariant(
true), QVariant(
false), QVariant(
true))
158 "svg_align_justified",
163 "svg_format_subscript",
168 "svg_format_superscript",
182 if (!action)
return false;
184 action->setData(QVariant::fromValue(info));
189 if (!action || !action->isCheckable() || !action->data().canConvert<
SvgTextShortcutInfo>())
return false;
197 for (
auto properties = currentProperties.begin(); properties != currentProperties.end(); properties++) {
198 const QVariant oldValue = properties->propertyOrDefault(info.
propertyId);
203 const KoSvgText::TextDecorations oldDecor = oldValue.value<KoSvgText::TextDecorations>();
209 return (testVal.
style == currentVal.style);
213 return (testValue == oldValue);
214 }
else if (testValue.canConvert<
double>()) {
215 return currentVal.
customValue == testValue.toDouble();
217 return currentVal.
isAuto == testValue.toBool();
222 return (testValue == oldValue);
224 return currentVal.
value == testValue.toDouble();
229 return (testValue == oldValue);
231 return (testValue == QVariant::fromValue(currentVal.
length));
233 return currentVal.
length.
value == testValue.toDouble();
238 return (testValue == oldValue);
240 return (testValue == QVariant::fromValue(currentVal.
length));
242 return currentVal.
length.
value == testValue.toDouble();
245 return (testValue == oldValue);
257 for(
auto properties = currentProperties.begin(); properties != currentProperties.end(); properties++) {
258 QVariant oldValue = properties->propertyOrDefault(info.
propertyId);
262 KoSvgText::TextDecorations oldDecor = oldValue.value<KoSvgText::TextDecorations>();
263 KoSvgText::TextDecorations newDecor;
264 newDecor.setFlag(decor, !oldDecor.testFlag(decor));
265 newVal = QVariant::fromValue(newDecor);
266 if (oldDecor.testFlag(decor)) {
272 if (currentVal.style == testVal.
style) {
281 if (currentVal.
isAuto == testVal) {
284 newVal = QVariant::fromValue(currentVal);
288 newVal = QVariant::fromValue(currentVal);
290 }
else if (oldValue.canConvert<
double>()) {
291 if (oldValue.toDouble() > info.
testValue.toDouble()) {
297 }
else if (oldValue.canConvert<
int>()) {
298 if (oldValue.toInt() > info.
testValue.toInt()) {
326 newVal = QVariant::fromValue(
length);
335 newVal = QVariant::fromValue(
length);
344 newVal = QVariant::fromValue(
value);
345 }
else if (oldValue.canConvert<
double>()) {
346 double value = oldValue.toDouble();
352 newVal = QVariant::fromValue(
value);
353 }
else if (oldValue.canConvert<
int>()) {
354 int value = oldValue.toInt();
360 newVal = QVariant::fromValue(
value);
378 if (oldValue.canConvert<
int>()) {
389 return newProperties;
qreal length(const QPointF &vec)
float value(const T *src, size_t ch)
QVariant toggleProperty(SvgTextShortcutInfo info, QList< KoSvgTextProperties > currentProperties)
toggleProperty Handles toggling properties for getModifiedProperties split out to make code easier to...
const QMap< QString, SvgTextShortcutInfo > textShortCuts
QVariant adjustValue(SvgTextShortcutInfo info, QVariant oldValue)
adjustValue Handles increase/decrease value for getModifiedProperties, split out to make code easier ...
KIS_DECLARE_STATIC_INITIALIZER
@ TextAlignAllId
KoSvgText::TextAlign.
@ FontStyleId
KoSvgText::CssSlantData.
@ BaselineShiftModeId
KoSvgText::BaselineShiftMode.
@ TextDecorationLineId
Flags, KoSvgText::TextDecorations.
@ KerningId
KoSvgText::AutoValue.
void setProperty(PropertyId id, const QVariant &value)
QVariant propertyOrDefault(PropertyId id) const
static bool actionEnabled(QAction *action, const QList< KoSvgTextProperties > currentProperties)
static QStringList possibleActions()
static KoSvgTextProperties getModifiedProperties(const QAction *action, QList< KoSvgTextProperties > currentProperties)
static bool configureAction(QAction *action, const QString &name)
Q_DECLARE_METATYPE(KisPaintopLodLimitations)
@ AlignCenter
Center text in line.
@ ShiftSuper
Use parent font metric for 'superscript'.
@ ShiftSub
Use parent font metric for 'subscript'.
TextDecoration
Flags for text-decoration, for underline, overline and strikethrough.
CssLengthPercentage length
When style is oblique, a custom slant value can be specified for variable fonts.
CssLengthPercentage length
The SvgTextShortcutInfo class This.
static SvgTextShortcutInfo propertySet(KoSvgTextProperties::PropertyId _propertyId, QVariant _value1)
KoSvgTextProperties::PropertyId propertyId
static SvgTextShortcutInfo propertyChange(KoSvgTextProperties::PropertyId _propertyId, QVariant _value1, bool _increase)
@ Set
Will set value1, cannot be toggled.
@ Toggle
Toggle will test "testValue", and toggle between value1 and value 2;.
bool operator==(const SvgTextShortcutInfo &other) const
static SvgTextShortcutInfo propertyToggle(KoSvgTextProperties::PropertyId _propertyId, QVariant _value1, QVariant _value2, QVariant _testValue)