用QML热重载加速Qt开发

Speed up Qt Development with QML Hot Reload

用QML热重载加速Qt开发

February 25, 2025 by FELGO | Comments

​2025年2月25日由FELGO发表|评论

This is a guest blog post by FELGO, an official Qt Technology and Service Partner.

这是Qt技术和服务合作伙伴FELGO的客座博客文章。

Developing user interfaces with QML is an intuitive way to bring designs to life. Its declarative syntax and flexibility make it perfect for building great UIs. Yet, the traditional development cycle can be slow and frustrating. You have to rebuild your application for every small change, like fixing a typo or adjusting a layout. And you must redeploy and restart it as well. The repetitive nature of this process disrupts your workflow and slows development.

使用QML开发用户界面是将设计变为现实的直观方式。它的声明性语法和灵活性使其非常适合构建出色的UI。然而,传统的开发周期可能缓慢而令人沮丧。必须为每一个小变化重建应用程序,比如修复拼写错误或调整布局。还必须重新部署并重新启动它。此过程的重复性会扰乱工作流程并减缓开发速度。

But what if you could streamline the process with a tool that speeds up UI development? Keep reading to learn how QML Hot Reload can improve your development workflow. 

但是,如果能用一个加速UI开发的工具来简化这个过程呢?继续阅读,了解QML热重载如何改善开发工作流程。

The Challenges of UI Development

UI开发的挑战

Standard UI development requires repeated rebuilds and redeployment with each change. It creates a cycle of repetition, wasting time and disrupting your creative flow.

标准UI开发需要每次更改都进行重复的重建和重新部署。它创造了一个重复的循环,浪费时间,扰乱创作流程。

image1

In the world of development, Code Reload offers a solution. Applying code updates without restarting the application saves valuable time. With QML, custom-made solutions like extra loaders can do the job but come with code overhead. Even if QML reload works, those solutions usually lose your current application state.

在开发领域,Code Reload提供了一种解决方案。在不重新启动应用程序的情况下应用代码更新可以节省宝贵的时间。借助QML,像额外加载器这样的定制解决方案可以完成这项工作,但会带来代码开销。即使QML重载工作,这些解决方案通常也会丢失当前的应用程序状态。

Better Development with QML Hot Reload

QML热重载更好的开发

A tool called Felgo QML Hot Reload solves these challenges. It lets you apply changes without compiling, deploying, or restarting. Felgo Hot Reload is the only QML code reload tool that preserves your application state. You can skip the wait times and keep your workflow fast and efficient.

一个名为Felgo QML Hot Reload的工具解决了这些挑战。它允许您在不编译、部署或重新启动的情况下应用更改。Felgo Hot Reload是唯一一个保留应用程序状态的QML代码重新加载工具。可以跳过等待时间,保持工作流程快速高效。

Moreover, Felgo Hot Reload performs code reload on multiple devices in parallel. You can see your changes on all connected devices at once. Felgo Hot Reload covers all Qt platforms: embedded boards, desktops, mobiles, and web browsers.

此外,Felgo Hot Reload并行地在多个设备上执行代码重载。可以一次在所有连接的设备上看到更改。Felgo Hot Reload涵盖了所有Qt平台:嵌入式板、台式机、手机和网络浏览器。

Why Choose Felgo QML Hot Reload?

为什么选择Felgo QML热重载?

Felgo Hot Reload provides an unparalleled development experience. It offers a range of features to speed up your development workflow and save you time. These benefits can save each developer up to two hours daily, making the tool quickly pay for itself.

Felgo Hot Reload提供了无与伦比的开发体验。它提供了一系列功能来加快开发工作流程并节省时间。这些好处可以为每个开发人员每天节省两个小时,使该工具快速收回成本。

image3

The main benefits are:

主要好处是:

State Preservation

状态保护

Continue working from exactly where you left off. Felgo Hot Reload keeps your application state intact. You no longer have to navigate back to the screen you worked on after each change.

从停止的地方继续工作。Felgo Hot Reload可以保持应用程序状态不变。每次更改后,不再需要导航回使用的屏幕。

Cross-Platform

跨平台

You can develop for Embedded systems, desktops, mobile, or the web. Felgo Hot Reload works across all supported Qt platforms. It also runs with all Qt versions starting from Qt 5.15. That way, you see your updates in realtime across different environments.

可以为嵌入式系统、台式机、移动设备或web进行开发。Felgo Hot Reload适用于所有支持的Qt平台。它也适用于从Qt 5.15开始的所有Qt版本。这样,就可以在不同的环境中实时看到更新。

Multi-Device Development

多设备开发

Connect multiple devices and see your code changes applied to all of them. It lets you test and validate your UI across platforms and screen resolutions. Say you're developing an embedded app for a Raspberry Pi alongside a desktop version. Felgo Hot Reload lets you test your responsive layout on different screens. You can also check how they perform with various input methods, all in one go.

连接多个设备,查看应用于所有设备的代码更改。它允许跨平台和屏幕分辨率测试和验证UI。假设正在为Raspberry Pi和桌面版本开发一个嵌入式应用程序。Felgo Hot Reload允许在不同屏幕上测试响应式布局。还可以一次性检查它们在各种输入法中的表现。

Error Handling

错误处理

If a code change causes an issue, you can revert it without losing the current application state. You see the error details on an overlay within your running application, guiding you to the source file in error. That unique workflow saves time and minimizes disruption to your workflow.

如果代码更改导致问题,可以在不丢失当前应用程序状态的情况下还原它。可以在正在运行的应用程序中的覆盖层上看到错误详细信息,引导找到错误的源文件。这种独特的工作流程节省了时间,并最大限度地减少了对工作流程的干扰。

QML Modules Support

QML模块支持

Reload QML modules, whether you're using a custom project structure or CMake module functions. Your module code changes appear instantly, no matter how you organize your project.

重新加载QML模块,无论是使用自定义项目结构还是CMake模块函数。无论如何组织项目,模块代码更改都会立即出现。

image7

IDE Independence

IDE独立性

Felgo Hot Reload works with your preferred IDE. You can use it with Qt Creator, Visual Studio, Visual Studio Code, or any other IDE. The flexibility allows you to integrate hot reloading seamlessly into your existing workflow.

Felgo Hot Reload适用于首选的IDE。可以将其与Qt Creator、Visual Studio、Visual Studio Code或任何其他IDE一起使用。这种灵活性允许您将热重新加载无缝集成到现有的工作流程中。

Bring Felgo QML Hot Reload into Your Qt Workflow

将Felgo QML热重载引入Qt工作流程

Integrating Felgo Hot Reload into your existing project is straightforward:

将Felgo Hot Reload集成到现有项目中很简单:

Reusability

可重用性

Felgo Hot Reload is a reusable solution and works across all supported Qt platforms. You install a GUI application and link a library to your development build. The setup process is the same for all your projects.

Felgo Hot Reload是一个可重用的解决方案,适用于所有支持的Qt平台。安装一个GUI应用程序,并将库链接到开发版本。所有项目的设置过程都是相同的。

No Added Dependencies

没有添加依赖项

Felgo Hot Reload is a pure development tool. It adds no other dependencies to your project or footprint in your release builds.

Felgo Hot Reload是一个纯粹的开发工具。它不会向项目或发布版本中的足迹添加其他依赖项。

Minimal Integration

最小集成

Implementing Felgo Hot Reload in your project requires minimal changes in C++. You don’t need any modifications in your QML code, and your production code remains unchanged. You can check out the following GitHub repository to see how easy the integration is.

​在项目中实现Felgo Hot Reload需要对C++进行最小的更改。不需要对QML代码进行任何修改,生产代码保持不变。可以查看以下GitHub存储库,了解集成有多容易。

image8

The repository includes a small QML example application with two commits. The first commit is the initial Qt/QML project. The second commit showcases the minimal changes needed to incorporate Felgo Hot Reload.

该存储库包含一个带有两次提交的小型QML示例应用程序。第一次提交是最初的Qt/QML项目。第二个提交展示了合并Felgo Hot Reload所需的最小更改。

Broad Use Case Support

广泛的用例支持

Felgo Hot Reload supports various use cases that QML developers face. It reduces the need to rebuild and redeploy your application almost to zero.

Felgo Hot Reload支持QML开发人员面临的各种用例。它将重建和重新部署应用程序的需求几乎减少到零。

Examples are:

例如:

  • QML Properties and Bindings: Adjust values, update bindings, and change properties.
  • QML属性和绑定:调整值、更新绑定和更改属性。
  • JavaScript Logic: Update function bodies and signal handlers as required.
  • JavaScript逻辑:根据需要更新函数体和信号处理程序。
  • QML Structure: Add new objects, remove existing ones, and replace components without restarting the app.
  • QML结构:添加新对象、删除现有对象和替换组件,而无需重新启动应用程序。
  • QML Modules: Add or remove new QML imports and modules.
  • QML模块:添加或删除新的QML导入和模块。
  • Resource Files: Update images, fonts, and other assets without stopping the application.
  • 资源文件:在不停止应用程序的情况下更新图像、字体和其他资源。

You can see those features of QML Hot Reload in action here:

可以在此处看到QML热重载的这些功能:

https://youtu.be/KYy1SdpEdU4

How Your Team Benefits from Felgo QML Hot Reload

团队如何从Felgo QML热重载中受益

Felgo Hot Reload is a valuable tool for any team developing Qt applications. This is particularly true for in-house product teams. It offers several advantages, including:

Felgo Hot Reload是开发Qt应用程序的任何团队的宝贵工具。对于内部产品团队来说尤其如此。它具有几个优点,包括:

  • Accelerated Development Cycles: Teams can implement changes without constant rebuilds and redeployments. Faster iteration of features leads to quicker project completion.
  • 加速开发周期:团队可以在不进行持续重建和重新部署的情况下实施更改。更快的功能迭代可以更快地完成项目。
  • Improved Collaboration: With real-time updates visible to the entire team, collaboration becomes more efficient. Designers and developers can work together, giving instant feedback and making quick adjustments.
  • 改进的协作:通过对整个团队可见的实时更新,协作变得更加高效。设计师和开发人员可以一起工作,提供即时反馈并快速调整。
  • Enhanced Prototyping: Felgo Hot Reload allows teams to prototype and quickly test new ideas. Testing different UI layouts and functionalities leads to a more user-centered design process. This significantly enhances the end product.
  • 增强原型制作:Felgo Hot Reload允许团队制作原型并快速测试新想法。测试不同的UI布局和功能会导致更以用户为中心的设计过程。这大大增强了最终产品。
  • Reduced Frustration: Teams can maintain their focus and creativity by eliminating the rebuild process. The result is a more enjoyable work environment and higher job satisfaction.
  • 减少沮丧:团队可以通过消除重建过程来保持专注和创造力。结果是更愉快的工作环境和更高的工作满意度。

For Qt service partners and agencies, the benefits are equally compelling. Using a tool that speeds up development might seem counter-intuitive if you bill by the hour. However, delivering high-quality results faster provides a significant competitive advantage in the market.

对于Qt服务合作伙伴和代理机构来说,这些好处同样引人注目。如果按小时计费,使用加速开发的工具可能会显得违反直觉。然而,更快地提供高质量的结果在市场上具有显著的竞争优势。

With Felgo Hot Reload, service partners can:

通过Felgo Hot Reload,服务合作伙伴可以:

  • Prove Efficiency and Value: Clients appreciate efficiency and responsiveness. By speeding up development, you can show that clients get the most value for their investment. This strengthens client relationships and leads to long-term partnerships.
  • 证明效率和价值:客户欣赏效率和响应能力。通过加快开发,可以证明客户的投资获得了最大的价值。这加强了客户关系,并促成了长期合作伙伴关系。
  • Handle Complex Projects with Ease: Managing multiple platforms and devices in parallel becomes effortless with Felgo Hot Reload. It allows service partners to meet client demands quickly and efficiently. They can deliver robust solutions across embedded, desktop, mobile, and web environments.
  • 轻松处理复杂项目:使用Felgo Hot Reload并行管理多个平台和设备变得轻而易举。它使服务合作伙伴能够快速有效地满足客户的需求。他们可以在嵌入式、桌面、移动和web环境中提供强大的解决方案。
  • Enhance Iteration and Feedback Loops: Rapid feedback and iteration cycles mean fewer delays and a smoother development process. This allows service partners to improve satisfaction and reduce project turnaround times.
  • 增强迭代和反馈循环:快速的反馈和迭代周期意味着更少的延迟和更平稳的开发过程。这使服务合作伙伴能够提高满意度并缩短项目周转时间。

In short, Felgo Hot Reload is a powerful tool for both in-house teams and service partners. It provides a significant edge in a competitive market.

简而言之,Felgo Hot Reload是内部团队和服务合作伙伴的强大工具。它在竞争激烈的市场中提供了显著的优势。

Getting Started with Felgo QML Hot Reload

Felgo QML热重载入门

Are you curious how Felgo QML Hot Reload can improve your development process? Listen to this developer to learn how the tool helped their team save time across platforms:

是否好奇Felgo QML Hot Reload如何改进开发过程?听听这位开发人员的话,了解该工具如何帮助他们的团队在不同平台上节省时间:

https://youtu.be/mqYvKDmaykk

Incorporating Felgo Hot Reload into your development boosts productivity and reduces repetitive tasks. You can iterate faster and enjoy a smoother development process with instant feedback. You can focus on delivering high-quality user experiences and exploring new UI ideas.

将Felgo Hot Reload整合到开发中可以提高生产力并减少重复性任务。可以更快地迭代,并通过即时反馈享受更平稳的开发过程。可以专注于提供高质量的用户体验并探索新的UI创意。

For service partners, Felgo Hot Reload offers a unique selling proposition. Faster development cycles and higher client satisfaction. Hot Reload positions you as a proactive, client-focused partner in the development process.

对于服务合作伙伴来说,Felgo Hot Reload提供了一种独特的销售主张。更快的开发周期和更高的客户满意度。Hot Reload将定位为开发过程中积极主动、以客户为中心的合作伙伴。

With Felgo Hot Reload, you can skip the cycle of rebuilds and redeployments. Instead, enjoy a faster, more dynamic development experience.

使用Felgo Hot Reload,可以跳过重建和重新部署的循环。相反,享受更快、更动态的开发体验。

How much time can you save? Try a demo and get a free evaluation to see the benefits of Felgo QML Hot Reload in your projects. Start your path toward a faster, more productive workflow at felgo.com/qml-hot-reload!

​你能节省多少时间?尝试演示并获得免费评估,以了解Felgo QML Hot Reload在项目中的好处。请访问felgo.com/qml-hot-reload,开始通往更快、更高效工作流程的道路!

------

About Felgo

关于费尔戈

Felgo has been a Qt Technology Partner since 2014, with the goal of helping Qt developers be more productive.

Felgo自2014年以来一直是Qt技术合作伙伴,其目标是帮助Qt开发人员提高生产力。

Felgo is also a Qt Service Partner for development servicesQt training, and workshops.

​Felgo也是开发服务、Qt培训和研讨会的Qt服务合作伙伴。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值