Skip to content

Welcome to Planet KDE

This is a feed aggregator that collects what the contributors to the KDE community are writing on their respective blogs, in different languages

Saturday, 13 April 2024

This week something big got merged: support for Explicit Sync on Wayland!

What does this do? In a nutshell it allows apps to tell the compositor when to display frames on the screen, reducing latency and graphical glitches. The effect should be particularly noticeable with NVIDIA GPUs, which only support this rendering style, and not having support for it on Wayland was the most common source of random graphical glitches and slowdowns.

This work was done by Xaver Hugl, and lands in Plasma 6.1. You can read more about it in a recent blog post he wrote on the topic!

In addition to that impactful but technical change, this was a week of many UI improvements and bug fixes as well:

UI Improvements

Improved the visual quality of cross-screen screenshots that Spectacle takes when using multi-screen setups where the screens have different scale factors (Noah Davis, Spectacle 24.05. Link)

Improved quality of blurs, pixelations, and shadows in Spectacle’s annotations (Noah Davis, Spectacle 24.05. Link)

KWrite now shows a hamburger menu by default instead of a traditional menu bar, and the hamburger menu has gained an assortment of curated actions on the top to speed up access to them (Nathan Garside and Christoph Cullmann, KWrite 24.05. Link 1, link 2, and link 3):

Just KWrite! Nothing has changed for Kate.

Filelight now throws fewer annoying modal dialog windows in your face: it now shows directory access errors using inline placeholder messages, and failures to add duplicate exclusion paths using small toasts/passive notifications (Han Young, Filelight 24.05. Link 1 and link 2)

In the “Get New [Thing]” dialogs, the warning shown at the top is now different and more warningy if the available content has the potential to run executable code on your system (David Edmundson and me: Nate Graham, Plasma 6.1 and Gear apps 24.05. Link 1 and link 2):

In Plasma’s traditional Task Manager widget, the threshold for showing any text is now smaller, so you’ll see text more often even at relatively narrow task widths. This is based on the idea that if you’re using this widget, it’s because you want to see text! (me: Nate Graham, Plasma 6.0.4. Link)

On Wayland, the Dialog Parent effect that dims parent windows when dialogs are active now temporarily disables the dimming when the dialog window is a color picker that’s currently picking a screen color (Ivan Tkachenko, Plasma 6.1. Link)

System Settings’ Virtual Desktops page has now adopted the common “controls on the header row” paradigm to increase the apace available for content (Jakob Petsovits, Plasma 6.1. Link):

In Plasma’s Power and Battery widget, the controls and UI for blocking sleep and screen locking have moved from the header into the view, matching the location of other interactive controls and preventing the header from becoming super chunky when multiple apps are inhibiting sleep and screen locking (Natalie Clarius, Plasma 6.1. Link):

System Monitor now shows a tooltip with the full text when you hover over an elided piece of text in one of the table views (Joshua Goins, Plasma 6.1. Link)

Made the header message on System Settings’ File Search page frameless and border-touching, making use of new API created to enable this purpose. This API was also used for the message in the “Get new [thing]” dialog shown earlier. So expect to see more of this kind of thing in the coming weeks! (me: Nate Graham, Plasma 6.1. Link 1 and link 2):

Folder popups invoked from a Plasma panel can now be resized if you’d like more space to see everything in them (Ivan Tkachenko, Plasma 6.1. Link)

If you preferred the old style of app launching in Plasma’s traditional Task Manager widget whereby an app’s pinned launcher would disappear when launched, you can now get that back (Niccolò Venerandi, Plasma 6.1. Link)

Middle-clicking a desktop in KWin’s Overview effect no longer instantly removes it, because this made it too easy to accidentally destroy your layout (me: Nate Graham, Plasma 6.1. Link)

The radius of rounded corners throughout Breeze-themed UI elements has now been standardized at 5px, much better than the previous random assortment of corner radii that ranged generally from 2-5px, with some being as high as 8 or 16px! This is an easily bikeshedded topic, so please try to restrain yourselves; check out all the other screenshots in this post, which feature the change—I bet you thought they looked pretty good before I explicitly mentioned that the corner radius had increased, right!? 😁 (Akseli Lahtinen, Plasma 6.1 and Frameworks 6.2. Link)

Bug Fixes

In Dolphin’s Details view, navigating to a subdirectory no longer resets the current sort mode (Felix Ernst, Dolphin 24.02.2. Link)

Gwenview no longer inappropriately blocks sleep and screen locking when simply viewing an image (Daniel Strnad, Gwenview 24.02.2. Link)

Fixed a nasty bug in Spectacle that could cause the rectangular region overlay to get stuck on screen when taking a rectangular region screenshot right after a screen recording without quitting and re-launching Spectacle first (Noah Davis, Spectacle 24.05. Link)

Plasma’s Night Light feature no longer unintentionally connects to Mozilla Location Services to geolocate you for the purpose of figuring out the Night Light transition time when you don’t have that setting turned on (Natalie Clarius, Plasma 5.27.12. Link)

Plasma no longer crashes when you close the notification that gives you an opportunity to undo removing an Icon widget (Nicolas Fella, Plasma 6.0.4. Link)

Modal font dialogs in Plasma 6 are now ugly, but at least they work again; our previous styling approach caused them to end up non-interactive and has been reverted for now pending a better solution (Nicolas Fella, Plasma 6.0.4. Link)

Discover once again shows you everything you have installed on its “Installed” page—not just an assortment of packages that depended on what distro you were using (Harald Sitter, Plasma 6.0.4. Link)

When scrolling down in one app category on Kickoff and then switching categories, random items from the former category no longer sometimes appear inappropriately on the new page (David Redondo, Plasma 6.0.4. Link)

On Wayland, the color picker dialog no longer returns incorrect colors when an ICC profile is applied to the display (Xaver Hugl, Plasma 6.0.4. Link)

Fixed a strange issue whereby items in Plasma’s list view mode Folder View popups on a panel could only be highlighted when moving the cursor downwards, rather than upwards (Akseli Lahtinen, Plasma 6.0.4. Link)

Fixed a bug that made it possible, under certain circumstances, to drag a window completely off the screen (Yifan Zhu, Plasma 6.0.4. Link)

On Wayland, the clipboard menu that appears when you hit Meta+V no longer goes underneath windows set to always be on top (Tino Lorenz, Plasma 6.0.4. Link)

In KWin’s Overview effect, the thumbnails for inactive virtual desktops are now live, not static (David Redondo, Plasma 6.0.4. Link)

Fixed a problem creating new Wireguard VPNs (Stephen Robinson, Plasma 6.1. Link)

Keyboards are no longer sometimes shown as mice on System Settings’ Mouse page (me: Nate Graham, Plasma 6.1. Link)

Rapidly toggling the “Floating” setting for a Plasma panel on and off no longer sometimes causes the panel to get stuck in a position where it’s not floating, but also detached from the screen edge (Vlad Zahorodnii, Plasma 6.1. Link)

Discover no longer mislabels apps that get removed from a Flatpak repo as being not installed when they are in fact still installed (Aleix Pol and Ivan Tkachenko, Plasma 6.1. Link)

Fixed a case where KDE apps could run out of memory when told to open certain types of malformed image files (Mirco Miranda, Frameworks 6.1. Link)

Fixed the most common crash in the Baloo file indexing service, with 113 duplicates as of the time of writing (Christoph Cullmann, Frameworks 6.2. Link)

Fixed a rare case where KIO could exhaust all memory while trying and failing to process HTTP requests under certain unusual circumstances (Harald Sitter, Frameworks 6.2. Link)

WebDAV files accessed through Dolphin or other KDE apps once again show the correct modification times (Fabian Vogt, Frameworks 6.2. Link)

Other bug information of note:

Performance & Technical

After Qt changes regressed this, changing color schemes is once again nearly instant, giving the “blend changes” KWin effect enough time to provide a smooth transition between the colors (Kai Uwe Broulik, Frameworks 6.2 Link)

Files and folders on the desktop that are copied or dragged are now made available via the Portals system, so dropping them into sandboxed apps now works as expected (Karol Kosek, Plasma 6.0.4. Link)

…And Everything Else

This blog only covers the tip of the iceberg! If you’re hungry for more, check out https://planet.kde.org, where you can find more news from other KDE contributors.

How You Can Help

KDE has become important in the world, and your time and labor have helped to bring it there! But as we grow, it’s going to be equally important that this stream of labor be made sustainable, which primarily means paying for it. Right now the vast majority of KDE runs on labor not paid for by KDE e.V. (the nonprofit foundation behind KDE, which I am a board member for), and that’s a problem. We’ve taken steps to change this with paid technical contractors—but those steps are small due to limited financial resources. If you’d like to help change that, consider donating today!

Otherwise, visit https://community.kde.org/Get_Involved to discover other ways to be part of a project that really matters. Each contributor makes a huge difference in KDE; you are not a number or a cog in a machine! You don’t have to already be a programmer, either. I wasn’t when I got started. Try it, you’ll like it! We don’t bite!

Friday, 12 April 2024

It has been a very busy couple of weeks as we worked against some major transitions and a security fix that required a rebuild of the $world. I am happy to report that against all odds we have a beta release! You can read all about it here: https://kubuntu.org/news/kubuntu-24-04-beta-released/ Post beta freeze I have already begun pushing our fixes for known issues today. A big one being our new branding! Very exciting times in the Kubuntu world.

In the snap world I will be using my free time to start knocking out KDE applications ( not covered by the project ). I have also recruited some help, so you should start seeing these pop up in the edge channel very soon!

Now that we are nearing the release of Noble Numbat, my contract is coming to an end with Kubuntu. If you would like to see Plasma 6 in the next release and in a PPA for Noble, please consider donating to extend my contract at https://kubuntu.org/donate !

On a personal level, I am still looking to help with my grandson and you can find that here: https://www.gofundme.com/f/in-loving-memory-of-william-billy-dean-scalf

Thanks for stopping by,

Scarlett

Join the Excitement:

Test Kubuntu 24.04 Beta and Experience Innovation with KubuQA!

We’re thrilled to announce the availability of the Kubuntu 24.04 Beta! This release is packed with new features and enhancements, and we’re inviting you, our valued community, to join us in fine-tuning this exciting new version. Whether you’re a seasoned tester or new to software testing, your feedback is crucial to making Kubuntu 24.04 the best it can be.

To make your testing journey as easy as pie, we’re introducing a fantastic new tool: KubuQA. Designed with both new and experienced users in mind, KubuQA simplifies the testing process by automating the download, VirtualBox setup, and configuration steps. Now, everyone can participate in testing Kubuntu with ease!

This beta release also debuts our fresh new branding, artwork, and wallpapers—created and chosen by our own community through recent branding and wallpaper contests. These additions reflect the spirit and creativity of the Kubuntu family, and we can’t wait for you to see them.

Get Testing

By participating in the beta testing of Kubuntu 24.04, you’re not just helping improve the software; you’re becoming an integral part of a global community that values open collaboration and innovation. Your contributions help us identify and fix issues, ensuring Kubuntu remains a high-quality, stable, and user-friendly Linux distribution.

The benefits of joining our testing team extend beyond improving the software. You’ll gain valuable experience, meet like-minded individuals, and perhaps discover a new passion in the world of open-source software.

So why wait? Download the Kubuntu 24.04 Beta today, try out KubuQA, or follow our wiki to upgrade and help us make Kubuntu better than ever! Remember, your feedback is the key to our success.

Ready to make an impact?

Join us in this exciting phase of development and see your ideas come to life in Kubuntu. Plus, enjoy the satisfaction of knowing that you’ve contributed to a project used by millions around the world. Become a tester today and be part of something big!

Interested in more than testing?

By the way, have you thought about becoming a member of the Kubuntu Community? It’s a fantastic way to contribute more actively and help shape the future of Kubuntu. Learn more about joining the community.

Turns out I managed to squeeze reading here and there and have enough content for a regular review… So let’s go for my web review for the week 2024-15.


Fairbuds are Fairphone’s proof that we really could make better tiny gadgets | Ars Technica

Tags: tech, repair, sound, hardware

Another type of devices where clearly they could be repairable and batteries could be swappable if manufacturers would put care in the design. At least, Fairphone is showing it’s doable.

https://arstechnica.com/gadgets/2024/04/fairbuds-take-the-fairphones-repairability-down-to-seemingly-impossible-size/?comments=1


The Rise and Fall of Silicon Graphics

Tags: tech, gpu, 3d, history

Interesting history behind the company which was instrumental in pushing computer graphics forward during its time.

https://www.abortretry.fail/p/the-rise-and-fall-of-silicon-graphics


Software eco-design: investigating and reducing the energy consumption of software

Tags: tech, performance, energy, ecology, java, research

More work about eco-design of software. This is definitely welcome. I found this work a bit weak on the state of the art and the interview parts (10 people in the same company). But the field is so nascent that it’s to be expected I guess, PhD students have to do with what they have access to. Unsurprisingly this shows a great lack of proper tools to tackle the measurement problem. This thesis shows interesting prospects to reduce variations in measurements though, some of the proposed guidelines might help but cannot offset the hardware heterogeneity completely… The parts focusing on practical advices around Java use and deployment are interestingly easy to apply though. You need to take into account the context of your application to make the right choices of course.

https://theses.hal.science/tel-03429300/document


The LLMentalist Effect: how chat-based Large Language Models replicate the mechanisms of a psychic’s con

Tags: tech, ai, machine-learning, gpt, cognition, criticism, scam

Interesting take on why people see more in LLM based systems than there really is. The parallels with psychics and mentalists tricks are well thought out.

https://softwarecrisis.dev/letters/llmentalist/


The Assist @ Things Of Interest

Tags: tech, ai, machine-learning, copilot, gpt, programming

All the good reasons why productivity increases with code assistants are massively overestimated. To be used why not, but with a light touch.

https://qntm.org/assist


Hello OLMo: A truly open LLM

Tags: tech, ai, machine-learning, gpt, open-access, research

This is how it should be done. This one comes with everything needed to reproduce the results. This is necessary to gain insights into how such models work internally.

https://blog.allenai.org/hello-olmo-a-truly-open-llm-43f7e7359222


The lifecycle of a code AI completion

Tags: tech, ai, machine-learning, copilot, programming, architecture

Wondering how one can design a coding assistant? Here is an in depth explanation of the choices made by one of the solutions out there. There’s quite some processing before and after actually running the inference with the LLM.

https://sourcegraph.com/blog/the-lifecycle-of-a-code-ai-completion


Results summary: 2024 Annual C++ Developer Survey “Lite” : Standard C++

Tags: tech, c++

Some interesting insights in this survey. It helps identify common concerns.

https://isocpp.org/blog/2024/04/results-summary-2024-annual-cpp-developer-survey-lite


Glory is only 11MB/sec away

Tags: tech, cloud, infrastructure, cost

When you do the math, the cloud offerings look very expensive for most workload indeed.

https://thmsmlr.com/cheap-infra


Building My First Homelab Server Rack · mtlynch.io

Tags: tech, hardware, homelab, self-hosting

Considering using a server rack for a homelab? This is a nice tutorial with plenty of advices.

https://mtlynch.io/building-first-homelab-rack/


Intro to TLS Certificates

Tags: tech, cryptography, tls, certificates, security

The title says it all. This article is a nice introduction to certificates, how they work, how the trust model is setup, etc.

https://carrickbartle.com/certificates.html


ratarmount: Access large archives as a filesystem efficiently

Tags: tech, tools, archive

Looks like a nice tool to manipulate large archives.

https://github.com/mxmlnkn/ratarmount


Hermit: A reproducible container

Tags: tech, debugging, tools, multithreading

Looks like an interesting tool to analyze hard to reproduce bugs, especially when concurrency is involved. This could be useful to find the source of flaky tests as well.

https://github.com/facebookexperimental/hermit


my deployment platform is a shell script

Tags: tech, self-hosting, deployment, complexity, shell, scripting

Keep things as simple as possible, they might turn out to be robust too.

https://j3s.sh/thought/my-deployment-platform-is-a-shell-script.html


Shell History Is Your Best Productivity Tool

Tags: tech, shell, zsh

A few interesting tips to improve history management with ZSH.

https://martinheinz.dev/blog/110


The Blessing of the Strings

Tags: tech, web, browser, javascript, reliability

Looks like an interesting mechanism to improve the reliability of web applications. Let’s see what people make with those trusted types.

https://bkardell.com/blog/blessing-strings.html


Don’t require people to change ‘source code’ to configure your programs

Tags: tech, programming, portability, craftsmanship

Hopefully nobody is handling configuration by assuming the user will modify the source code or build scripts by hand. Unfortunately I still encounter it from time to time…

https://utcc.utoronto.ca/~cks/space/blog/programming/ConfigureNoSourceCodeChanges


If Inheritance is so bad, why does everyone use it? • Buttondown

Tags: tech, object-oriented, history

Interesting look at the history of inheritance in programming languages. There’s clearly still room for improvements on this concept.

https://buttondown.email/hillelwayne/archive/if-inheritance-is-so-bad-why-does-everyone-use-it/


Thoughts on Pair Programming - DEV Community

Tags: tech, programming, pairing

Good criteria to decide to pair or not. This is still not practiced enough. Maybe knowing when it’s best to reach out to pair will help get more into it.

https://dev.to/shaharke/thoughts-on-pair-programming-1i8g


What I think about when I edit — Eva Parish

Tags: documentation, writing

Good advices to improve writing. I should apply such rules to myself more often.

https://evaparish.com/blog/how-i-edit


Simple Ways to Show Appreciation at Work

Tags: management, empathy

Plenty of good tricks in there. It has to be genuine of course, but said tricks reduce chances of unwillingly dropping the ball on the topic.

https://hbr.org/2023/10/simple-ways-to-show-appreciation-at-work


On Generating Ideas - Leadership & Work

Tags: meetings, leadership

This is indeed the best approach I’ve seen for brainstorming. It gives a chance to everyone to bring something forward, even the introverts.

https://read.perspectiveship.com/p/on-generating-ideas



Bye for now!

This is my final blog about my experience participating in season of KDE 2024. As part of my final term, I translated tellico to hindi. Tellico contains 2070 statements spanning between messages and docmessages. I used lokalize application for the translation. I hardly faced any issues during the translation work apart from some ambiguity in the translated words. Thanks Raghavendra Kamath for helping me resolve those few issues. Overall, It was an awesome experience during the entire program.

KEcoLab, a tool for measuring software energy consumption, needs robust testing to ensure its functionality after every code change. This blog post presents the work I did in Season of KDE 2024 implementing dedicated test builds using Kate test scripts to achieve this goal. By implementing a dedicated "test-build" and "integration" stage within the CI/CD pipeline, we can enhance KEcoLab's reliability and maintain confidence in its results.

Setting up CI test (image from Sarthak Negi published under a <a href="https://spdx.org/licenses/CC-BY-4.0.html">CC-BY-4.0</a> license).
Figure : Setting up CI test (image from Sarthak Negi published under a CC-BY-4.0 license).

Background

KEcoLab simplifies the process of analyzing KDE software's energy consumption through the CI/CD pipeline in Invent. This automation streamlines the measurement process, offering crucial insights for developers and helping projects seeking eco-certification. However, ensuring KEcoLab's continued effectiveness requires thorough testing after each code modification.

The Challenge

KEcoLab retrieves the package name from the merge request for testing purposes. However, this approach doesn't guarantee stability after code changes unrelated to specific packages. To address this, we propose a dedicated "test-build" stage within the CI/CD pipeline.

The Solution: Dedicated Test Builds

The proposed "test-build" stage leverages Kate test scripts located in the KEcoLab repository. These scripts will be instrumental in mimicking CI tests and validating KEcoLab's functionality.

Here's a breakdown of the proposed stages within the test build:

Stage: test-build

  • Tag: test-build

  • Function: This stage functions similarly to how the existing KEcoLab pipeline operates. However, instead of dynamically retrieving the package name, it will be hardcoded to org.kde.kate (as this is the specific package we're focusing on for testing).

  • Key Difference: This stage won't rely on files from the merge request. Instead, it will clone the KEcoLab repository to access the necessary Kate usage scenario files. This ensures we're testing against the latest codebase in the repository, regardless of specific merge requests.

  • Implementation: To improve code organization and maintainability, we've adopted a modular approach to CI/CD pipelines. We now have two dedicated YAML files:

    • .test-energy_measurement.yml: This file defines the stages for the CI test pipeline.
    • .energy_measurement.yml: This file contains the stages previously defined in .gitlab-ci.yml. All the code related to energy measurement testing has been shifted to this new file.

    Both YAML files reside within the same directory for easy management. The main .gitlab-ci.yml file utilizes the include keyword to incorporate the stages from these dedicated files. This promotes modularity, improves readability, and reduces redundancy in the main pipeline configuration.

# Test-build stage
test-build:
 stage: test-build
 image: alpine
 tags:
 - EcoLabWorker
 before_script:
 # Hardcode the package name to org.kde.kate
 - PACKAGE_NAME="org.kde.kate"
 script:
 # Add flathub remote if not exists
 - flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
 # Install the specified package (org.kde.kate) from flathub
 - flatpak install --user $PACKAGE_NAME -y
 # Clone the KEcolab repository to access usage scenario files
 - git clone https://invent.kde.org/teams/eco/remote-eco-lab.git
 # Copy the kate usage scenario files from the cloned repository to the required location
 - cp remote-eco-lab/scripts/test_scripts/org.kde.kate/* scripts/test_scripts/org.kde.kate/
 rules:
 - if: $CI_PIPELINE_SOURCE == 'merge_request_event'

Stage: test-energy-measurement

  • This stage operates identically to the existing KEcoLab pipeline stage for energy measurement.

Stage: test-report

  • This stage also functions identically to the existing KEcoLab pipeline stage responsible for generating reports.

Future OutLook

Stage: integration test

We introduce a novel integration test

  • This stage aims to compare reports generated during the test build with previous reports. By utilizing the diff command, we can identify significant discrepancies between the reports. This helps us detect potential regressions or unintended changes in how KEcoLab measures energy consumption.
# This stage is for integration tests
stage: Integration test

# Jobs to be executed in this stage
jobs:
 - run:
 # Replace with your actual script to run integration tests
 name: Run integration tests
 script: your_test_script.sh

 # Diff reports job (assuming reports are stored in artifacts)
 - diff_reports:
 # Retrieve artifacts from previous job
 stage: Integration test
 artifacts:
 paths:
 - reports/
 script: |
 # Install diff tools
 apk add diffutils

 # Get the latest reports from artifacts
 report1=$(ls reports/*.html | sort -r | head -n 1)
 report2=$(ls reports/*.html | sort -r | head -n 2)

Why it matters

  • Enhanced Stability: By focusing on a specific package (org.kde.kate) and utilizing the latest codebase from the KEcoLab repository, we ensure comprehensive testing across code changes, not just those within a particular merge request.

  • Catch Bugs Early: The integration test utilizing diff allows for the early detection of regressions or deviations in energy measurement behavior. This proactive approach helps maintain consistent and reliable results from KEcoLab.

  • Confidence in Every Change: Whenever someone contributes code, passing tests ensure those changes don't disrupt existing features. This builds trust and keeps development smooth.

  • Save Time, Be Awesome: Automating tests frees up valuable time for developers to focus on innovation. We can spend less time debugging and more time making KEcoLab even better!

CI testing (image from Sarthak Negi published under a <a href="https://spdx.org/licenses/CC-BY-4.0.html">CC-BY-4.0</a> license).
Figure : CI testing (image from Sarthak Negi published under a CC-BY-4.0 license).

So, How Will It Work?

We have existing test scripts used for Kate, KDE's text editor. We'll first see if these can be adapted for KEcoLab. If needed, we'll create new tests specifically designed for KEcoLab's functionalities.

Here's the coolest part: these tests will become part of our CI/CD pipeline. Whenever someone submits code changes (a merge request), the pipeline will automatically run the tests. If everything passes, the changes are merged with manual approval by the maintainers. But if a test fails, it'll be like a flashing red light, prompting us to fix the issue before merging.

The proposed dedicated test build approach using Kate test scripts is a valuable addition to the KEcoLab CI/CD pipeline. This enhanced testing strategy helps ensure that KEcoLab continues to deliver accurate and reliable software energy consumption measurements, ultimately leading to more efficient and eco-friendly code.

Interested in Contributing?

By implementing dedicated CI-tests leveraging Kate's existing test scripts, we're taking a big step towards solidifying KEcoLab's stability and ensuring the accuracy of its software energy consumption measurements. This wouldn't be possible without the incredible support of the KDE community and my mentors @karan @joseph. Their dedication to open-source development is truly inspiring.

Want to See More? Head over to KEcoLab on invent.kde.org to explore the project, learn more about its development, and check out the merge request that sparked this advancement!

We're excited about this approach and would love to hear your thoughts! If you're interested in contributing to KEcoLab's development and helping make software development a more sustainable practice, you are always welcome. Together, we can make a real difference!

Friday, 12 April 2024

KDE today announces the release of KDE Frameworks 6.1.0.

KDE Frameworks are 83 addon libraries to Qt which provide a wide variety of commonly needed functionality in mature, peer reviewed and well tested libraries with friendly licensing terms. For an introduction see the KDE Frameworks release announcement.

This release is part of a series of planned monthly releases making improvements available to developers in a quick and predictable manner.

New in this version

Attica
  • Do not signal an error when a job was cancelled. Commit. Fixes bug #483117
Baloo
  • [Extractor] Explicitly abort the transaction on early exit. Commit.
  • [WorkerPipe] Verify inputEnd() is signaled when parent process exits. Commit.
  • Some indexers need non-slash trailed path. Commit. Fixes bug #478854
  • Skip indexing KDE FS volumes unless user included. Commit. Fixes bug #460509. See bug #390830
  • [tests/engine/singledbtest] Allow testing multiple databases. Commit.
  • Ci: download .clang-format during CI runs. Commit.
  • [Extractor] Change to QCoreApplication. Commit.
  • Ci: check clang-format during CI. Commit.
Bluez Qt
  • Add support for manufacturer data in LE advertisements. Commit.
Breeze Icons
  • Temporarily add back kdenlive-*-video for compatibility. Commit.
  • Rename kdenlive--edit to timeline-mode-. Commit.
  • Remove kdenlive-select-tool. Commit.
  • Remove kdenlive-spacer-tool icon. Commit.
  • Fix duplicates. Commit.
  • Rename kdenlive-object-* to object-*. Commit.
  • Rename kdenlive--audiothumb to waveform-. Commit.
  • Remove kdenlive-show-videothumb icon. Commit.
  • Rename kdenlive--video to video-. Commit.
  • Rename kdenlive--audio to audio-. Commit.
  • Rename kdenlive-align-none to align-none. Commit.
  • Add Flatpak ID symlink for kwalletmanager. Commit.
  • Add system-suspend-inhibited, system-suspend-uninhibited. Commit.
  • Add rdns-style name symlink for kcolorchooser. Commit.
  • Use magnifying glass iconography for zoom icons. Commit. Fixes bug #435671
  • Remove 16px view-list-symbolic symlink. Commit.
  • Fix incorrect target icon for view-grid-symbolic. Commit.
  • Fix user-desktop-symbolic symlink. Commit.
  • Remove unsupported colorscheme entries from stylesheets. Commit.
  • Quassel_message: Replace ButtonFocus with Highlight. Commit.
  • Use Text color for konv_message icon. Commit. See bug #482645
  • Replace hardcoded blue with highlight color in OSD icons. Commit.
  • Remove unneeded dark applets icons. Commit. Fixes bug #477289
  • Software-updates-additional: Port away from ButtonFocus color. Commit.
  • Network-mobile-available: Replace ButtonFocus with Highlight. Commit.
  • Notification-progress-active: Replace ButtonFocus with Highlight. Commit.
  • Drop edit-hover and showinfo-hover icons. Commit.
  • Fix suyu color in dark theme. Commit.
  • Add suyu icon. Commit.
  • Add 48px elisa-symbolic icon used for the Android themed icon. Commit.
  • Update outdated url. Commit.
  • Fix incorrectly named network icon symlinks. Commit.
  • Make process-stop-symbolic a symlink to the base icon. Commit. Fixes bug #482556
  • Fix some 96px folder icons not using accent color. Commit. Fixes bug #478016
  • Add new icon for Skladnik. Commit. Fixes bug #458214
Extra CMake Modules
  • ECMAddQch: drop trying to set IMPORTED on targets with installed config. Commit.
  • Fix DATAROOTDIR documentation for Windows. Commit.
  • Update documentation favicon. Commit.
  • MacOS is the name of the Apple operating system. Commit.
  • Fix fetch translations tests in GitLab forks. Commit.
  • Docs: Correct escape sequence for Python 3.12 or later. Commit.
  • Map some more language codes to the IDs supported by Google Play. Commit.
  • [ECMQmlModule] Add option to enable verbose compiler output. Commit.
  • Remove extraneous docs-build CI job that is no longer needed following the switch of api.kde.org to Gitlab CI. Commit.
Framework Integration
  • Kns: Fix typo in yes / no action request. Commit.
KBookmarks
  • Fix KBookmarkManager::save triggering KDirWatch. Commit.
KCalendarCore
  • Fix check whether RRULE UNTIL datetime is UTC. Commit.
  • Fix conversion of date-only icaltimetype to UTC QDateTime. Commit. Fixes bug #483707
  • MemoryCalendar: log details about duplicate events before asserting. Commit. See bug #481031
KCMUtils
  • Better document KPluginModel. Commit.
  • Deprecate ContextualHelpButton in favor of the Kirigami version. Commit.
  • KCMLauncher: Fix up docs. Commit.
  • Port QML modules to declarative type registration. Commit.
  • ConfigModule: Fix imports and aliases in provided example. Commit.
  • SharedQmlEngine: Improve error reporting when loading main component. Commit.
  • SettingHighlighterPrivate: update highlight on target children changes. Commit.
  • Qml: set domain for i18n strings. Commit.
KConfig
  • Don't search for QtDBus on Windows/macOS/Android. Commit.
  • Register KConfigPropertyMap to QML. Commit.
  • Kconf_update: Also run .upd files if times match but done is empty. Commit. Fixes bug #483795
  • Add unittest that URL[$e] works, for bug 482889. Commit.
KConfigWidgets
  • Don't use DBus on Windows/macOS. Commit.
KCoreAddons
  • Don't search for QtDBus on Windows/macOS/Android. Commit.
  • KformatPrivate: fix deprecation enum arithmetic with float. Commit.
KCrash
KDBusAddons
  • Conditionalise Qt6::GuiPrivate on HAVE_X11. Commit.
KDeclarative
  • Remove redundant QML_ELEMENT in KDeclarativeMouseEvent and WheelEvent. Commit.
  • Don't use kwidgetsaddons on Android. Commit.
  • Refactor kglobalaccel check. Commit.
  • Don't use kglobalaccel on Android. Commit.
  • Mark Android as supported. Commit.
  • Add Android CI. Commit.
  • Add dependency to QML module. Commit.
  • Kquickcontrolsaddons: Drop QML import versions from doc example. Commit.
  • Kquickcontrols: Remove superfluous no-op assignment. Commit.
  • Kquickcontrols: Replace superfluous Text item and a semi-broken expression. Commit.
  • Kquickcontrols: Reduce superfluous ternary. Commit.
  • Kquickcontrols: Declare type of __previousSequence property as a string. Commit.
  • Kquickcontrols: Uplift previousSequence property to the root component. Commit.
  • Kquickcontrols: Drop QML import versions, fix up code style. Commit.
KDocTools
  • Fixes compile problem for projects which uses older cmake versions. Commit.
  • Kdoctools_create_handbook/manpage: check INSTALL_DESTINATION for empty value. Commit.
  • Replace user.entities. Commit.
  • Upload New File bg.xml. Commit.
  • Update user.entities in bg. Commit.
KFileMetaData
  • [PopplerExtractorTest] Verify multicolumn PDF content (currently broken). Commit.
  • [PopplerExtractorTest] Make tests data driven. Commit.
  • [PopplerExtractorTest] Move class declaration to source file. Commit.
  • Plaintextextractor: autodetect encoding for text. Commit.
  • [PlainTextExtractor] Add plain text test file to coverage test. Commit.
  • [IndexerExtractorTest] Make tests data driven. Commit.
  • Add support for .mod/.s3m/.xm/.it Module Tracker formats meta data. Commit. Fixes bug #448182
  • Plaintextextractor: Read file via QFile. Commit.
  • [PropertyInfo,TypeInfo] Move static data into scope of its class. Commit.
  • [PropertyInfo,TypeInfo] Avoid lookup from id during initilization. Commit.
  • [PropertyInfo,TypeInfo] Use QStringView for name in hash. Commit.
  • [TypeInfo] Use a hash table for faster fromName TypeInfo creation. Commit.
  • Move helper class for case-insensitive QHash lookup to separate file. Commit.
  • [TypeInfo] Make set of all types introspectable. Commit.
  • [TypeInfo] Improve performance and cleanup. Commit.
  • [TypeInfo] Add unit tests and benchmarks. Commit.
  • [TypeInfo] Extend documentation for KFileMetaData::TypeInfo. Commit.
  • [PlaintextExtractor] Fix possible truncation of last character. Commit.
  • [PlaintextExtractor] Verify handling files missing newline delimiters. Commit.
  • [PlaintextExtractor] Check countint of empty lines. Commit.
  • [IndexerExtractorTest] Actually verify content extraction is skipped. Commit.
  • [IndexerExtractorTest] Move class declaration to source file. Commit.
  • [CMake] Move mentions of KF Archive dependencies over to the extractors. Commit.
  • [CMake] Remove several leftover references to KF5. Commit.
  • Fix compilation error for krita extractor when KArchive isn't found. Commit.
KGlobalAccel
KGuiAddons
  • Recorder/KKeySequenceRecorderPrivate: support recording multi-key modifier-only shortcuts. Commit. See bug #470256
KHolidays
KI18n
  • Fix compilation with GCC 9. Commit.
  • Main: ensure current thread is main thread. Commit.
KIconThemes
  • Fix dbus disabling. Commit.
  • Don't hang if no session bus is around. Commit.
  • Don't search for QtDBus on Windows/macOS. Commit.
  • Eliminate a frequent "Invalid Context" warning for FileSystems. Commit.
  • KIconDialog: Add filter for symbolic icons. Commit.
  • Allow creating KIconEngine with colors and overlays. Commit.
  • Add breeze-icons dependency. Commit.
  • Mark index.theme config as SimpleConfig. Commit.
KIdletime
  • Guard against invalid timeout values in KIdleTime::addTimeout(). Commit. See bug #482077
KImageformats
  • Add KF_VERSION & KF_DEP_VERSION variables. Commit.
  • XCF: testcase update for fixed Qt. Commit.
  • TGA: added options support. Commit.
  • More header checks (CCBUG: 479612). Commit.
KIO
  • Improve cppcheck. Commit.
  • Fix a compiler warning. Commit.
  • Add cppcheck / codequality run for those who care. Commit.
  • Fix a few compiler warnings. Commit.
  • Make ScopedProcessRunner hold the child until we register with systemd. Commit.
  • PreviewJob: allow to display previews of fileitem having a local targetUrl. Commit.
  • Fix authentication prompt not being shown. Commit. Fixes bug #460944
  • [kdiroperator] Only write icon size settings if non-default. Commit.
  • [kdiroperator] Drop code for reading configured icon sizes. Commit.
  • [kfilewidget] Store recent files/URLs in state config. Commit.
  • [kfileitemactions] Remove dead code. Commit.
  • KCoreDirListerCache:: make sure not to reinsert an item twice. Commit. See bug #473488
  • [workers/http] Ask user to remember ignoring SSL errors. Commit. See bug #484241
  • [workers/http] Ignore already acknowledged SSL errors. Commit. See bug #484241
  • [workers/http] Don't ask to ignore non-ignorable SSL errors. Commit.
  • [sslerrortest] Print job results. Commit.
  • [widgtesaskuseractionhandler] Remove problematic Q_UNREACHABLE. Commit.
  • Fix warnings: implicit capture of ‘this’ via ‘[=]’. Commit.
  • Slim down sslerrortest. Commit.
  • Drop unused entries from defaults-kfile.h. Commit.
  • [kfileplacesmodel] Remove wrong assert. Commit. Fixes bug #484160
  • Openwith: restore preferredTerminal reading. Commit.
  • [kprocessrunner] Unexport checkStartupNotify. Commit.
  • KFileItem: when checking access use current user. Commit. Fixes bug #483436
  • Fix webshortcuts not giving searchprovider specific icon. Commit. Fixes bug #483164
  • KFileitem: Use internal permissions as best case scenario. Commit. Fixes bug #477526. Fixes bug #483436
  • Use KUrlRequester in previewtest. Commit.
  • Fix sprintf buffer leaks on 32-bit systems. Commit.
  • Connectionbackend: improve jumbo packet handling. Commit. Fixes bug #481311
  • Drop legacy keys for m_runOnDiscreteGpuBool. Commit. Fixes bug #481538
  • Explicitly defined HAVE_DBUS. Commit.
  • Make "Create New" dialogs use the same consistent title style. Commit.
  • [kopenwithdialog] Populate m_pService in checkAccept. Commit.
  • [knewfilemenu] Add window title for new file dialog. Commit. Fixes bug #482732
  • Fix hide service menu items in context menu. Commit. Fixes bug #482216
  • [kterminallauncherjob] Inherit default process environment from parent. Commit. Fixes bug #482107
  • [knewfilemenu] Fix error handling when creating a folder that already exists. Commit. Fixes bug #482145
  • Kioexec: Use categorised logging. Commit.
  • Kioexec: Remove temporary files after the main loop has completed. Commit.
  • Use symbolic icons on buttons. Commit.
  • Kioexecd: Use KUIT and button icons for the "Upload changes?" question. Commit.
  • Openwith: extract core logic from dialog. Commit.
Kirigami
  • PromptDialog: Demote wrapper item from Control to Padding. Commit.
  • ListSectionHeader: Clean up and expand docs, add import alias for Controls. Commit.
  • PlatformTheme: Note where the disabled text color comes from. Commit.
  • ImageColors: make sure QML attached object is fetched from main thread. Commit.
  • Clarify that the default alignment for ActionToolbar is AlignLeft. Commit.
  • Fix up qualified properties access and doc examples, use appropriate enum for TextEdit. Commit.
  • ContextualHelpButton: Fix up code style and qualified property access. Commit.
  • ContextualHelpButton: Use a specific and appropriate type for a property. Commit.
  • ContextualHelpButton: Sort out imports and improve docs. Commit.
  • Padding: make sure to polish on completion. Commit. Fixes bug #477978
  • PlaceholderMessage: remove bad example using it as a loading indicator. Commit.
  • ContextualHelpButton: fix translated string usage. Commit.
  • Adopt ContextualHelpButton. Commit.
  • ApplicationItem & ApplicationWindow: Don't reserve space for overlaid vkbd. Commit.
  • ColumnView: Disable invisible (out-of-viewport) pages. Commit.
  • Make global drawer item keyboard navigable. Commit.
  • Respect QT_NO_XDG_DESKTOP_PORTAL. Commit. Fixes bug #482730
  • ColumnView: Add check args to clamp. Commit. See bug #481531
  • ColumnView: Use OutExpo for page animation. Commit.
  • Fix separator of OverlayDrawer in the header bar. Commit.
  • ScrollablePage: Workaround Qt flickable inertia being really low. Commit.
  • Add Position paramenter for InlineMessage. Commit.
  • Handle URL inputs for pushDialogLayer. Commit. Fixes bug #481623
  • InlineMessage: Fix showing close button. Commit.
  • Handle null drawer as well. Commit.
  • Fix footer in layers. Commit. Fixes bug #480428
KItemModels
  • Trivial fix for crash in buddy() when sourceModel isn't set yet. Commit.
KItemViews
  • Add missing Q_OBJECT to KCategorizedSortFilterProxyModel. Commit.
KJobWidgets
  • Tests need dbus due to KUiServerJobTracker. Commit.
  • Kjobtrackerstest needs dbus. Commit.
  • TARGET Qt6::DBus doesn't work if dependencies export it. Commit.
  • Don't search for QtDBus on Windows/macOS/Android. Commit.
  • Simplify X11 check. Commit.
KNewStuff
  • Add extra ksnrc key to indicate the safety of installation. Commit.
  • Use Continue/Cancel style of question for overwrite dialog. Commit.
  • Change default sorting of entries to "Most Downloads". Commit.
  • Resultsstream: Delay the entry loading into the event look. Commit. Fixes bug #473472
  • Resultsstream: handle query results assertively. Commit.
  • Resultsstream: Allow for the members to be constant. Commit.
  • Unify default sizes. Commit. Fixes bug #482604
  • Fix the "working..." overlay for item installation. Commit. Fixes bug #483108
  • Remove the last uses of Qt5Compat.GraphicalEffects. Commit.
  • Refresh visible entry on uninstall. Commit. Fixes bug #476152
  • [qtquick/action] Add API to set transient parent for dialog. Commit. Fixes bug #479816
  • Fix link list dialog for installation button. Commit. Fixes bug #482349
  • Set questionAsker implicit sizes, set maxWidth to dialog width. Commit. Fixes bug #480338
KNotifications
  • Port QML module to declarative type registration. Commit.
KNotifyConfig
  • Don't use DBus on Windows/macOS. Commit.
KPackage
  • Testpackage: Add a website so that the tests succeed. Commit.
  • Fix: implicit capture of ‘this’ via ‘[=]’ is deprecated in C++20. Commit.
KQuickCharts
  • Declare QML module dependencies. Commit.
  • Generate default set of GLSL shaders. Commit. Fixes bug #482988
  • Examples: Remove separator from main page list items. Commit.
  • Piechartnode: Rename updateTriangles to updateSegments. Commit.
  • Piechartnode: Remove some unused stuff. Commit.
  • Examples: Change "smooth" to "interpolate". Commit.
  • Piechart: Use the right amount of thickness for the chart. Commit.
  • Linechart: Use fwidth of the point instead of sdf to avoid conditional fwidth. Commit. Fixes bug #434462
  • Sdf: Allow specifying fwidth() to sdf_render(). Commit.
KRunner
  • Add doxygen comment to ResultsModel class. Commit.
  • Give favorites a relative boost rather than absolute sorting position. Commit.
KService
  • Fix warning: mimeType "x-scheme-handler/file" not found. Commit. Fixes bug #442721
KStatusNotifieritem
  • Improve activating associated window on Wayland. Commit.
KSVG
  • Add test for loading svgs from qrc files. Commit.
  • Support loading svg from QRC files. Commit.
KTextEditor
  • Fix argument hint placement. Commit.
  • Dont use activeView as save dialog parent. Commit. Fixes bug #484466
  • Ensure only set stuff is saved. Commit.
  • Dont write useless entries to session config. Commit.
  • All tests work offscreen in the CI. Commit.
  • Try to avoid crash in destructor. Commit.
  • Try more offscreen. Commit.
  • Ensure we don't crash if no view is active. Commit.
  • Kateviewinternal: accept surrogate category character. Commit. Fixes bug #482864
  • Use test mode with e.g. own temporary config files. Commit.
  • Avoid using QChar constructor for key codes. Commit. Fixes bug #483631
  • Remove obsolete option code. Commit.
  • Remove focus frame option. Commit. Fixes bug #483218
  • Fix duplicate folds occuring. Commit.
  • Fix support for folding in vi normal mode. Commit.
  • Adapt test to hinting change. Commit.
  • Set full hinting instead to ensure the letters are aligned properly. Commit. Fixes bug #482659
  • Try to save changes. Commit. See bug #459093
  • Optimize a mark-restoring condition after document reload. Commit.
KUnitConversion
  • Binary_data: add match strings with {upper/lower}case k for kilo- and kibi-{bits/bytes}. Commit. Fixes bug #483815
KUserFeedback
  • Flatpatk: Use actual 6.6 runtime. Commit.
KWallet
  • [kwallet-query] Create QApplication before using i18n. Commit. Fixes bug #482017
  • Ensure correct exit status by adding returns after exits in QueryDriver. Commit.
KWindowSystem
  • Port QML module to declarative type registration. Commit.
  • Kkeyserver: allow shift to modify modifier keys. Commit.
  • Kkeyserver: add support for modifier keys. Commit.
KXMLGUI
  • Kkeysequencewidget: expose modifierOnlyAllowed. Commit. See bug #470257
  • Don't search for QtDBus on Windows/macOS. Commit.
  • Make sure that actions just added to the toolbar show up in the edit dialog. Commit.
Prison
  • Add dependency to QML module. Commit.
QQC2 Desktop Style
  • CheckIndicator: use Theme.View color, dont inherit parent. Commit.
  • Delegates: Unify alignment and horizontal stretching of labels. Commit.
  • KQuickStyleItem: Replace manual loop with C++20 std::accumulate. Commit.
  • Remove unneeded CMake stuff. Commit.
  • Port away from deprecated ECMQMLModules. Commit.
  • Add type annotations to functions. Commit.
  • Qualify property lookups. Commit.
  • Use local Label component directly. Commit.
  • Use local property directly. Commit.
  • Avoid looking up non-Item properties via Item-based properties. Commit.
  • Avoid looking up non-Item properties via parent. Commit.
  • Remove unused import statements. Commit.
  • Declare dependencies on other QML modules. Commit.
  • [ToolTip] Use local Label instead of importing QQC2. Commit.
  • Completely disable animations when animations are globally disabled. Commit.
  • Localization support. Commit.
  • Add support for custom fonts in ToolButtons. Commit.
  • Autotests: test TextFieldContextMenu. Commit. See bug #481293
  • Always use values from Kirigami.Theme as control palette. Commit. Fixes bug #479015
Solid
  • Udisks2: Read CleartextDevice instead of introspection. Commit.
Sonnet
  • Improve spell check config design. Commit.
  • Remove leftover files. Commit.
Syndication
Syntax Highlighting
  • Cmake-generator: refactor XML optimizations. Commit.
  • Cmake.xml: has-target-names-after-kw could be a list. Commit.
  • Cmake.xml: updates for the recently released CMake 3.29. Commit.
  • Cpp: Update Qt classes for Qt 6. Commit.
  • Initial gprbuild references. Commit.
  • Gprbuild: add license info. Commit.
  • Add small GPR test file. Commit.
  • Add GPRbuild syntax. Commit.
  • Add common alternative names used in various markdown parsers for languages. Commit.
  • Fix refs for stan. Commit.
  • Update 2 files. Commit.
  • Use (?:sub){0,2} to work with all pcre versions. Commit.
  • Alternate Names for Definitions. Commit.
  • Fix implicit size -> int conversion. Commit.
Threadweaver
  • Examples: Do not use Qt module includes. Commit.

Thursday, 11 April 2024

Qt for MCUs 2.5.3 LTS (Long-Term Support) has been released and is available for download. As a patch release, Qt for MCUs 2.5.3 LTS provides bug fixes and other improvements, and maintains source compatibility with Qt for MCUs 2.5.x. It does not add any new functionality.

Recently I was tasked to come up with an architecture for remote real time instantiation and updating of arbitrary QML components.

This entry shows how you can use a simple variation of the factory method pattern in QML for instantiating arbitrary components. I’ve split my findings into 3 blog entries, each one covering a slightly different topic. Part 1 focuses on the software design pattern used to dynamically instantiate components. Part 2 shows how to layout these dynamic components by incorporating QML’ s positioning and layout APIs. The last entry, consisting of Parts 3 and 4, addresses the anchors API and important safety aspects.

This is Part 1: Recursive Instantiation with Qt Quick and JSON.

The original factory method pattern made use of static methods to programmatically instantiate objects of different classes, instead of having to call their constructors. It achieved that by having the classes share a common ancestor. Our variation of the popular pattern uses a Loader to choose which component to load, and a Repeater to dynamically instantiate arbitrary instances of this loader using a model.

Here we specify which components with a JSON array and use a Repeater to load them.

    id: root
    // A JSON representation of a QML layout:
    property var factoryModel: [
        {
            "component": "Button",
        },
        {
            "component": "Button",
        }
    ]
    // Root of our component factory
    Repeater {
        model: root.factoryModel
        delegate: loaderComp
    }

To be able to instantiate any kind of item, you can use a Component with a Loader inside, as the Repeater’s delegate. This allows you to load a different component based on the Repeater’s model data.

    // Root component of the factory and nodes
    Component {
        id: loaderComp
        Loader {
            id: instantiator
            required property var modelData
            sourceComponent: switch (modelData.component) {
                case "Button":
                return buttonComp;
                case "RowLayout":
                return rowLayoutComp;
                case "Item":
                default: return itemComp;
            }
        }
    }

To assign values from the model to the component, add a method that gets called when the Loader’s onItemChanged event is triggered. I use this method to take care of anything that involves the component’s properties:

    // Root component of the factory and nodes
    Component {
        id: loaderComp
        Loader {
            id: instantiator
            required property var modelData
            sourceComponent: switch (modelData.component) {
                case "Button":
                return buttonComp;
                case "RowLayout":
                return rowLayoutComp;
                case "Item":
                default: return itemComp;
            }
            onItemChanged: {
                // Pass children (see explanation below)
                if (typeof(modelData.children) === "object")
                    item.model = modelData.children;

                // Button properties
                switch (modelData.component) {
                    case "Button":
                    // If the model contains certain value, we may assign it:
                    if (typeof(modelData.text) !== "undefined")
                        item.text = modelData.text;
                    break;
                }

                // Item properties
                // Since Item is the parent of all repeatable, we don't need to check
                // if the component supports Item properties before we assign them:
                if (typeof(modelData.x) !== "undefined")
                    loaderComp.x = Number(modelData.x);
                if (typeof(modelData.y) !== "undefined")
                    loaderComp.y = Number(modelData.y);
                // ...
            }
        }
    }

Examples of components that loaderComp could load are defined below. To enable recursion, these components must contain a Repeater that instantiates children components, with loaderComp set as the delegate:

    Component {
        id: itemComp
        Item {
            property alias children: itemRepeater.model
            children: Repeater {
                id: itemRepeater
                delegate: loaderComp
            }
        }
    }
    Component {
        id: buttonComp
        Button {
            property alias children: itemRepeater.model
            children: Repeater {
                id: itemRepeater
                delegate: loaderComp
            }
        }
    }
    Component {
        id: rowLayoutComp
        RowLayout {
            property alias children: itemRepeater.model
            children: Repeater {
                id: itemRepeater
                delegate: loaderComp
            }
        }
    }

The Repeater inside of the components allows us to instantiate components recursively, by having a branch or more of children components in the model, like so:

    // This model lays out buttons vertically
    property var factoryModel: [
        {
            "component": "RowLayout",
            "children": [
                {
                    "component": "Button",
                    "text": "Button 1"
                },
                {
                    "component": "Button",
                    "text": "Button 2"
                }
            ]
        }
    ]

Here we’ve seen how we can use a Repeater, a JSON model, a Loader delegate, and simple recursive definition to instantiate arbitrary QML objects from a JSON description. In my next entry I will focus on how you can lay out these arbitrarily instantiated objects on your screen.

Thanks to Kevin Krammer and Jan Marker whose insights helped improve the code you’ve seen here.

I hope you’ve found this useful! Part 2 may be found already or later by following this link.

Reference

About KDAB

If you like this article and want to read similar material, consider subscribing via our RSS feed.

Subscribe to KDAB TV for similar informative short video content.

KDAB provides market leading software consulting and development services and training in Qt, C++ and 3D/OpenGL. Contact us.

The post Recursive Instantiation with Qt Quick and JSON appeared first on KDAB.

Logo of the KDE Eco initiative. (Image from KDE published under a <a href="https://spdx.org/licenses/CC-BY-SA-4.0.html">CC-BY-SA-4.0</a> license. Design by Lana Lutz.)
Figure : Logo of the KDE Eco initiative. (Image from KDE published under a CC-BY-SA-4.0 license. Design by Lana Lutz.)

What Is Sustainability And Why This Project?

In a general sense, sustainability refers to "the ability to maintain or support a process continuously over time". But what does it mean in terms of software?

With a rise in new technologies over the past half a century, the energy consumption of digital technology has greatly increased as well. Take, for example, large LLM models and cryptocurrency technology: both of these have heavy energy requirements. Software directly or indirectly consumes natural resources. The way software is written has a significant influence on resource consumption, such as with software-induced hardware obsolescence, when hardware vendors drive sales of new hardware through software updates that are incompatible with older hardware. The result is electronic waste and the unnecessary consumption of resources and energy in producing and transporting new hardware.

Sustainability in software means minimizing this waste. How? By designing software to limit energy consumption and have a smaller environmental impact. For this, we need tools to measure how much energy our software — and the hardware which runs it — needs. Without measurements, we cannot compare and we cannot improve!

KDE Eco has been working on KEcoLab, a project from Karanjot Singh to make KDE's measurement laboratory accessible to contributors from all over the world. KEcoLab needed a tool to easily playback usage scenarios for energy consumption data, and this is exactly what Selenium does by running automatic functional testing! But that's not all. Selenium also helps achieve the "KDE For All" goal by enabling accessibility improvements for everyone. It helps achieve the "Automate & Systematize Internal Processes" goal by creating functional tests to ensure the high quality of new code. In this way, Selenium helps achieve all three of KDE's goals!

Writing Tests In Selenium

Selenium AT-SPI is a Selenium-based tool used in KDE for automated tests of GUI applications. It works by identifying accessibility elements for a particular action. To know more about how Selenium AT-SPI functions internally, you can check out this blog post.

Writing a Selenium test is comprised of the following steps:

  • Identifying QML elements where the action needs to be performed.
  • Add accessibility code to QML elements. Accessibility code is basically a locator which will help Selenium identify that element and interact with it.
  • Get elements by its locator. Once we are done with the previous step, we can now access those elements.
  • Perform events on the elements. Once we are able to access elements, we can write code to interact with them.

You can follow this guide to setup Selenium AT-SPI and start writing basic tests. You can also check out this blog post for an in-depth overview.

Video &quot;Selenium AT-SPI: How Selenium Helps Achieve KDE's Goals&quot; (screenshot from Pradyot Ranjan published under a <a href="https://spdx.org/licenses/CC-BY-4.0.html">CC-BY-4.0</a> license).
Figure : Video "Selenium AT-SPI: How Selenium Helps Achieve KDE's Goals" (screenshot from Pradyot Ranjan published under a CC-BY-4.0 license).

Introducing Selenium To More KDE Contributors

This project was done under SoK'24 with these deliverables in mind:

  • Improve the setup process of Selenium.
  • Create video guides to introduce Selenium-based GUI testing to more KDE contributors.

I am achieving this by:

  • Enhancing the Selenium setup guide. You can find the updated Setup and Getting Started guides here. It includes all of the latest packages and info about distro-specific packages and dependencies required to setup Selenium. I've also updated the Writing Tests section to account for deprecated function arguments.
  • Creating slides and videos. I have created video presentations for newcomers to Selenium so that it is a smooth transition. For this I'm using KDE's Kdenlive software for video editing. Once the videos are published online, I will update this blog post with links. The videos broadly cover these topics:
  1. An intro video about what Selenium is and how it is useful in achieving KDE's goals.

  2. Setting up Selenium.

  3. Using the accerciser utility to discover accessibility elements.

  4. Writing accessibility code and tests to show how to access elements.

Using Kdenlive to edit the Selenium videos (screenshot from Pradyot Ranjan published under a <a href="https://spdx.org/licenses/CC-BY-4.0.html">CC-BY-4.0</a> license).
Figure : Using Kdenlive to edit the Selenium videos (screenshot from Pradyot Ranjan published under a CC-BY-4.0 license).

Challenges Faced And Looking Forward

Some challenges that I faced were:

  • Updating the setup guide so it is relevant with the latest changes. Selenium-AT-SPI is a moving target with a lot of internal changes and developements. Tracking down distro specific packages and making a list of deprecated/missing dependencies was time-consuming. The latest version of the setup guide can be found here.
  • Making videos for using Selenium. With no prior experience, this was a challenge for me. I am proud to have done it!

As we move ahead, we have some plans for this project. Some of them are:

  • We will be creating support rooms in Matrix to provide further support for KDE developers.
  • We will use Selenium to adapt usage scenario scripts originally written with xdotool so we can compare the energy profiles of the emulation tools themselves.

Interested In Contributing?

If you are interested in contributing to Selenium-AT-SPI, you can join the Matrix channels KDE Energy Efficiency and Automation & Systematization Goal and introduce yourself. Selenium-AT-SPI is hosted here. Thank you to Emmanuel, Rishi, Nitin, and Joseph as well as the whole KDE e.V. and the wonderful KDE community for supporting this project and for all the help along the way. You can also reach out to me via email or on Matrix: @pradyotranjan:gitter.im.