Data conversion

Qt provides a set of classes and functions for easily converting between different types of data. This makes Qt more than just a GUI library; it is a complete platform for software development. The QVariant class, which we will be using in the following example, makes Qt even more flexible and powerful compared to similar conversion functionalities provided by the C++ standard library.

How to do it…

Let's learn how to convert various data types in Qt by following these steps:

  1. Open up Qt Creator and create a new Qt Console Application project by going to File | New File or Project:
    How to do it…
  2. Next, open up main.cpp and add the following headers ...

Get Qt5 C++ GUI Programming Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.