Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QML: Do not alias associated anchor property (for Qt 5.12 compatiblity) #3963

Merged
merged 3 commits into from
Jun 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion res/skins/QMLDemo/Mixxx/Controls/Slider.qml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Slider {
id: root

property bool bar: false
property alias barMargin: barShape.anchors.margins
property real barMargin: 0
property alias barColor: barPath.strokeColor
property alias barWidth: barPath.strokeWidth
property real barStart: 0
Expand All @@ -18,6 +18,7 @@ Slider {
id: barShape

anchors.fill: parent
anchors.margins: root.barMargin
antialiasing: true
visible: root.bar

Expand Down
4 changes: 2 additions & 2 deletions res/skins/QMLDemo/Mixxx/Controls/WaveformOverviewMarker.qml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import QtQuick.Shapes 1.12
Item {
id: root

required property string group
required property string key
property string group // required
property string key // required
property string color: "white"

Shape {
Expand Down
16 changes: 16 additions & 0 deletions tools/qmlformat.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import subprocess
import pathlib
import sys
import re

QMLFORMAT_MISSING_MESSAGE = """
qmlformat is not installed or not in your $PATH. It is included in Qt 5.15
Expand All @@ -30,6 +31,21 @@ def main(argv=None):
for filename in args.file:
subprocess.call((qmlformat_executable, "-i", filename))

# Replace required properties
# (incompatible with Qt 5.12)
with open(filename, mode="r") as fp:
text = fp.read()

text = re.sub(
r"^(\s*)required property (.*)$",
r"\g<1>property \g<2> // required",
text,
flags=re.MULTILINE,
)

with open(filename, mode="w") as fp:
fp.write(text)

return 0


Expand Down