1、工程文件
cmake_minimum_required(VERSION 3.14)
project(MainFramework)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)
#search for components
find_package(Qt6 REQUIRED COMPONENTS Widgets)
#set header and souce files
set(SOURCES
src/mainwindow.cpp
src/pluginmanager.cpp
src/main.cpp
)
set(HEADERS
src/mainwindow.h
src/pluginmanager.h
src/plugininterface.h
)
#create main framework application
add_executable(MainFramework ${SOURCES} ${HEADERS})
#link the qt library
target_link_libraries(MainFramework Qt6::Widgets)
2. 窗口类
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
class MainWindow : public QMainWindo