Go to the documentation of this file.
10 #include <QDomDocument>
56 int alphaMod, QRect clipRect)
65 area.translate(xoffset, yoffset);
67 p->SetClipRect(clipRect);
70 else if (
m_type ==
"roundbox")
72 else if (
m_type ==
"ellipse")
80 const QString &
filename, QDomElement &element,
bool showWarnings)
82 if (element.tagName() ==
"type")
86 if (
type ==
"box" ||
type ==
"roundbox" ||
type ==
"ellipse")
89 else if (element.tagName() ==
"fill")
91 QString style = element.attribute(
"style",
"solid");
92 QString color = element.attribute(
"color",
"");
93 int alpha = element.attribute(
"alpha",
"255").toInt();
95 if (style ==
"solid" && !color.isEmpty())
98 auto brushColor = QColor(color);
99 brushColor.setAlpha(alpha);
102 else if (style ==
"gradient")
104 for (QDomNode child = element.firstChild(); !child.isNull();
105 child = child.nextSibling())
107 QDomElement childElem = child.toElement();
109 if (childElem.tagName() ==
"gradient")
116 else if (element.tagName() ==
"line")
118 QString style = element.attribute(
"style",
"solid");
119 QString color = element.attribute(
"color",
"");
121 if (style ==
"solid" && !color.isEmpty())
123 int orig_width = element.attribute(
"width",
"1").toInt();
124 int width = (orig_width) ? std::max(
NormX(orig_width), 1) : 0;
125 int alpha = element.attribute(
"alpha",
"255").toInt();
126 auto lineColor = QColor(color);
127 lineColor.setAlpha(alpha);
135 else if (element.tagName() ==
"cornerradius")
156 LOG(VB_GENERAL, LOG_ERR,
"ERROR, bad parsing");
174 auto *shape =
new MythUIShape(parent, objectName());
175 shape->CopyFrom(
this);
int CalcAlpha(int alphamod) const
QRect toQRect(void) const
void CreateCopy(MythUIType *parent) override
Copy the state of this widget to the one given, it must be of the same type.
void DrawSelf(MythPainter *p, int xoffset, int yoffset, int alphaMod, QRect clipRect) override
void CopyFrom(MythUIType *base) override
Copy this widgets state from another.
void SetLinePen(QPen pen)
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Wrapper around QRect allowing us to handle percentage and other relative values for areas in mythui.
void SetFillBrush(QBrush fill)
virtual MythRect GetArea(void) const
If the object has a minimum area defined, return it, other wise return the default area.
void SetCropRect(int x, int y, int width, int height)
bool ParseElement(const QString &filename, QDomElement &element, bool showWarnings) override
Parse the xml definition of this widget setting the state of the object accordingly.
static QString getFirstText(QDomElement &element)
void CalculateArea(QRect parentArea)
virtual void CopyFrom(MythUIType *base)
Copy this widgets state from another.
static QBrush parseGradient(const QDomElement &element)
The base class on which all widgets and screens are based.
A widget for rendering primitive shapes and lines.
MythUIShape(MythUIType *parent, const QString &name)
static int NormX(int width)
virtual bool ParseElement(const QString &filename, QDomElement &element, bool showWarnings)
Parse the xml definition of this widget setting the state of the object accordingly.