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
77273203
Commit
77273203
authored
Feb 08, 2019
by
Volker Krause
Browse files
Rotate 1D barcodes if we don't have enough space to show them horizontally
This should fix access to the Brussels airport train station.
parent
6c0fb343
Changes
1
Show whitespace changes
Inline
Side-by-side
src/app/TicketTokenDelegate.qml
View file @
77273203
...
@@ -62,9 +62,19 @@ ColumnLayout {
...
@@ -62,9 +62,19 @@ ColumnLayout {
anchors.top
:
barcodeContainer
.
top
anchors.top
:
barcodeContainer
.
top
anchors.bottom
:
barcodeContainer
.
bottom
anchors.bottom
:
barcodeContainer
.
bottom
color
:
"
white
"
color
:
"
white
"
// aim at 50x50mm for 2d codes, and 25mm height for 1d codes, if we have the space for it
property
bool
is1dCode
:
currentTicket
.
ticketTokenType
==
Ticket
.
Code128
property
bool
is1dCode
:
currentTicket
.
ticketTokenType
==
Ticket
.
Code128
implicitWidth
:
Math
.
max
(
root
.
width
*
0.8
,
barcode
.
implicitWidth
+
barcode
.
anchors
.
margins
*
2
)
// if this gets too wide, we need to rotate by 90°
implicitHeight
:
visible
?
is1dCode
?
Screen
.
pixelDensity
*
25
:
implicitWidth
:
0
property
bool
showVertical
:
is1dCode
&&
barcodeTargetWidth
>
root
.
width
// unrotated barcode sizes
property
int
barcodeTargetWidth
:
Math
.
max
(
(
is1dCode
?
2
*
barcode
.
implicitWidth
:
barcode
.
implicitWidth
)
+
2
*
barcode
.
anchors
.
margins
,
Screen
.
pixelDensity
*
50
)
property
int
barcodeTargetHeight
:
is1dCode
?
Screen
.
pixelDensity
*
25
:
barcodeTargetWidth
implicitWidth
:
(
showVertical
?
barcodeTargetHeight
:
barcodeTargetWidth
)
+
2
*
Kirigami
.
Units
.
smallSpacing
implicitHeight
:
visible
?
(
showVertical
?
barcodeTargetWidth
:
barcodeTargetHeight
)
+
2
*
Kirigami
.
Units
.
smallSpacing
:
0
visible
:
barcode
.
implicitHeight
>
0
visible
:
barcode
.
implicitHeight
>
0
MouseArea
{
MouseArea
{
...
@@ -74,8 +84,10 @@ ColumnLayout {
...
@@ -74,8 +84,10 @@ ColumnLayout {
Prison.Barcode
{
Prison.Barcode
{
id
:
barcode
id
:
barcode
anchors.fill
:
background
anchors.centerIn
:
background
anchors.margins
:
4
width
:
background
.
barcodeTargetWidth
height
:
background
.
barcodeTargetHeight
rotation
:
background
.
showVertical
?
90
:
0
barcodeType
:
barcodeType
:
{
{
if
(
currentTicket
==
undefined
)
if
(
currentTicket
==
undefined
)
...
...
Write
Preview
Markdown
is supported
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