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

Test v0.9.0 #199

Merged
merged 9 commits into from
Jun 18, 2024
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
102 changes: 23 additions & 79 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,100 +7,44 @@ defaults:
shell: bash

jobs:
buildjll:
name: Build JLL
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@latest
with:
version: '1.8'
arch: x64
- uses: julia-actions/cache@v1
- name: Build JLLs
env:
BINARYBUILDER_RUNNER: privileged
BINARYBUILDER_USE_SQUASHFS: true
BINARYBUILDER_AUTOMATIC_APPLE: true
run: |
cd .ci
julia --project -e "using Pkg; Pkg.instantiate()"
julia --project build_tarballs.jl --verbose
- name: Upload JLL artifact
uses: actions/upload-artifact@v3
with:
name: jlqml-binaries
path: .ci/products
test:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }}
needs: buildjll
name: julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
version:
- '1.9'
- '1.6'
- '1'
- 'nightly'
os:
- ubuntu-latest
- macOS-latest
- windows-latest
- macos-latest
arch:
- x64
include:
- os: ubuntu-latest
prefix: xvfb-run
- os: windows-latest
version: '1'
arch: x86
- os: macos-14
arch: aarch64
version: '1'
exclude:
- os: ubuntu-latest
version: 1.6
steps:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@v1
- uses: julia-actions/setup-julia@latest
with:
version: ${{ matrix.version }}
# Mesa install copied from https://github.com/microsoft/OpticSim.jl
- name: Install Mesa (Windows only)
if: runner.os == 'Windows'
shell: cmd
working-directory: ${{ steps.setup-julia.outputs.julia-bindir }}
run: |
curl.exe -L --output mesa.7z --url https://github.com/pal1000/mesa-dist-win/releases/download/21.3.5/mesa3d-21.3.5-release-msvc.7z
"C:\Program Files\7-Zip\7z.exe" x mesa.7z
mklink opengl32.dll "x64\opengl32.dll"
mklink libglapi.dll "x64\libglapi.dll"
- uses: julia-actions/cache@v1
- uses: julia-actions/julia-buildpkg@v1
- name: Download built jlqml artifact
uses: actions/download-artifact@v3
arch: ${{ matrix.arch }}
- uses: julia-actions/julia-buildpkg@latest
- uses: julia-actions/julia-runtest@latest
with:
name: jlqml-binaries
- name: Dev jlqml_jll
run: |
julia --project -e "using Pkg; Pkg.develop(\"jlqml_jll\"); import jlqml_jll; jlqml_jll.dev_jll(); Pkg.add(\"CodecZlib\")"
julia --project .ci/override-jll.jl
- name: install-xfvb
if: runner.os == 'Linux'
run: sudo apt-get install xvfb libxkbcommon-x11-0 libgl1-mesa-dri
- name: test-linux
if: runner.os == 'Linux'
run: xvfb-run --auto-servernum julia --color=yes --check-bounds=yes --project -e 'using Pkg; Pkg.test(coverage=true)'
env:
XDG_RUNTIME_DIR: /tmp/runtime-runner
- name: test-win-mac
if: runner.os != 'Linux'
uses: julia-actions/julia-runtest@v1
- name: examples-linux
if: runner.os == 'Linux'
run: xvfb-run --auto-servernum julia --project test/runexamples.jl
env:
XDG_RUNTIME_DIR: /tmp/runtime-runner
continue-on-error: true
- name: examples-win-mac
if: runner.os != 'Linux'
run: julia --project test/runexamples.jl
continue-on-error: true
- uses: julia-actions/julia-processcoverage@v1
prefix: ${{ matrix.prefix }}
- uses: julia-actions/julia-processcoverage@latest
env:
DISABLE_AMEND_COVERAGE_FROM_SRC: yes
- uses: codecov/codecov-action@v1
with:
file: ./lcov.info
fail_ci_if_error: false
- uses: domluna/JuliaFormatter-action@master
with:
args: -v .
continue-on-error: true
DISABLE_AMEND_COVERAGE_FROM_SRC: yes
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@
CMakeLists.txt.user
/Manifest.toml
/docs/build
.vscode
6 changes: 3 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "QML"
uuid = "2db162a6-7e43-52c3-8d84-290c1c42d82a"
authors = ["Bart Janssens <[email protected]>"]
version = "0.8.1"
version = "0.9.0"

[deps]
ColorTypes = "3da002f7-5984-5a60-b8a6-cbb66c0b333f"
Expand All @@ -15,11 +15,11 @@ jlqml_jll = "6b5019fb-a83d-5b4e-a9f7-678a36c28df7"

[compat]
ColorTypes = "0.11"
CxxWrap = "0.14.0"
CxxWrap = "0.16"
MacroTools = "0.5"
Observables = "0.5"
Requires = "1.0"
jlqml_jll = "0.5.4"
jlqml_jll = "0.6.3"
julia = "1.6"

[extras]
Expand Down
31 changes: 28 additions & 3 deletions src/QML.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module QML

export QVariant, QString, QUrl
export QQmlContext, root_context, loadqml, qt_prefix_path, set_source, engine, QByteArray, QQmlComponent, set_data, create, QQuickItem, content_item, QTimer, context_property, emit, JuliaDisplay, JuliaCanvas, qmlcontext, init_qmlapplicationengine, init_qmlengine, init_qquickview, exec, exec_async, QVariantMap
export QQmlContext, root_context, loadqml, watchqml, qt_prefix_path, set_source, engine, QByteArray, QQmlComponent, set_data, create, QQuickItem, content_item, QTimer, context_property, emit, JuliaDisplay, JuliaCanvas, qmlcontext, init_qmlapplicationengine, init_qmlengine, init_qquickview, exec, exec_async, QVariantMap
export JuliaPropertyMap
export QStringList, QVariantList
export JuliaItemModel, addrole!, roles, roleindex, setgetter!, setsetter!, setheadergetter!, setheadersetter!
Expand Down Expand Up @@ -73,9 +73,7 @@ end
end

function load_qml(qmlfilename, engine)
ctx = root_context(CxxRef(engine))
if !load_into_engine(engine, QString(qmlfilename))
cleanup()
error("Failed to load QML file ", qmlfilename)
end
return engine
Expand All @@ -97,11 +95,38 @@ function loadqml(qmlfilename; kwargs...)
try
return load_qml(qmlfilename, qml_engine)
catch
QML.process_events()
cleanup()
rethrow()
end
end

function watchqml(engine::CxxPtr{QQmlApplicationEngine}, qmlfile)
function clearcache(path)
rootobject = first(QML.rootObjects(engine))
QML.deleteLater(rootobject)
QML.clearComponentCache(engine)
QML.load_into_engine(engine, path)
end

watcher = QML.QFileSystemWatcher(engine)
QML.addPath(watcher, qmlfile)
QML.connect_file_changed_signal(watcher, clearcache)
end

function watchqml(qview::CxxPtr{QQuickView}, qmlfile)
engine = QML.engine(qview)

function clearcache(path)
QML.clearComponentCache(engine)
set_source(qview, QUrlFromLocalFile(path))
end

watcher = QML.QFileSystemWatcher(engine)
QML.addPath(watcher, qmlfile)
QML.connect_file_changed_signal(watcher, clearcache)
end

const _loaded_qml_modules = Module[]

function loadqmljll(m::Module)
Expand Down
1 change: 1 addition & 0 deletions src/itemmodel.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Base.:+(a::QML.ItemDataRole, b::Integer) = convert(Int32,a) + b
# Allow roles as keys in Dicts:
Base.trailing_zeros(role::ItemDataRole) = Base.trailing_zeros(convert(Int32,role))
Base.:(>>)(a::ItemDataRole, b::Int64) = convert(Int32, a) >> b
Base.:(>>)(a::ItemDataRole, b::Int32) = convert(Int32, a) >> b
mutable struct ItemModelData{DataT}
values::Observable{DataT}
roles::RoleNames
Expand Down
2 changes: 1 addition & 1 deletion test/qml/tableview.qml
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ ApplicationWindow {
Item {

Layout.alignment: Qt.AlignCenter
Layout.preferredWidth: 100
Layout.preferredWidth: 300
Layout.preferredHeight: 200

HorizontalHeaderView {
Expand Down
Loading