Monthly Archives: February 2018

Link

We have released version 2.9.0 of our Qt application introspection tool GammaRay. GammaRay allows you to observe behavior and data structures of Qt code inside your program live at runtime. GammaRay 2.9 introduces a number of new features interesting to Qt Quick, QWidgets, Qt 3D and non-graphical Qt users alike.

Qt Quick

One focus area of this release is the paint analyzer. It got significantly improved argument inspection, stack traces for all operations, and, in addition to QWidgets, QGraphicsView and QQuickPaintedItem, it’s now also available for the Qt Quick software renderer (with Qt 5.9.3 or newer) and Qt 3D painted textures. The paint analyzer now also measures the time each operation takes. With all that combined you have a powerful tool when being faced with rendering performance issues in applications using the Qt Quick software renderer.

GammaRay paint analyzer / profiler with a Qt Quick software renderer application.

For the Qt Quick OpenGL renderer we have some interesting new feature too of course, such as the texture inspection tab. This enables you to see the textures used on the GPU backing Image elements or Text elements using distance field rendering. This is useful to spot sub-optimal texture atlas usage, or textures containing unnecessary content, both of which can hurt GPU memory consumption. The texture inspection view supports analyzing this with diagnostic overlays, highlighting transparent borders or repeated areas that can for example be optimized by the use of BorderImage elements.

GammaRay texture inspector highlighting a largely transparent element in a texture atlas

Core Features

There’s also new features for the non-UI aspects of Qt. The new QML binding inspector (requires Qt 5.10 or newer) allows you to analyze the dependencies of a QML property binding. It provides source code navigation to the corresponding binding dependency and thus is quite useful for debugging non-trivial binding loops.

GammaRay QML binding inspector showing a binding loop.

The new QObject creation stack trace view expands on the QObject creation source navigation we introduced in the previous release and also shows you the full stack trace leading up to the creation of a specific object (not available on all platforms). Very useful when you spot objects in GammaRay that shouldn’t be there (anymore).

GammaRay object creation stack trace view.

Widgets

For QWidget users, the GammaRay widget inspector is now able to visualize the tab focus chain. This makes testing the tab …read more

Source:: https://www.kdab.com/gammaray-2-9-0-release/

      

Link
App Architecture for REST Services with Qt, QML and V-Play

REST and RESTful web services are the most common way to access data through the Internet. Qt with V-Play provides an easy way to connect via REST. This article guides you through the most important steps to create an App and connect to a REST service. Additionally, it provides reusable code snippets.

Spoiler: Basic REST Example with V-Play

Before we jump into the details of creating the sample App, this is how a basic request to a REST service looks, using the XMLHttpRequest:

// Create the XMLHttpRequest object
var xhr = new XMLHttpRequest

// Listen to the readyStateChanged signal
xhr.onreadystatechange = function() {
  // If the state changed to DONE, we can parse the response
  if (xhr.readyState === XMLHttpRequest.DONE) {
    // The responseText looks like this {"ip":"xxx.xxx.xxx.xxx"} 
    // Parse the responseText string to JSON format
    var responseJSON = JSON.parse(xhr.responseText)
    // Read the ip property of the response
    var ip = responseJSON.ip
    // Log your ip to the console output
    console.debug("My IP is: " + ip)
  }
}

// Define the target of your request
xhr.open("GET", "https://api.ipify.org?format=json")
// Execute the request
xhr.send()

Real-Life Sample Project

For the most useful results, we build a real-life Qt client. It accesses one of the web’s most popular weather services. It’s easy to adapt to any other REST service: the process is always the same. You only need to change the endpoint URL and parse the corresponding content.

The full sample is available open-source on GitHub:

Architecture

The app consists of two files:

  • Main.qml: contains the UI and REST logic
  • DataModel.qml: stores & caches the parsed data from the REST service

Basic UI for a Responsive REST Client App

First, we create the user interface: the QML items in “Main.qml”. We use V-Play APIs. They adapt to the style of the target platform (Desktop, Android, iOS). These three items are usually present in every Qt / QML app:

  1. The App component is always the top-level element in the QML file. It adds a lot of vital layout data to standard Qt classes. Two mechanisms are especially important. Device-independent pixels (dp) for sizes and scale-independent pixels (sp) for fonts.
  2. Initially, our REST client app only has a single page. It’s still a good idea to add the NavigationStack item as a child. Later, it could handle navigating to a detail page. In …read more

    Source:: https://v-play.net/cross-platform-app-development/access-rest-services-qt-v-play-weather-service-example-app-open-source

          

Link

We are happy to announce the release of Qt Creator 4.6 Beta!

C++ Support

The possibly most noteworthy and least directly visible change is that we upgraded the backend for the Clang code model from Clang 3.9 to Clang 5.0. This enables support for many C++17 features that were not available in Clang 3.9. The Clang code model is not used by default. Open Help > About Plugins (Qt Creator > About Plugins on macOS) and turn on the ClangCodeModel plugin to enable it.

Another feature that is not visible until you enable it, is the new option to integrate Clang-Tidy and Clazy warnings into the diagnostic messages that you see in the C++ editor. Go to Options > C++ > Code Model > Clang Code Model Warnings, create a copy of one of the presets, and choose the checks that you want to be performed.

The informational tooltips on symbols are now generated from information from Clang instead of the built-in model (if you enabled the Clang code model). It now resolves auto to the actual type and shows template parameters for template types. It shows the first or the brief paragraph of a documentation comment, too.

We also added separate highlighting of function definitions and fixed some issues with saving header files on Windows while Clang has a grip on them.

Navigation

We added 3 more filters to Locator. Type “b” to jump to a bookmark, filtering on file name and notes. The other two are not directly related to navigation but nevertheless useful.
The filter “t” triggers an item from the main menu. You can either use the display name of the item to locate it, or parts of the menu path leading to it. For example “t sess expe” could be used to trigger the menu item File > Sessions > Experimental Stuff.
Use “=” to evaluate simple ECMAScript (JavaScript) expressions. You have all functionality from the ECMA-262 specification at your disposal, and for convenience, we also added the functions from the Math object as global functions (so you can write “max(1, 2)” instead of “Math.max(1, 2)”).

We continued the work on the File System navigation pane that we started with 4.5. It now has breadcrumbs for the file path at the top, and we added actions for adding, removing, and renaming files to its context menu.

Model Editor

Thanks to Jochen, the original contributor to the model editor, it received a big update …read more

Source:: http://blog.qt.io/blog/2018/02/07/qt-creator-4-6-beta-released/

      

Link
01_blog_overview

Welcome to Part 3 of my Blog series about Sharing Files to and from mobile Qt Apps.

Part 1 was about sharing Files or Content from your Qt App with native Android or iOS Apps, Part 2 explained HowTo share Files with your Qt App from other native Android Apps – this part now does the same from other native iOS Apps.

Some preliminary notes

  • Try it out: all sources are available at ⦁ GitHub
  • Android Permissions not checked in Example App: enable WRITE_EXTERNAL_STORAGE manually
  • Current Android release is for Target SDK 23 ! (Android 7 requires ⦁ FileProvider – wait for Blog Part 4)
  • All Use-Cases are implemented to be used x-platform – currently Android and iOS

If you‘re looking for an Android-only solution please also take a look at AndroidNative project.

Prepare iOS Info.plist

Similar to Android intent-filter in AndroidManifest.xml we must add some informations to Info.plist. If you haven‘t already done copy the Info.plist from your build directory into your project:

02_info_plist_in_project

Then add this into your .pro:

ios {
    ...
    QMAKE_INFO_PLIST = ios/Info.plist
    ...
}

Open the Info.plist and insert these lines:

CFBundleDocumentTypes
  CFBundleTypeNameGeneric FileCFBundleTypeRoleViewerLSHandlerRankAlternateLSItemContentTypespublic.data

See all the details from Apple Documentation „Registering File Types“.
Here‘s a short overview how the Types are organized:

03_uniform_type_identifiers

public.data is similar to MimeType */* we are using to filter Android Intents in our Example App.

After adding the lines to Info.plist our App will appear as a target App if Files or Attachments should be shared from other iOS Apps.

Fortunately iOS doesn‘t provide our own App as target if we want to share Files from our Example App with other iOS Apps.
Remember: On Android we had to create a custom Chooser to filter out our own App as target.

Get the incoming URL

The Files from other iOS Apps will be passed to the Qt App via application:openURL:

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation

see also Apple documentation.

From Part 2 (Android implementation) you know that we have to wait until the Qt App is ready to handle the incoming URL and be able to emit a SIGNAL to QML UI.

We don‘t need this for iOS, because there‘s a Qt method we can use out of the box and grab the passed file url by registering QDesktopServices::setUrlHandler:

QDesktopServices::setUrlHandler("file", this, "handleFileUrlReceived");

This is easy to implement. We already have the IosShareUtils.mm class where we handle sharing …read more

Source:: http://blog.qt.io/blog/2018/02/06/sharing-files-android-ios-qt-app-part-3/

      

Link

The Qt Company Support Team works hand-in-hand with Qt R&D developers, and we are 100% committed to ensuring your success. It’s now been a bit over half a year since we launched the new Premium Support service. We felt that now would be a good time to recapture its essence and the experiences of our teams and customers. We will be sharing lots of troubleshooting tips and best practices on March 6th, in our Qt Support – Tips and Tricks webinar – make sure to join and tell us about your project! In the meantime, here’s a brief recap of what we’ve been working on.

Qt Support Services

Standard Support is included with all new commercial Qt licenses (apart from start-up licenses). This guarantees that we respond to your request within 48 business hours and prioritize your reported Qt errors. However, many of our customers require more personal and quicker support service. This is where Premium Support comes in. It offers a dedicated support representative close to your time zone who will respond to you within 10 business hours on average. This means that if we get your request in the morning you can see our response before you leave work.

When we try to reproduce any issues you may have, we can also use your complete applications instead of minimal test versions to analyze issues and fix bugs. Premium Support reported Qt bugs also get high priority and will get handled quickly.

You can find the SLA terms on our webpage.

Experiences from Premium Support

We’ve resolved oodles of bug fix requests for our Premium Support customers. With Premium Support it doesn’t really matter whether the issue lies in your code or in the Qt libraries. We will investigate and find the solution no matter what. Typically bugs can be difficult to resolve in Standard Support since a minimal test application is required and some of the issues are really hard to reproduce with anything else than customer application. Being able to use customer application really speeds up resolving bugs!

We have also been providing a lot of guidance on best practices on particular use cases for our customers. This includes ideal usage of Qt APIs and what can be done within the customer application, algorithm guidance, architecture design and optimizing performance.

Another type of project we are often involved in is the migration from obsolete Qt version to a newer …read more

Source:: http://blog.qt.io/blog/2018/02/05/premium-support-learning-and-experiences/