Qt adds UI interface file project example to pure C++ class: timing screenshot tool

Problem Description:

I wrote an article before, which is called the addition of ui interface files of a single class in Qt. There are two ways, one is to manually add ui-related interface codes, and the other is to load ui files. Here is a chestnut.

Take the screenshot tool of the Qt case as an example. It happens that this project example does not have a ui file. And I just need a timing screenshot tool, which is not included in this project. But it has a screenshot function.

 

Solution:

1. First, we create a new Qt interface file and name it screenshot.ui. Note that it is not an interface class file, just add a UI file. According to what we said in the previous chapter, first add the header file "ui_screenshot.h" to screenshot.h, we don't use the namespace method.

 Then declare the ui pointer. The class in the ui header file is Ui::Screenshot, which is an inherited class and has the same name as our screenshot class. Then define a timer timer.

Guess you like

Origin blog.csdn.net/poolooloo/article/details/129526940
Recommended