Qt multi-thread calls gdal library interface

Author: Zhu Jincan
Source: clever101's column

Renderings and program descriptions

  The renderings are as follows:
Create an image pyramid

  This program is a Qt GUI program for creating pyramids for specified image files.

Why use multithreading

  There are two main benefits of using multithreading:
1. Multithreading is more humane in many cases. For example, the interface update uses one thread, and the background algorithm uses another thread. In this way, the background algorithm thread and the interface thread do not affect each other.
2. The current machines generally have multi-core processors, and the use of multi-threading can just make full use of hardware resources.

How to use multithreading in Qt

  The following takes creating an image pyramid as an example to illustrate how to call the gdal library interface in Qt using multithreading. The first thing to consider is how to plan threads: Generally speaking, the main thread, that is, the UI thread, is responsible for updating the progress bar, and the algorithm process is responsible for processing data.
1. A class CreatePyramidThread is derived from the QThread class to create an image pyramid. The main code is as follows:

Guess you like

Origin blog.csdn.net/clever101/article/details/128288420