#include <SvgUtil.h>
Definition at line 136 of file SvgUtil.h.
◆ Alignment
◆ PreserveAspectRatioParser()
| SvgUtil::PreserveAspectRatioParser::PreserveAspectRatioParser |
( |
const QString & | str | ) |
|
Definition at line 459 of file SvgUtil.cpp.
460{
461 QRegExp rexp("(defer)?\\s*(none|(x(Min|Max|Mid)Y(Min|Max|Mid)))\\s*(meet|slice)?", Qt::CaseInsensitive);
462 int index = rexp.indexIn(str.toLower());
463
464 if (index >= 0) {
465 if (rexp.cap(1) == "defer") {
467 }
468
469 if (rexp.cap(2) != "none") {
472 mode = rexp.cap(6) ==
"slice" ?
473 Qt::KeepAspectRatioByExpanding : Qt::KeepAspectRatio;
474 }
475 }
476}
Alignment alignmentFromString(const QString &str) const
References alignmentFromString(), defer, mode, xAlignment, and yAlignment.
◆ alignedValue()
| qreal SvgUtil::PreserveAspectRatioParser::alignedValue |
( |
qreal | min, |
|
|
qreal | max, |
|
|
Alignment | alignment ) |
|
staticprivate |
Definition at line 530 of file SvgUtil.cpp.
531{
533
534 switch (alignment) {
537 break;
539 result = 0.5 * (
min +
max);
540 break;
543 break;
544 }
545
546 return result;
547}
constexpr std::enable_if< sizeof...(values)==0, size_t >::type max()
◆ alignmentFromString()
◆ alignmentToString()
| QString SvgUtil::PreserveAspectRatioParser::alignmentToString |
( |
Alignment | alignment | ) |
const |
|
private |
Definition at line 521 of file SvgUtil.cpp.
522{
523 return
524 alignment ==
Max ?
"Max" :
525 alignment ==
Min ?
"Min" :
526 "Mid";
527
528}
◆ rectAnchorPoint()
| QPointF SvgUtil::PreserveAspectRatioParser::rectAnchorPoint |
( |
const QRectF & | rc | ) |
const |
Definition at line 478 of file SvgUtil.cpp.
479{
482}
static qreal alignedValue(qreal min, qreal max, Alignment alignment)
◆ toString()
| QString SvgUtil::PreserveAspectRatioParser::toString |
( |
| ) |
const |
Definition at line 484 of file SvgUtil.cpp.
485{
486 QString result;
487
491 mode == Qt::KeepAspectRatio) {
492
493 return result;
494 }
495
497 result += "defer ";
498 }
499
500 if (
mode == Qt::IgnoreAspectRatio) {
501 result += "none";
502 } else {
503 result += QString("x%1Y%2")
506
507 if (
mode == Qt::KeepAspectRatioByExpanding) {
508 result += " slice";
509 }
510 }
511
512 return result;
513}
QString alignmentToString(Alignment alignment) const
◆ defer
| bool SvgUtil::PreserveAspectRatioParser::defer = false |
◆ mode
| Qt::AspectRatioMode SvgUtil::PreserveAspectRatioParser::mode = Qt::IgnoreAspectRatio |
◆ xAlignment
| Alignment SvgUtil::PreserveAspectRatioParser::xAlignment = Min |
◆ yAlignment
| Alignment SvgUtil::PreserveAspectRatioParser::yAlignment = Min |
The documentation for this struct was generated from the following files: