Introducing Flow Mode in Qt Design Studio 1.5 - Part 1

With the 1.5 release Qt Design Studio you can now try the flow mode feature. In this first part of a multi part blog post I want to cover the basic usage of the flow mode and how to get started, at the end we will look at the planned advanced features coming up in the next version of Qt Design Studio.

Kuesa 3D Studio 1.2 – Press Release

KUESA™ 3D Studio 1.2 released

A Complete Design-to-Code Workflow Solution for 3D Assets in Real-time Applications

  • version 1.2 released
  • makes 3D design and development workflows easy, fast and reliable
  • offers support for Maya, Autodesk 3ds Max, and Blender as well as any other glTF-compatible digital content creation tools
  • New: Iro materials library can simulate common surface properties with less designer and GPU overhead
  • free live webinar June 4th, 6pm CEST

Berlin, June 2nd 2020

Building software that is dependent on real-time 3D models – like for example an automotive dashboard, MRI machine, factory control system or furniture design tool – requires not only 3D designers and 3D programmers. It also demands the ability to bring these very different skill sets together into a smoothly operating workflow.

In conventional workflows, a massive problem is that the assets created by 3D artists can rarely be used by programmers directly, forcing the development team to hand-tweak models and hand-code animations to make things work. It also forces designers to move their designs to target hardware to see how they’ll actually appear. This manual work extends product release timelines, and the artificial wall it creates between 3D artists and software engineers is a bottleneck that prohibits rapid iteration and the fine-tuning required to develop fast and high-quality results.

To eliminate this problem KDAB created KUESA 3D Studio. It makes the collaboration of designers and developers much more manageable by offering a seamless, integrated workflow. Designers can realize their vision using their favorite tools, developers can focus on their strengths without having to deal with design issues, and management can rely on getting better products to market faster.

How does KUESA 3D Studio work?

KUESA 3D Studio is comprised of three main components.

The KUESA 3D Design Plugins augment a designer’s preferred digital content creation tools, allowing them to create and export fully accessible 3D scenes and to display content that visually matches the run-time environment.

Many additional utilities are integrated in KUESA 3D Tools for fine-tuning, conditioning, investigating, debugging, and optimizing 3D assets, usable by either designers or developers.

Libraries built on top of Qt and Qt 3D allow developers to integrate 3D scenes directly into applications. This module is called KUESA 3D Runtime.

What’s new in version 1.2?

One of the most significant improvements is the Iro Materials Library. Physically-based rendering (PBR) can generate amazing images, but not all embedded systems have enough processing power to handle it. Also, without knowing the actual physics, PBR isn’t easily tweakable to simulate materials such as a pre-defined bitmap that needs to appear glossy. For these cases, or any other where PBR may be overkill, KUESA 3D Studio supports the Iro Material Library. This library provides a catalog of materials that can simulate common surface properties (such as reflections, clear-coated paint, and transparency) and gives great looking results with less designer and GPU overhead.

By default, glTF™ only allows you to animate transformation properties like translation, rotation, scale. In lots of cases, it would be useful to animate other properties like material properties, camera properties etc. This has now been added through the use of a custom glTF extension.

An additional benefit is brought in by Qt 3D, which KUESA 3D Studio is based on and which is maintained by KDAB. With Qt 3D on Qt 5.15.0 very potent profiling capabilities have been added.

More features:

  • Support for Maya, Autodesk 3ds Max, and Blender, as well as any other glTF-compatible digital content creation tools
  • Ability to build 3D scenes with PBR, non-PBR, and node-based materials
  • Real-time performance on desktop and embedded systems
  • Integration of both 3D and 2D assets
  • Compressed textures, meshes, and images for faster load times, reduced application size, and optimal use of GPU resources
  • Full programmatic access to scene items with APIs in C++ and QML
  • Photo-realistic results consistent across design tools and applications
  • Special effects like bloom and depth-of-field
  • Up to date with Qt 3D performance improvements in Qt 5.15
  • Ability to incorporate tools into a continuous integration system resulting in consistent 3D asset verification and conditioning
  • Availability of AGPL 3 license for KUESA 3D Runtime

———————————————————————————————————————————

More information on www.kuesa.com

Live demo webinars are scheduled for:

June 4th 2020… (6pm Central European Time)

June 18th 2020... (8am Central European Time)

Video footage

About the KDAB Group

The KDAB Group is the world’s leading software consultancy for architecture, development and design of Qt, C++ and OpenGL applications across desktop, embedded and mobile platforms and is one of the biggest independent contributors to Qt. Our experts build run-times, mix native and web technologies, and solve hardware stack performance issues and porting problems for hundreds of customers, many among the Fortune 500. KDAB’s tools and extensive experience in creating, debugging, profiling and porting complex applications help developers worldwide to deliver successful projects. KDAB’s trainers, all full-time developers, provide market leading, hands-on, training for Qt, OpenGL and modern C++ in multiple languages. Founded in 1999, KDAB has offices throughout North America and Europe.

More Information on www.kdab.com Press Contact: press@kdab.com

Download this report

The post Kuesa 3D Studio 1.2 – Press Release appeared first on KDAB.

Kuesa 3D 1.2 release!

Today, KDAB is releasing version 1.2 of the 3D integration workflow Kuesa 3D, built on top of Qt 3D.

Kuesa™ 3D is a complete design-to-code workflow solution for 3D in real-time applications, centered around the open glTF™ 2 format, supported by Blender, Maya and 3ds Max.

Read the Press Release…

In short, Kuesa provides a workflow that simplifies work for both designers and developers. It is centered around the glTF 2 format. The idea behind Kuesa 3D is that changes made on 3D models shouldn’t require much, if any, work on the developer’s side. As a consequence, you can iterate more frequently, get feedback more often and release on time.

In this blog post, we will highlight some of the new features we have introduced. You can get the full details here.

What’s new since 1.1?

The Iro Material library

The glTF 2 format currently only supports a Metallic Roughness physically-based material. As a result, it looks great but can be very expensive to render and requires lots of assets. For many use cases, simpler materials can be used instead: this is what the Iro Material library offers.

The library provides several materials that simulate reflections, clear coats of paint or simple transparent surfaces. The benefits of Iro materials are twofold:

  • they significantly reduce your GPU usage (compared with PBR materials), making them ideal for embedded or mobile applications;
  • they offer a real WYSIWYG integration with your 3D authoring tool: Kuesa is going to render your 3D models exactly like they appear in your artists’ editing suite.

This video by my colleague Timo Buske shows Iro Materials in action:

Improved Blender Support

Despite a steep learning curve, Blender is a fantastic tool and the latest version brings lots of interesting features to the table. For that reason, we have added support for Blender 2.8.

We can therefore now rely on the official glTF 2.0 export bundled with Blender. Furthermore, to make the best use of it, we’ve contributed patches that allow extending the exporter through custom extensions.

Then, we’ve added an extension to allow exporting of Iro Materials to glTF 2.0 files. In addition, we’ve also updated the Kuesa Blender addon to show a real time preview of the Iro Materials in Blender. What you see in Blender is what you’ll get with Kuesa 3D.

Improved animation support

Currently, glTF 2.0 only supports animating transformation properties (translation, scale, rotation) of objects. Incidentally, there is a draft of an extension EXT_property_animation to add support to animate any property.

Since that was a really important feature for us, we’ve decided to implement it for Kuesa 3D. In that sense, we’ve added a custom EXT_property_animation to the exporter. Next, we’ve updated the glTF 2 importer in the Kuesa 3D Runtime library to parse it properly.

Hence, we can now animate material, lights or camera properties in Blender, export the scene as a glTF file (with the extensions) and load it with Kuesa 3D Runtime.

An updated offering

With this new release, we changed the offering of the product to satisfy different use-cases.

Kuesa 3D Studio

Kuesa 3D Studio is the complete solution a team can use in production, with everything needed to satisfy both designers and developers:

  • Kuesa 3D Design Plugins:
    • Blender addons supporting:
      • Kuesa 3D extensions for Layers and Iro materials
      • The EXT_property_animation extension
      • Real time preview of the Iro materials in the Eevee viewport
  • Kuesa 3D Tools:
    • glTF editor application allowing preview and introspection of glTF 2 scenes
    • collection of command line tools to check and optimize assets
  • Kuesa 3D Runtime: Qt module library on top of Qt 3D
    •  glTF 2.0 fully compliant loader
    • support of Kuesa 3D and EXT_property_animation extensions
    • retrieve the various resources held in the scene
    • playback animations
    • add post processing effects such as Bloom, Depth of Field …
    • use a premade Qt 3D FrameGraph

The Kuesa 3D Tools and Runtime also support any glTF 2.0 files coming from other application like Maya, 3DS Max or others, as long as they can export to glTF 2.0.

You can find out more about Kuesa 3D Studio here.

Kuesa 3D Runtime

Kuesa 3D Runtime is also available as a separate product, full support from us. The product is available on the Qt marketplace or directly from us. This is perfect if you want to try out Kuesa and see what you can do with it.

Like previous releases, it is freely available under the AGPL 3 license.

Since it is built on top of Qt 3D, you can use the full Qt 3D API to further customize your application. For the most part, you can leverage things like Picking, Camera handling and a lot more for free.

As for actual Qt requirements, Kuesa 3D Runtime requires either the latest Qt 5.12 or the new Qt 5.15 release.

Find out more about Kuesa 3D Runtime.

Additional Contributions

Lastly, Kuesa 3D is also a way for us to justify contributions to open source projects. In that sense, we’ve made a few contributions targeting:

  • Support for registering and creating user defined extension in Blender’s glTF exporter
  • Fixes for animations on the official Blender glTF exporter
  • Qt 3D bug fixes and performance improvements

Try it out!

You can download Kuesa 3D Runtime from our GitHub repository.

Download the latest Kuesa 3D Studio brochure.

Join our live webinars and ask questions:

Watch our Realtime Music Box short video where I explain all this running on one of our demos:

About KDAB

If you like this blog and want to read similar articles, 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 Kuesa 3D 1.2 release! appeared first on KDAB.

Debugging Qt for WebAssembly


Debugging is often difficult in the best of times. Debugging Qt webassembly apps in the web browser is not something I want to do on a nice summer day, and certainly makes a person more appreciative of mature, gui based debugging. But sometimes you have to do what you have to do.

If you have a crash on your Qt for WebAssembly app, you would see a not very human readable backtrace in the console output. You can start by recompiling your app with CONFIG+=debug, which allows nice symbol names in the backtrace that appears in the dev console of the browser when an exception or crash happens. Many times this can lead you to find your bug fairly quickly.

NOTE: The Qt libraries do not need to be compiled in debug mode for you to just see symbols while debugging. Although, if you want to step through C++ source code using sourcemaps, you will need to compile Qt and your application in debug mode.

The easy way is to add qDebug output, run it and see what happens. I do this quite often. But just as often, it is not enough to find a particular bug.

One issue with that is linking emscripten based wasm files takes a long time (because that is where all the magic happen), so this method is rather time consuming. Thankfully, with Qt 5.15, we use Emscripten 1.39.8 which is based on upstream clang, transpiles directly to wasm binaries and skips the internediate step of outputting javascript, so link time is greatly reduced.


What if you need to step through the source code like a desktop debugger? QtCreator does not at this time, have support for debugging Qt WebAssembly apps. I suppose it could be implemented using the browsers remote debugging interface API 

Emscripten can be used to generate source maps for the browser debugger to utilize for debugging. In Qt, we use qmake to add the necessary linker lines to allow emscripten to generate these source maps. Qt should do this by default when you use CONFIG+=debug

There is a bug that was recently fixed regarding this. If you do not find any source maps files (.map), the workaround is to add QMAKE_LFLAGS_DEBUG += -g4 in your pro file.

By default, the source base in Qt is set to use http://localhost:8000/

You can change this by adding into your .pro file, something like:
QMAKE_WASM_SOURCE_MAP_BASE = http://myip:6931 /

Emrun by default uses port 6931.

If you are running a server of some sort, you can use the ip for that. 

Sources need to be in the directory tree seen by the server, so an in-source build is the easiest. In my experience, Chrome browser seems to be able to debug with sourcemaps better. If you are using Mac or Linux, you can simply symlink the source file path into the web server base.

This is what happens when you do not have this set up correctly:

Error while fetching an original source: request failed with status 404
Source URL: http://192.168.0.21:6931/src/wasm-windows/main.cpp

Or pehaps you see a message in the sources tab of the browser console such as:
Could not load content for http://localhost:8000/depot/qt/qt5/qtbase/examples/widgets/richtext/textedit/textedit.cpp (HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE)

It means it would not find the specific source file. You can symlink the sources directory.
I am using chrome, as I had better luck with it utilizing the sourcemaps. The actual procedure for firefox might be a bit different. It isn't working for me at this time.
  • emrun --browser chrome --port 8000 --hostname localhost --serve_after_close textedit.html 
    • (or wasmsourceserver.py as below)
  • open the web console
  • [chrome] Go into the debugger by clicking on 'sources'
  • [firefox] Uses the 'Debugger' tab
You should now see some entries to source files, including our main.cpp


You can now step in, step out, step over and even set breakpoints, just like a desktop gui debugger like QtCreator.



Note that these file paths are relative, and will create an error when you try debugging it, when it tries to step into a source file not local. This defeats the purpose of steping into code for the most part.

Morten has a work around on the QTBUG https://bugreports.qt.io/browse/QTBUG-72002 with a python web server named:
wasmsourceserver.py

By running this custom server, it will build a file map of all the files in the current directly reursively.


Another way to add a type of breakpoint, if you want to stop execution on a certain line and popup the browser debugger programmatically, you can add
 emscripten_debugger(); 
on the line you want it to stop and pop up. This is in the header emscripten.h, and recompile.




You can also read more about Mobile and Embedded development and Qt for WebAssembly in the book Hands-On Mobile and Embedded Development with Qt 5


What are the Best Practices of Qt on Mobile in 2020

What makes an app marketable? There are many requirements that an app needs to meet to be successful. In this article, you can learn the best practices of developing successful apps with Qt on mobile devices.

Overview:

Note: This article is a recap of the session presented by our CEO & Co-Founder, Chris, at Qt Virtual Tech Con 20. In his talk, he shared his deep insights about the best practices of mobile-optimized apps and how to overcome the mobile optimization challenges on iOS and Android devices. You can watch the full session by clicking on the video below:

Using Visual Studio Code for Qt Applications – Part Two

In the last blog post we saw an essential, C++ oriented, Visual Studio Code setup. That was enough to get going right away, but we can still definitely do more and better. Here I’ll show you how to get a complete setup for your qmake and CMake projects, all this while also wearing a Qt hat (on top of my C++ hat) and having a deeper look at the Qt side.

Build qmake Qt projects

Qmake is not integrated with Visual Studio Code the way CMake is, so setting up a qmake project for build is slightly more convoluted than doing the same with CMake. This means we’ll have to define our own build tasks. We’re going to do this in two stages: build steps definition and build steps combination, leveraging the fact that Visual Studio Code implements task dependencies and ordered sequential execution of dependencies.

Create build steps

As far as build steps are concerned, the following are, in a nutshell, the ones that will cover most cases:

  • Create the build directory (in a way that doesn’t fail if the directory already exists)
    {
      "label": "Create build dir",
      "type": "shell",
      "command": "mkdir -Force path/to/build/dir"
    }
    

    Here, -Force is a powershell parameter that will prevent the command to fail if the directory already exists. On Unix based systems, you can use mkdir -p instead.

  • Run qmake
    {
      "label": "Run qmake",
      "type": "shell",
      "command": "qmake",
      "arg": [ ... add your qmake arguments here ... ],
      "options": {
        "cwd": "path/to/build/dir"
      }
    }
    
  • Run make/nmake/jom, depending on the platform
    {
      "label": "Run make",
      "type": "shell",
      "command": "jom",
      "options": {
        "cwd": "path/to/build/dir"
      }
    }
    
  • Clear build folder This can mean different things depending on how the build file is configured. It could be a simple make clean, or a more thorough removal of the whole content of the build folder.
    {
      "label": "Clear build folder",
      "type": "shell",
      "command": "jom clean",
      "options": {
        "cwd": "path/to/build/dir"
      }
    }
    
Combine build steps

Now that our steps are defined, we can go on and define the actual build tasks. We’ll prepare two for this example, one for running a build, and one for running a clean build. Let’s see the task for a regular build:

{
  "label": "Build",
  "dependsOn": [
    "Create build dir",
    "Run qmake",
    "Run make"
  ],
  "dependsOrder": "sequence"
}

There are two new properties here: "dependsOn" is a list of task labels, and it means that those tasks need to be executed before the current task is built, while "dependsOrder", when set to "sequence", will tell Visual Studio Code to run all dependent tasks sequentially and in the given order.

The task for a clean build is very similar and will only have an extra step where the project is cleaned before being built again:

{
  "label": "Clean build",
  "dependsOn": [
    "Clear build folder",
    "Create build dir",
    "Run qmake",
    "Run make"
  ],
  "dependsOrder": "sequence"
}

And that’s it, now it’s just a matter to open the command palette (Ctrl+Shift+P), select “Task: Run Task” and then “Build”.

Use a default task

As an alternative (or better, an addition) to selecting manually the build task from a list every time, Visual Studio Code also allows to run a default task with a key combination (Ctrl+Shift+B). To mark a task as default, you need to add a few extra lines to the task configuration:

{
  // ... task configuration
  "group": {
    "kind": "build",
    "isDefault": true
  }
}
Use your own Qt

If Qt is not configured at a system level, or you want to use a Qt version other than the default one installed and configured in your system, you need to explicitly configure the environment so that every task is run with the right Qt version in the path. Visual Studio Code allows you to do this every time a terminal is launched for running a task, so our environment customizations are set before running the task command.

This is done in the settings file (or in the workspace settings if you’re working with a workspace), and the property name for this setting is system dependent: either "terminal.integrated.env.windows", "terminal.integrated.env.linux", or "terminal.integrated.env.osx". The property requires an object, where each property is the name of an environment variable, and the associated value is the value for the variable. Below is an example configuration for Windows:

{
  // All other settings...
  "terminal.integrated.env.windows": {
    "PATH": "C:/Qt/5.12.4/msvc2017_64/bin;${env:PATH}"
  }
}

Build CMake Qt projects

Setting up a CMake based project using the CMake extension doesn’t require any settings manipulation if Qt is already configured on your system. What you will need is to select a CMake kit (the CMake extension finds them automatically), a build variant, and launch the build with F7.

Short video showing how to launch a CMake build with Visual Studio Code

However, you may want to use extra arguments in the configuration step or specify your build directory so for instance it doesn’t end up being inside the source directory. You can customize CMake configuration arguments by setting the property "cmake.configureSettings" in your settings file. This property expects a list of string arguments that will be passed to CMake during the configuration step:

"cmake.configureSettings": {
  "CMAKE_PREFIX_PATH": "my/prefix/path",
  "ENABLE_FEATURE": "1",
  "ENABLE_OTHER_FEATURE": "0"
}

To customize the build directory, just set "cmake.buildDirectory" to the desired path. This value may contain variables, so it can be configured, for instance, to point a path relative to the project folder:

"cmake.buildDirectory": "${workspaceFolder}/../build-cmake-project"

If you want to use a custom Qt version, or Qt is not configured system-wide (as is the case on Windows) it’s enough to set CMAKE_PREFIX_PATH properly in the "cmake.configureSettings" property in the settings file. For example:

"cmake.configureSettings": {
  "CMAKE_PREFIX_PATH": "otherprefixpath;C:/Qt/5.12.4/msvc2017_64"
  // ... other args
]

You can find a complete documentation for the CMake Tools extension here, featuring a guide on how to use CMake Tools from the UI, and a documentation for all available settings.

Running and debugging our Qt application

Now that your application has been built, let’s see how we can launch it and, most importantly, debug it.

Running qmake projects

For projects built with qmake, we don’t have any help from extensions and the only option we have is to bake our own launch configurations in the way we’ve seen in the last blog post. This is done in the launch configurations file (launch.json) or in the workspace file, and this is how a launch configuration looks:

{
  "name": "My application",
  "type": "cppvsdbg",
  "request": "launch",
  "program": "path/to/application",
  "stopAtEntry": false,
  "cwd": "${workspaceFolder}",
  "environment": [],
  "externalConsole": false
}

You can run launch configurations both with or without debugger, using “Debug: Start Debugging” (F5) or “Run: Start Without Debugging” (Ctrl+F5) respectively. If Qt is not configured at a system level, or you want to use a custom Qt version, the corresponding launch configuration will need to be explicitly configured to include Qt in its path.

You can do this by updating the "environment" property in the launch configuration. Below is an example for Windows, setting only the "PATH" environment variable. Configurations for other systems need to be adjusted but are essentially similar.

"environment": [
  {
    "name": "PATH",
    "value": "C:/Qt/5.12.4/msvc2017_64/bin;${env:PATH}"
  }
]

Side note: here ${env:PATH} means whaterever value the environment variable PATH has before the launch configuration is run. In general, the syntax ${env:VARNAME} can be used to get an environment variable in a task or a launch configuration.

Running CMake projects

Working with CMake is easier in principle, as the CMake extension provides the commands “CMake: Run Without Debugging” and “CMake: Debug”, allowing you to respectively launch and debug CMake targets.

However, this approach has a number of shortcomings:

  • It’s not possible to specify per-target run arguments for debug runs.
  • It’s not possible at all to specify run arguments for non-debug runs.
  • Some debugging options such as source mapping or custom views with natvis are not configurable using cmake settings.

So in conclusion using the CMake extension for running targets is not really convenient if you want a comprehensive debugging experience, and the best way to go is still to create your own launch configurations.

The CMake extension provides a few convenient variables for launch configurations:

  • ${command:cmake.launchTargetPath}: resolves to the full path of the executable for the target selected from the launch target menu.
  • ${command:cmake.launchTargetDirectory}: resolves to the directory containing the executable for the target selected from the launch target menu.

Qt aware debugging

What we’ve seen until now will let you build and run your Qt applications, using either your system provided Qt or your own. Debugging will work out of the box already, as long as the application code is involved. But wouldn’t it be great to also be able to peek inside Qt’s source code while debugging? Or if we had a better visualization for Qt specific types?

Turns out we can do both with little manipulation on launch configurations. Let’s see how.

Configure debug symbols

Usually Qt debug symbols are distributed alongside libraries, so there’s no real need to explicitly configure debug symbols paths. If that’s not the case, you can configure the debug symbols path by setting the "symbolSearchPath" property on a launch configuration. This property is a string and contains a list of paths separated by a semicolon.

"symbolSearchPath": "otherSearchPath;C:/Qt/5.12.4/msvc2017_64/bin"

This of course can be useful for adding debug symbols for other libraries too.

Source mapping

If the source directory for your Qt differs from the actual source directory (or directories) used while building it, you can configure the debugger to resolve those paths correctly. This happens for instance with binary Qt releases on Windows. You can enable source mapping in launch configurations by adding the "sourceFileMap" property. This property requires an object where each key is the source folder as it’s provided by the debug symbols, and the corresponding value is the path where the source code is in your system. This is how it can be configured for a binary Qt release on Windows:

"sourceFileMap": {
    "C:/work/build/qt5_workdir/w/s": "C:/Qt/5.12.4/Src",
    "Q:/qt5_workdir/w/s": "C:/Qt/5.12.4/Src",
    "C:/Users/qt/work/install": "C:/Qt/5.12.4/Src",
    "C:/Users/qt/work/qt": "C:/Qt/5.12.4/Src"
}
Using Natvis for Qt aware objects visualization

Natvis is a Visual Studio framework that allows you to customize how native C++ objects are visualized in the debugger. Natvis visualization rules are specified through xml files with a specific schema. A natvis file lists visualization rules for each C++ type, and every visualization rule consists in a series of properties. Such properties are meant to be user friendly and will be displayed on the debug window when visualizing objects of the corresponding type.

To name a few examples, a QString is visualized as the string it contains and has a size property and a number of items corresponding to its characters, and QRect will have a width and a height property instead of just the bare (and less intuitive) internal representation of the top left and bottom right points (x1, y1, x2, y2).

If you want to enable natvis in a debug run, just set the "visualizerFile" property in your launch configuration so that it points to the natvis file.

"visualizerFile": "path/to/qt5.natvis"

Debug pane before and after configuring natvis

You can find a ready to use natvis file for Qt 5 at this link.

Updating the code model

In order to be able to navigate Qt headers and enable IntelliSense for the Qt API, it’s enough to adjust the C++ settings for our project (c_cpp_properties.json) by adding the Qt include folder (and all its subfolders):

{
  // ...
  "includePath": [
    // ...
    "C:/Qt/5.12.4/msvc2017_64/include/**"
  ]
}

If you’re working on a CMake project, it’s also possible to use the CMake plugin as a configuration provider. Doing so, include paths and defines will be bound to the currently configured CMake build, and won’t need to be specified manually. This simplifies the C++ properties file considerably, as it’s shown in the example below:

{
  "configurations": [
    {
      "name": "Win32",
      "intelliSenseMode": "msvc-x64",
      "configurationProvider": "vector-of-bool.cmake-tools"
    }
  ],
  "version": 4
}

A note about using Visual Studio compilers on Windows

Visual Studio provides batch files that automate the environment setup necessary to use their C++ compiler and linker. In the last post we saw how it’s possible to configure a task so that it sets up the environment through the vcvars.bat script before running a command.

However, if you need to configure the environment with vcvars.bat for most of your build steps, it is also possible to configure Visual Studio Code so that it runs the batch file for every task. To do so, you need to tweak the configured shell (which is powershell by default on windows) and pass a few args. The setting name for doing this is “terminal.integrated.shellArgs.windows” and it’s set as follows:

"terminal.integrated.shellArgs.windows": [
  "Invoke-BatchFile 'C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Auxiliary/Build/vcvars64.bat' amd64",
  "; powershell"
]

What’s going on here is this: Visual Studio Code will launch by default every shell task by calling this command:

powershell <terminal.integrated.shellargs.windows> -Command <task command> <task argument list>

So, if you set “terminal.integrated.shellArgs.windows” this way, the final command will look like this:

powershell Invoke-BatchFile 'path/to/vcvars' ; powershell -Command <task command> <task argument list>

As a result, task commands will be effectively run in a powershell with the right environment set.

And that’s it for now. Many new things on the table, and some advanced features too. Hopefully this will help you with your workflow.

But there is still more to say, so make sure you don’t miss the next post!

About KDAB

If you like this blog and want to read similar articles, 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 Using Visual Studio Code for Qt Applications – Part Two appeared first on KDAB.

Qt for Python 5.15.0 is out!

Hello everyone! We are really happy to announce that Qt for Python 5.15.0 is now out! 🎊🐍

As always, you can get the latest via: pip install pyside2, or just upgrading your current installation: pip install -U pyside2.

At the same time we wanted to release another version for users still on 5.14, so we decided to release 5.14.2.2 too. You can get it via pip install pyside2==5.14.2.2

We spent most of our time dealing with an old issue related to Threads and Python, but still - we had time to work on other improvements, that you can check in our changelog. Now, let's talk a bit about this release.

April 2020

Blogs

An engineer answers the doorbell

by Andreas Holzammer

A funky solution during a pandemic, when most of the office is empty.

Read more…


Qt, range-based for loops and structured bindings Part 1

by Ivan Čukić

The evolution of the C++ programming language and Qt.

Read more…


Why is my screen Black? A digestible blog on common render issues and what could be their cause

by Robert Brock

Introducing a new blog series.

Read more…


Publications

Qt and CMake

by Kevin Funk

Download the whitepaper…


News

Qt and Open Source

KDAB’s CEO Kalle Dalheimer talks with Robert Brock for KDAB News.

Watch the video…


KDAB Online training – One day – June 17th

Qt’s Model/View framework for widget development

Read more and book your place…


Update to Qt Small Business Licence

Now available for small businesses with annual revenue and funding up to $250,000.

Read more and get your license here…


Events

Qt Virtual Tech Con – 12-14 May

Read more here…


The post April 2020 appeared first on KDAB.

Qt 5.15 LTS Released

I'm thrilled to announce that we've released Qt 5.15 LTS today. Qt 5.15 is going to be the last feature release of the Qt 5 series. As such, it is a bit special, and a lot of work has gone into preparations towards Qt 6, our next major release. While Qt 5.15 is supported as usual for all our users, Qt 5.15 will also provide long-term support for three years to all commercial license holders, including the new Qt for Small Business. Option for extended support is available after the three year support period.  

Qt Design Studio 1.5 released

We are happy to announce that the Qt Design Studio 1.5 is now available via the online and offline installers.

Qt Design Studio 1.5 comes with a fully supported 3D editor which enables designing seamlessly integrated 2D and 3D UIs.
We have taken the best concepts from Qt 3D Studio and ported them over to Design Studio. This is the first time we have a one unified designing tool that supports both 2D and 3D.
To streamline collaboration between designers and developers Qt Design Studio can be used by both, designers and developers.

What's New with Qt for Android

Qt 5.15 LTS and Qt for Android

Since many developers use Qt for Android, we want to improve the developer experience. With the upcoming release of Qt 5.15.0, we have revamped the documentation for Android. The new documentation has lots of new content on how to use Qt for Android maximizing its full potential. It explains in more detail how to extend Qt to support more advanced features and enhance integration with Android APIs.  

Using Modern CMake with Qt

KDAB’s Kevin Funk presented Using Modern CMake with Qt at Qt Virtual Tech Con last month.

He reported that the Qt Company did a great job moderating the sessions at this event, and there was a lively Q&A at the end – Kevin had to pick from about 60 questions, so this is a hot topic.

Now the event is over you can access Kevin’s talk here, including the answers he had time for, and also his slides, below the abstract.

Using Modern CMake with Qt with Kevin Funk

Prerequisite: No prior CMake experience required

CMake is a cross-platform build system, with powerful APIs for finding dependencies of various or specific versions, and with many abstractions for platforms, compilers, other build systems, and dependencies.

The next major Qt version, Qt6, will be using CMake internally as its build system, so the CMake integration with Qt will likely get tighter and more versatile in the long-term.

In this talk, we’ll be introducing Qt specific CMake functionalities, in order to find and use Qt5 inside your personal CMake-based project, using modern CMake capabilities. We are going to discuss how to find Qt installs using CMake’s find_package function and how to find specific Qt versions when multiple versions are installed.

Further than that, useful CMake variables such as CMAKE_INCLUDE_CURRENT_DIR, CMAKE_AUTOMOC, CMAKE_AUTORCC, and CMAKE_AUTOUIC will be explained in detail and how the use of the CMake integrations can speed up the build drastically.

Last but not least some of the additional supplied Qt related CMake functions, such as for big resources or translation support will be discussed.

Target audience: Build Engineers or Software Engineers who would like to know more about using Qt under CMake.

Download Kevin’s slides: QTVTC20 – Using Modern CMake – Kevin Funk

About Kevin Funk

Kevin has actively developed with Qt/C++ since 2006 and has a special interest in tooling and profiling. He’s an active contributor to KDAB’s GammaRay analyzer (a high-level Qt application debugger) and has a strong emphasis on state machine tooling. He is a co-maintainer of the KDevelop IDE, a powerful C/C++ development environment backed by Clang, and is pushing for cross-platform success inside KDE. Kevin holds a Masters Degree in Computer Science.

Download Kevin’s whitepaper on CMake and Qt…

The post Using Modern CMake with Qt appeared first on KDAB.

Meet Qt Design Studio 3D Editor

In Qt Design Studio 1.4 we introduced for the first time an experimental integration of Qt Quick 3D into Qt Design Studio. This gave the community a taste of the seamless 2D / 3D integration that Qt Design Studio is going to embrace. We have utilized our experience in Qt 3D Studio to bring the best 3D concepts to Qt Design Studio. The result is a comprehensive integrated 3D tool for composing and editing 3D scenes within Qt Design Studio. Meet the 3D Editor!

IoT Hub Device Provisioning Service, bring your IoT Devices into the Cloud. (Part 4 of 4)

IoT Hub Device Provisioning Service, bring your IoT Devices into the Cloud. (Part 4 of 4)

The Device Provisioning Service is a managed service running in the Azure cloud which supports automatic provisioning of IoT devices for IoT Hub.

The following sections will give a short introduction to the most important features of the Device Provisioning Service.

Continue reading IoT Hub Device Provisioning Service, bring your IoT Devices into the Cloud. (Part 4 of 4) at basysKom.

Why is my screen still black

Part 2

If you are here from Part 1, welcome back. If you are wondering why we started at Part 2, go to Part 1.

Black Screen

Uncanny Valley!

So, you tried everything from the first part (that was relative to you), and your screen is still a backlighting test? No problem. (Well.. I mean, clearly there is but you know what I mean) We’ve gathered another five reasons this could be happening and how to go about fixing them.

Issue 6: Directional light is pointing in the wrong direction.

There are a few choices when it comes to choosing a light source for your scene. You can even add more than one. So we have Point lights, Directional lights, Spot lights and Area lights. You can then also have emissive textures that will act as a light source. Some of these get tricky… say, if you have a Spot or Directional light, you have to make sure they are pointing at something. For testing, you can always have a point light in the scene but even with these, you have to make sure they won’t be ‘inside’ an object, aren’t black and have a decent brightness.

Issue 7: It’s so dark in here. Did you not turn any lights on?

If using a lighting model, ensure the lights are actually enabled. A good test here is to set a temporary glClearColor (eg pink) – this will usually show un-lit geometry as black. Another solution is to set an ambient colour term and/or changing the background colour to something lighter.

Issue 8: Are you supplying enough power to your Raspberry Pi 4?

The Raspberry Pi 4 has dual HDMI outputs. Using the Qt EGLFS backend, these are available as different displays – so can run two different Qt applications, one full-screen on each. But if your system is near the limits of its power supply (and the onboard power monitor is quite picky, on the Pi) – the second display might fail to initialise. When debugging this problem, we initially tested different OpenGL backends and QPA plugins, but none of these made any difference. Very occasionally both displays would work, but mostly the second one would fail to initialise with an EGL error. A beefier power supply fixed the problem immediately. (Sometimes, it’s really not a software problem)

Issue 9: The GL context won’t create.

This can happen for instance if you upgrade your drivers (especially common with Linux and NVidia cards) and don’t reboot, there’s a high chance that your system won’t be able to create a GL context anymore. To make sure that this is the issue, start a simple 3D program such as glxgears. If it does not work, only one solution : reach for that restart button.

For more info, see: Checkliste Allgemein (German)

Issue 10: Return of the mac. – You’re using the wrong profile

OpenGL has been around for a while and has many version. Maybe you are using something that requires a more recent version of OpenGL? One thing that is more subtle, especially when updating old code to more modern practices, is the concept of profile. As of 3.2, contexts can be created with a Core profile or a Compatibility profile. The latter preserves compatibility with older fixed function pipeline code and settings. However, it is optional for drivers to implement that profile. Apple, in its wisdom, has decided not to do so. So if you ask for a Compatibility profile, it will create a 2.1 context, and you will not be able to use 3.0 or later features.

So, make sure Core profile is enabled, on the default QSurfaceFormat instance.

Other cross-platform issues are quite common. For example, NVIDIA drivers tend to be forgiving and accept using texture2D() in shaders even though it should not be allowed in a Core profile. So test on as many platforms and driver setups you can lay your hands on.

Once you’ve double checked the camera settings, shaders and your model settings, 6, 7, 8, 9, and 10, you should be good to go! If not, why not comment your issue below and we’ll try to get it in the next part.

About KDAB

If you like this blog and want to read similar articles, 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 Why is my screen still black appeared first on KDAB.

Cutelyst 2.11 and SimpleMail 2.1 released and a fork called Cutelee

Cutelyst the web framework based on Qt and SimpleMail the SMTP library got another update.

The current scenario has made me a lot less productive, after all 4 kids at home all the time it's really hard to concentrate. Still many fixes and a few features have landed both.

Simple mail had issues building on Windows, and also got some docs fixes.

Cutelyst got some Session parameters available on config, an WebSocket improvement to avoid setting a null body to skip RenderView processing, and a new view called Cutelee.

This year I got a big project, one that is pushing scalability on Cutelyst further, but it also requires that things progresses faster, and this means Grantlee was starting to become an issue. A while ago it's maintainer proposed to move it's code to KDE, got my hopes high, but that got postponed to Qt6, I couldn't wait for that and I also had an years old Pull Request waiting there, making in fact Cutelyst pages less safer as an escaping code wasn't escaping one special character. A Cutelyst contributor also had patches pending there, I tried my best to avoid this, the author is a great programmer, did an awesome job but we needed something that can move a little faster.

Cutelee was born, and already have many commits, it also got some performance improvements, like not converting QDate(Time) to an string and converting back to use the :date "yy/dd" formater, another important change was that it can inject filters without the hassle of creating a Qt Plugin, putting it into the right and error prone directory hierarchy, %with% tag also supports the new Django syntax, and I hope we can keep improving it at a faster rate.

I didn't do a new release of it yet, as some installation issues raised at Grantlee weren't fixed yet on Cutelee.

Have fun

https://github.com/cutelyst/cutelyst/releases/tag/v2.11.0

https://github.com/cutelyst/simple-mail/releases/tag/v2.1.0

https://github.com/cutelyst/cutelee

Meet Felgo at Qt Virtual Tech Con 2020!

Discuss The Best Practices of Qt with Felgo at Qt Virtual Tech Con 2020!

Qt Virtual Tech Con 2020 is coming up in a couple of days and we’re already buzzing! The exhibition will be streaming live from the 12th-13th of May 2020.

This two-day virtual conference will provide a great opportunity to learn about the latest hot topics in Qt development. Get first-hand insights into creating high performing cross-platform applications. Qt Pros are sharing their best practices on how to design great UI & UX apps through videos, tutorials, interactive presentations, and dozens of Q&A and live sessions.

We are excited to reconnect with our fellow software engineers again. Our CEO & Co-Founder, Chris, will share his insights about the best practices of mobile-optimized apps and the challenges you face before publishing them.

Registering for The Event

You can select the session and set the reminder in your calendar during the online registration process. Don’t worry if you can’t make it as the talk will also be recorded and will be available on the Qt live event page.

Meet Our Speaker

Chris Feldbacher profil Chris Feldbacher

 

Chris, the CEO & Co-Founder of Felgo, has vast experience in cross-platform app development with Qt and has also been a key speaker at many Qt conferences before. He also shared his expertise at Qt World Summit four times in a row and won the “Most Innovative Talk” award.

The Session Presented by Felgo in Detail:

Whether you’d like to bring your existing Qt application to mobile or develop your own mobile-optimized version, you will face many challenges before being able to publish it. In this talk, you will have the opportunity to deepen your knowledge and learn how to overcome mobile optimization challenges on iOS and Android.  Join us on May 12th 2020:

virtual

 

{{cta(‘9d99f958-08ad-481e-9340-3e0f5d03eb00′,’justifycenter’)}}

 

Recommended Articles

Our talented Qt developers carefully selected the best and most relevant Felgo articles to help you warm up for the conference.

Happy reading & happy coding!

Improve the Software Development Process with Qt

 

 

QML Tutorial: How to Create Native Cross Platform Apps with Qt and Felgo | Free Udemy Course

QML

Continuous Integration and Delivery (CI/CD) for Qt and Felgo

CI

 

Run your Qt and Felgo Apps in the Browser with WebAssembly (WASM)

WASM

 

The post Meet Felgo at Qt Virtual Tech Con 2020! appeared first on Felgo.

New GitQlient release v1.1.0

I'm happy to announce the release of GitQlient 1.1.0

After two and a half months from the first release here I present a new release with some fixes, several improvements and new features. The main focus on this release was to improve the stability of GitQlient, making it faster on Windows (there is room for improvement still) and adding some big features that didn't go into the first release for time reasons.

New GitQlient release v1.1.0 first appeared on My C++ & Qt blog - Cesc M..

Meet Felgo at Qt Virtual Tech Con 2020!

Qt Virtual Tech Con 2020 is coming up in a couple of days and we’re already buzzing! The exhibition will be streaming live from the 12th-13th of May 2020.

This two-day virtual conference will provide a great opportunity to learn about the latest hot topics in Qt development. Get first-hand insights into creating high performing cross-platform applications. Qt Pros are sharing their best practices on how to design great UI & UX apps through videos, tutorials, interactive presentations, and dozens of Q&A and live sessions. 

We are excited to reconnect with our fellow software engineers again. Our CEO & Co-Founder, Chris, will share his insights about the best practices of mobile-optimized apps and the challenges you face before publishing them.

13 Qt, QML and Felgo Tutorials & Resources for Beginners [2020]

If you’re new to Felgo  or coding, then you’re most likely new to  Qt  and  QML  too. Qt and QML go hand in hand along with Felgo to help you make cross-platform apps and 2D games in just a few days. Although it’s the  easiest way to make your app or game , if you’re just starting your coding journey, you might be struggling to get to grips with all the new info you need to take in.

Thankfully, there is lots of information online, QML and Qt tutorials, to help you out. Learn more about the differences between Felgo, QML, and Qt and take advantage of these tutorials and resources to boost your coding power.

Get Qt and QML consulting and training services from Felgo’s team if you need help with that. You can also outsource your Qt app development with Felgo.

The Differences between Qt, QML and Felgo

As a newcomer, you might have a lot of questions about the differences between these three terms. Qt, QML and Felgo are all separate entities but they all interact when you create your app or game with the Felgo SDK.

Qt is a cross-platform application framework. An application framework is the software that developers use to implement the standard structure of an application. Cross-platform refers to the fact that an application only needs to be written once but works on different systems. Therefore, your apps created with Qt can run on iOS, Android, Windows, and other systems, all without having to write separate codes for them! 

QML is a user interface markup language. A user interface markup language renders and describes graphical user interfaces and controls. QML is a part of the Qt framework. However, as QML was created initially for the rapid creation of UIs and animations, you can now use it for writing your app or game logic with a component-based approach. Also, you can mix JavaScript with QML easily and make any app or game you like with it.

Like Qt, Felgo is also a cross-platform application framework. The difference, however, is that Felgo adds a large number of components, elements, and other features to the existing Qt framework to make it even easier for developers to make their mobile apps and games. So we recommend using this slightly modified framework, as it speeds up development and reduces the amount of coding involved.

Looking for Qt Training, Consulting or Software Development?

The Best Qt Tutorials

1.      Getting Started with Felgo and Qt Creator

Now that you know the differences between the 3 terms, it’s time to get hands-on with them using a short QML tutorial. To start learning about Qt and Felgo, you’ll need to open up Qt Creator. This is a powerful IDE (Integrated Development Environment), available on all operating systems that will allow you to create cross-platform apps and games.

Qt Creator is included in your Felgo installation and you can learn how to set up your projects using an essential tutorial called Getting Started with Felgo and Qt Creator. This will guide you through the process of creating a new project and teach you a few simple rules of QML. This quick Qt tutorial is an absolute must for anyone learning Qt for the first time.

Download Felgo Now and Try These Helpful Qt & QML Tutorials Out For Yourself!

2.  Introduction to Qt – Qt Creator IDE Overview Tutorial

After you have completed the first Qt tutorial, this video will show you some more examples of just how powerful Qt Creator is. You will see the functionality of different parts of the framework and get more acquainted with the interface itself. Make sure to check out the Examples section on the Welcome tab within Qt Creator after you have downloaded Felgo. You will find a repertoire of amazing demos and possibilities with Qt, QML, and the Felgo SDK.

3.      Creating QML Objects

Once you know Qt Creator, you can start making your own app or game. The basic elements of any project made with Qt or Felgo are QML objects. QML objects include things like buttons, switches, etc. Learning how to implement these objects will help you throughout your coding career, so it’s important to understand them before going any further. Creating QML Objects is a great starting point for beginners, so make sure to check it out. This QML tutorial will teach you the absolute basics of coding with Qt and Felgo.

4.      Communication between QML Objects

For your app or game to have a level of functionality, your QML objects must be able to communicate with each other. Communication between QML Objects is a very user-friendly introduction to this subject and will teach you enough to start doing the really enjoyable stuff with your code. This is an essential part of coding both for apps and games, so definitely go through this Qt/QML tutorial.

5.      First Steps with QML

After completing the 3 previous tutorials, there are still a few more concepts to cover in order to gain a comprehensive understanding of Qt, QML and Felgo. The next tutorial to check out will go back over some of the same material covered in the previous tutorials but it will also expose you to some more essential Qt concepts. First Steps with QML is The Qt Company’s own essential getting started tutorial and isn’t to be missed. It brings you through setting up controls within apps and handling user input.

6. Entity Based Game Design

This is a fun tutorial that shows you how to make your first simple game. Entity Based Game Design teaches you to make a game by introducing you to entities and physics, two essential concepts to understand if you’d like to make mobile games. Once these are covered, you’ll also learn about particle effects, AI and how to use sounds in your games. This is a great tutorial if you’ve never made a game before because it only takes a quarter of an hour to complete.

7. C++ and Qt tutorial

This long playlist of YouTube videos might look dated, but is still one of the best Qt tutorials out there if you are looking to learn C++ and the Qt framework. Note, that these videos show you the workings of Qt 4, which has been replaced by Qt 5. Most of the code in these videos is still going to work however, but you might run into a few small problems. If you look on the bright side though, finding solutions to these issues will be a great development training for you. This is a good Qt tutorial for anyone wanting to develop in the Qt core framework, without any extra features and a simplified workflow.

8.    Felgo Tutorials for Apps and Games

Although they’re not strictly Qt tutorials, the Felgo tutorials teach you a lot about Qt for both game and app development. Compared to the previously mentioned videos, these tutorials use the Felgo framework, adding useful features and shortening development time. You’ll need to download Felgo or add it to your existing Qt installation to be able to follow these tutorials. The Felgo tutorials will teach you everything from making a simple Flappy Bird game to making your first functional app. And they also explain the most important Qt and QML features in an application-oriented way.

9.      Writing a Widget-Based Application with Qt 5

After you have completed some easier tutorials, you might want to jump straight into deeper waters. This long session on YouTube is a great resource to follow along, with detailed explanations of the processes under the hood in a Qt application. This is a Qt tutorial, which does not use any Felgo components. It’s definitely a good way to get an overview on Qt, before starting to use the extras Felgo has to offer.

Step-by-step guide to your first Android / iOS App

The Best Qt Resources

10.      Books

Not surprisingly, there are a bunch of books published on the subject of learning Qt. Although some of the books listed on the Qt Wiki have become a little outdated, Qt 5 Cadaques (alias the QML Book) by Juergen Bocklage-Ryannel and Johan Thelin is an excellent read for anyone learning Qt. It’s free to read online and has a great index so you can jump exactly to what you want to know. Juergen and Johan are passionate about coding with Qt so they’re a great influence for any newcomers out there. You can find many more books listed on The Qt Company’s website.

11.      Whitepapers

Even if you’re a beginner, the two whitepapers The Qt Company has published should be of interest to you. Beyond the Code and Driving the User Interface are free to download and cover two very diverse areas.

Beyond the Code is a great piece on how designers and programmers can work together to deliver successful Graphical User Interfaces for embedded systems. Driving the Automotive User Interface is a little different as it’s a review of the current trend of adding graphical center-consoles to cars. Check them out to get an idea of the range of projects that can be created with Qt, QML and Felgo.

12.      Demos and Examples

Demos and examples are a great way to learn how to make apps and games. Being able to look through other projects gives you insight into how different elements of a project are made and you can then copy them into your own applications. Look through the Felgo demos and examples to get a feel for what a finished game or mobile app project looks like. You can also have a look at the Qt demos.

You can also view all of the Felgo game examples and demos in the Felgo Sample Launcher. The Sample Launcher is a stand-alone desktop application that allows you to test all of the open-source demos and examples from Felgo quickly.

13.      Webinars

The Qt Company has released some great webinars over the years to help developers get to grips with certain topics. First and foremost, make sure to check out Get started with Qt. The other webinar that should be particularly useful to new developers is Introduction to Qt CreatorThis webinar is targeted at beginners and could be just the resource you need to get started. You can also download both of these and watch them later offline. Once you’ve watched them, you can move onto Deep Dive – Qt Quick & Qt Quick Controls or one of the other more in-depth webinars.

14.      Qt World Summit Talks

The Qt World Summit is an international event that takes place every year. Qt experts from around the world gather to share and discuss what they’ve learned about Qt in the previous 12 months and what they expect to learn in the coming years. Some of the videos are great for new learners as they include sample code that you can follow along with. These videos, in particular, are useful for newcomers:

Introduction to Qt Creator by Tobias Hunger

Getting Started with Qt on Android by BogDan Vatra

Qt on IOS A to Z by Mike Krus

The 8 Mistakes of QtQuick Newcomers by Luca Ottaviano, Develer

 

15.      Qt Quick Best Practices

Best Practices are basically a set of Do’s and Don’ts for developers to ensure that there is a certain quality to written code. The Best Practices are open to discussion and are usually decided on a group basis. You should always try to follow Best Practices if you’re releasing an app or game, or going to be working with others on a project. It’s a good thing to learn about these Best Practices when you start coding to avoid developing any bad habits which can be problematic down the road. This one is definitely for those that are serious about learning Qt.

16.      Qt Wiki Learning Portal

The Qt Wiki Learning Portal is the place to go to find even more learning resources. It’s a great collection of examples, demos, and resources for improving your Qt coding skills. Although a lot of the listings here are international language versions of other tutorials, there’s still something here for everyone.

Learn to Code with Qt and Felgo!

So now that you’ve got all of the tutorials and resources you need, go and learn to make something great with Qt. And if you find any other cool tutorials or resources, let us know and send us a direct message here.

More Posts like This

16 Great Sites Featuring Free Game Graphics for Developers

21 Tips That Will Improve Your User Acquisition Strategy

How to Download the Best Free Fonts for Mobile Development

16 Great Websites Featuring Free Game Sounds for Developers

 

References

Qt & Android: Setting wallpaper

Is your Android app written using Qt? Would you like to change the wallpaper on your Android device programmatically? Then join me in creating an Android app that generates and saves the image as wallpaper.


Using Qt Creator, create a new 'Qt Quick Application - Empty' naming it WallpaperExample.


Select both Desktop and Android Kits.  It is usually convenient to have a Desktop app to test non-Android features of the app.


Next, verify the WallpaperExample Desktop builds and runs.


Update main.qml so that it can used to set the wallpaper.


Create the AndroidManifest.xml. Additional changes to the XML will be neccessary later.
Select all the Android supported ABI's.


Now, verify the WallpaperExample Android builds and runs.


An effective  approach  for a Qt/QML/C++ app to perform Android specific tasks is to use Android's Java API. Android Java classes are accessible to a Qt application using the JNI convenience APIs in the Qt Android Extras module, such as QAndroidJniObject::callStaticObjectMethod.


Java classes in a Qt Android project need to maintain the Java naming conventions and the directory package structure.
The package name is the same package name assigned in the Android-Mainfest.xml.
Because this Java class, WallpaperGenerator,  requires access to application-specific resources, the Android Context must be passed in from QAndroidJniObject::callStaticMethod call in the Qt class.


The QAndroidJniObject::callStaticMethod calls the static method WallpaperGenerator.generateWallpaper which generates and sets the Android wallpaper on a seperate thread to prevent UI delay.










The method WallpaperGenerator.getWallpaper calls an image generating service and reads the response using common Java API. 
The method WallpaperGenerator.setWallpaper creates and sets the bitmap image using Android  specific API. 
An alternative to calling the methods getWallpaper and setWallpaper, the method generateWallpaper can be called.













AndroidManifest.xml requires a few changes before the app can run. Android requires the manifest.permission.SET_WALLPAPER permission. Starting with Android 9, API level 28, cleartext support is disabled by default and this app communicates with the wallpaper generating server using http, so usesCleartextTraffic must be enabled.


That's all it takes. Run the app and set wallpaper.