Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PIM
Itinerary
Commits
4e3214d4
Commit
4e3214d4
authored
Nov 08, 2021
by
Volker Krause
Browse files
Don't render pkpass tickets not specifying all colors as black on black
parent
929e666e
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/app/EventTicket.qml
View file @
4e3214d4
...
...
@@ -25,7 +25,7 @@ Item {
Rectangle
{
id
:
bodyBackground
color
:
pass
.
backgroundColor
color
:
Util
.
isValidColor
(
pass
.
backgroundColor
)
?
pass
.
backgroundColor
:
Kirigami
.
Theme
.
backgroundColor
//implicitHeight: topLayout.implicitHeight + 2 * topLayout.anchors.margins
width
:
parent
.
width
...
...
@@ -77,21 +77,21 @@ Item {
Layout.rowSpan
:
2
Layout.fillWidth
:
pass
?
true
:
false
text
:
pass
?
pass
.
logoText
:
""
color
:
pass
.
foregroundColor
color
:
Util
.
isValidColor
(
pass
.
foregroundColor
)
?
pass
.
foregroundColor
:
Kirigami
.
Theme
.
textColor
}
Repeater
{
model
:
pass
.
headerFields
delegate
:
QQC2.Label
{
text
:
modelData
.
label
color
:
pass
.
label
Color
color
:
Util
.
isValidColor
(
pass
.
labelColor
)
?
pass
.
labelColor
:
Kirigami
.
Theme
.
text
Color
}
}
Repeater
{
model
:
pass
.
headerFields
delegate
:
QQC2.Label
{
text
:
modelData
.
valueDisplayString
color
:
pass
.
foregroundColor
color
:
Util
.
isValidColor
(
pass
.
foregroundColor
)
?
pass
.
foregroundColor
:
Kirigami
.
Theme
.
textColor
}
}
}
...
...
@@ -116,7 +116,7 @@ Item {
model
:
pass
.
primaryFields
delegate
:
QQC2.Label
{
Layout.fillWidth
:
true
color
:
pass
.
label
Color
color
:
Util
.
isValidColor
(
pass
.
labelColor
)
?
pass
.
labelColor
:
Kirigami
.
Theme
.
text
Color
text
:
modelData
.
label
horizontalAlignment
:
modelData
.
textAlignment
}
...
...
@@ -125,7 +125,7 @@ Item {
model
:
pass
.
primaryFields
delegate
:
QQC2.Label
{
Layout.fillWidth
:
true
color
:
pass
.
foregroundColor
color
:
Util
.
isValidColor
(
pass
.
foregroundColor
)
?
pass
.
foregroundColor
:
Kirigami
.
Theme
.
textColor
text
:
modelData
.
valueDisplayString
horizontalAlignment
:
modelData
.
textAlignment
}
...
...
@@ -143,7 +143,7 @@ Item {
model
:
pass
.
secondaryFields
delegate
:
QQC2.Label
{
Layout.fillWidth
:
true
color
:
pass
.
label
Color
color
:
Util
.
isValidColor
(
pass
.
labelColor
)
?
pass
.
labelColor
:
Kirigami
.
Theme
.
text
Color
text
:
modelData
.
label
horizontalAlignment
:
modelData
.
textAlignment
}
...
...
@@ -152,7 +152,7 @@ Item {
model
:
pass
.
secondaryFields
delegate
:
QQC2.Label
{
Layout.fillWidth
:
true
color
:
pass
.
foregroundColor
color
:
Util
.
isValidColor
(
pass
.
foregroundColor
)
?
pass
.
foregroundColor
:
Kirigami
.
Theme
.
textColor
text
:
modelData
.
valueDisplayString
horizontalAlignment
:
modelData
.
textAlignment
}
...
...
@@ -170,7 +170,7 @@ Item {
model
:
pass
.
auxiliaryFields
delegate
:
QQC2.Label
{
Layout.fillWidth
:
true
color
:
pass
.
label
Color
color
:
Util
.
isValidColor
(
pass
.
labelColor
)
?
pass
.
labelColor
:
Kirigami
.
Theme
.
text
Color
text
:
modelData
.
label
horizontalAlignment
:
modelData
.
textAlignment
}
...
...
@@ -179,7 +179,7 @@ Item {
model
:
pass
.
auxiliaryFields
delegate
:
QQC2.Label
{
Layout.fillWidth
:
true
color
:
pass
.
foregroundColor
color
:
Util
.
isValidColor
(
pass
.
foregroundColor
)
?
pass
.
foregroundColor
:
Kirigami
.
Theme
.
textColor
text
:
modelData
.
valueDisplayString
horizontalAlignment
:
modelData
.
textAlignment
}
...
...
@@ -211,14 +211,14 @@ Item {
ColumnLayout
{
QQC2.Label
{
Layout.fillWidth
:
true
color
:
pass
.
label
Color
color
:
Util
.
isValidColor
(
pass
.
labelColor
)
?
pass
.
labelColor
:
Kirigami
.
Theme
.
text
Color
text
:
modelData
.
label
wrapMode
:
Text
.
WordWrap
horizontalAlignment
:
modelData
.
textAlignment
}
QQC2.Label
{
Layout.fillWidth
:
true
color
:
pass
.
foregroundColor
color
:
Util
.
isValidColor
(
pass
.
foregroundColor
)
?
pass
.
foregroundColor
:
Kirigami
.
Theme
.
textColor
text
:
Util
.
textToHtml
(
modelData
.
valueDisplayString
)
textFormat
:
Util
.
isRichText
(
modelData
.
valueDisplayString
)
?
Text
.
RichText
:
Text
.
AutoText
wrapMode
:
Text
.
WordWrap
...
...
src/app/util.cpp
View file @
4e3214d4
...
...
@@ -12,6 +12,7 @@
#include
<KTextToHTML>
#include
<QAbstractItemModel>
#include
<QColor>
#include
<QDateTime>
#include
<QFile>
#include
<QTimeZone>
...
...
@@ -119,4 +120,9 @@ float Util::svgAspectRatio(const QString &svgFilePath)
return
1.0
f
;
}
bool
Util
::
isValidColor
(
const
QColor
&
color
)
{
return
color
.
isValid
();
}
#include
"moc_util.cpp"
src/app/util.h
View file @
4e3214d4
...
...
@@ -9,6 +9,7 @@
#include
<qobjectdefs.h>
class
QColor
;
class
QDateTime
;
class
QVariant
;
...
...
@@ -36,6 +37,9 @@ public:
* This is a dirty workaround for the problem that Kirigami.Icon has its implicit size hardcoded to 32x32...
*/
Q_INVOKABLE
static
float
svgAspectRatio
(
const
QString
&
svgFilePath
);
/** QColor::isValid for QML. */
Q_INVOKABLE
static
bool
isValidColor
(
const
QColor
&
color
);
};
#endif // UTIL_H
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment