当前位置:网站首页>3. Overall UI architecture of the project
3. Overall UI architecture of the project
2022-06-28 13:45:00 【Endless character】
Catalog
One 、MYPlayer.pro Detailed explanation
MYPlayer.pro: The setting of the whole project is recorded , It is not recommended to modify it casually
- Project template : Build an application of makefile
# Project Type
TEMPLATE = app
- QT Refer to the module
# Qt modules that are used by your project
QT += qml quick gui widgets multimedia opengl openglextensions
- Project compilation options and Libraries
# Project configuration and compiler options
CONFIG += qt warn_on c++11 rtti stl thread exceptions
- moc File path configuration :moc The full name is Meta-Object Compiler, That is to say “ Metaobject compiler ”; After compiling, you will see moc file
- Qt It's not used “ The standard ” C++ Language , It's a certain degree of “ Expand ”. Here we are from Qt The newly added keywords can be seen :signals、slots perhaps emit. So some people think Qt The compilation speed of the program is slow , This is mainly because Qt Hand over the source code to the standard C++ compiler , Such as gcc Before , You need to remove these extended syntax in advance . This is done by moc
- moc The full name is Meta-Object Compiler, That is to say “ Metaobject compiler ”.Qt Before the program is compiled by the standard compiler , First use moc analysis C++ Source file . If it finds that a header file contains macros Q_OBJECT, Then another C++ Source file . This source file contains Q_OBJECT Macro implementation code . The new file name will be the original file name preceded by moc_ constitute . This new file will also enter the compilation system , Eventually linked to binary code . So we can know , This new file is not “ Replace ” Drop old files , But participate in the compilation together with the original file . in addition , We can also see one thing ,moc The execution of is before the preprocessor . Because after the preprocessor executes ,Q_OBJECT Macros don't exist
# Directory where all intermediate objects and moc files should be placed
CONFIG(debug, debug|release) {
OBJECTS_DIR = ./tmp/debug
MOC_DIR = ./tmp/debug
} else {
OBJECTS_DIR = ./tmp/release
MOC_DIR = ./tmp/release
}
- Temporary file and resource file path of compiler output
# Directory where all intermediate files from uic should be placed
CONFIG(debug, debug|release) {
UI_DIR = ./tmp/debug
} else {
UI_DIR = ./tmp/release
}
# Directory for Qt Resource Compiler output files
CONFIG(debug, debug|release) {
RCC_DIR = ./tmp/debug
} else {
RCC_DIR = ./tmp/release
}
- Debug and Release The generation path of
# Specifies where to put the target file
CONFIG(debug, debug|release) {
contains(QMAKE_TARGET.arch, x86_64) {
DESTDIR = $$_PRO_FILE_/../../../bin/debug/x64
} else {
DESTDIR = $$_PRO_FILE_/../../../bin/debug/x86
}
} else {
contains(QMAKE_TARGET.arch, x86_64) {
DESTDIR = $$_PRO_FILE_/../../../bin/release/x64
} else {
DESTDIR = $$_PRO_FILE_/../../../bin/release/x86
}
}
- Specify the executable file name of the project target : It doesn't contain any extensions 、 Prefix or version number ( The default is the current directory name )
# Name of the target file
TARGET = MYPlayer
- Specify the project resource file 、code The coding
# Name of the resource collection files (qrc) for the target
RESOURCES += resource/MYPlayer.qrc
#RESOURCES += qml.qrc
# Codec configuration
CODECFORTR = UTF-8
CODECFORSRC = UTF-8
- Project used jml and js file
# Source files which contains strings for i18n
lupdate_only {
SOURCES += resource/ui/qml/*.qml \ resource/ui/qml/*.js } - Translate the document : Can open resource/ui/translation/MYPlayer_zh_CN.ts The file to view , Support Chinese and English translation
# Translation file path
TRANSLATIONS += ./resource/ui/translation/MYPlayer_zh_CN.ts

- Compile option definition :QT_DEPRECATED_WARNINGS Express QT When certain features of are marked as obsolete , The compiler issues a warning
# The following define makes your compiler emit warnings if you use
# any Qt feature that has been marked deprecated (the exact warnings
# depend on your compiler). Refer to the documentation for the
# deprecated API to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
- Project source file
# Source files in the project
SOURCES += \
MYAudioPlay.cpp \
MYAudioThread.cpp \
MYDecode.cpp \
MYDecodeThread.cpp \
MYDemux.cpp \
MYDemuxThread.cpp \
MYResample.cpp \
MYVideoThread.cpp \
MYVideoOutput.cpp \
MYPlay.cpp \
main.cpp \
MainApp.cpp \
MYSubTitle.cpp \
- Project header file and include file path
# Header files for the project
HEADERS += MainApp.h \
IVideoCall.h \
MYAudioPlay.h \
MYAudioThread.h \
MYDecode.h \
MYDecodeThread.h \
MYDemux.h \
MYDemuxThread.h \
MYResample.h \
MYVideoThread.h \
MYVideoOutput.h \
MYPlay.h \
MYSubTitle.h \
# Include path
INCLUDEPATH += ../../include
- Library files used in the project
# Libaray path and libaray
CONFIG(debug, debug|release) {
contains(QMAKE_TARGET.arch, x86_64) {
LIBS += -L"$$PWD/../../lib/debug/x64/"
} else {
LIBS += -L"$$PWD/../../lib/debug/x86/"
}
# win32:LIBS += libqrencode.lib\ # libzint.lib
# unix:LIBS += -lqrencode\ # -lzint
} else {
contains(QMAKE_TARGET.arch, x86_64) {
LIBS += -L"$$PWD/../../lib/release/x64/"
} else {
LIBS += -L"$$PWD/../../lib/release/x86/"
}
# win32:LIBS += libqrencode.lib\ # libzint.lib
# unix:LIBS += -lqrencode\ # -lzint
}
win32:LIBS += avformat.lib\
avcodec.lib\
avutil.lib\
swresample.lib\
swscale.lib
- win32 Required by the platform rc file : Other platforms are not maintained , The default can be
################################################################################
# Windows platform
win32 {
RC_FILE = win32/MYPlayer.rc
HEADERS += win32/targetver.h \
win32/resource.h
OTHER_FILES += win32/MYPlayer.rc
}
################################################################################
# Linux platform
linux {
}
################################################################################
# Mac OS X platform
macx {
}
Two 、Visual Stdio Start source code
1 - Generate vs Project documents
- a. New under the project directory GenerateVCProj.bat:
qmake -tp vc MYPlayer.pro
- b. function GenerateVCProj.bat Generate vs Project documents : Use vs open MYPlayer.vcxproj File to start vs project

2 - vs Description of the directory structure of the project

3 - MainApp.h Start class analysis
- class MainApp : public QApplication:MainApp Inherit QApplication class , Mainly to complete the work of program initialization , The purpose of this part of initialization is to establish the interface management mechanism in the project

- MainApp Added Q_OBJECT macro : Then we can use signals in our projects (signal) Slot (slot) Mechanism

- MainApp Member variables of

- MainApp Member method of

- Signals and slots

- QML attribute -Q_PROPERTY:QML The processing of the interface layer is related to the complex logic of the logic layer
Q_PROPERTY(int demoNum READ demoNum WRITE setDemoNum NOTIFY demoNumChanged):demoNum Variable reading 、 Write 、 Changes will trigger events on the interfaceQ_PROPERTY(QString language READ language WRITE setLanguage NOTIFY languageChanged): The reading of the same language 、 Write 、 Changes are also associated with

边栏推荐
- Design artificial intelligence products: technical possibility, user acceptability and commercial feasibility
- RK3399平台开发系列讲解(使用篇)Pinctrl子系统的介绍 - 视频介绍
- Hisilicon 35xx realizes gt911 touch screen function "suggestions collection"
- CodeBlocks MinGW installation configuration problem
- 黑苹果安装教程OC引导「建议收藏」
- Electronic components distribution 1billion Club [easy to understand]
- Jerry's wif interferes with Bluetooth [chapter]
- [codec] write H264 decoder (1) from scratch
- Rk3399 platform development series explanation (use part) pinctrl subsystem introduction - Video Introduction
- What is generics and how to use generics analysis
猜你喜欢

Elastic box auto wrap demo

为什么越来越多的用户放弃 Swagger,选择Apifox

Design artificial intelligence products: technical possibility, user acceptability and commercial feasibility

Special test for cold and hot start of app

3、项目的整体UI架构

Visual design tutorial of word cloud

How vscade sets auto save code

开源社邀您参加OpenInfra Days China 2022,议题征集进行中~

Mobile web training day-1

Latest summary! 30 provinces announce 2022 college entrance examination scores
随机推荐
(original) [Maui] realize "floating action button" step by step
From PDB source code to frame frame object
Build a learning environment
MySQL从库Error:“You cannot ‘Alter‘ a log table...“
我呕血收集融合了来自各路经典shell书籍的脚本教学,作为小白的你快点来吧
Unit test ci/cd
Special test for cold and hot start of app
Oracle cloud infrastructure extends distributed cloud services to provide organizations with greater flexibility and controllability
Solution to directory access of thinkphp6 multi-level controller
Inftnews | technology giants accelerate their march into Web3 and metauniverse
Align content attribute in flex layout
如何备份mysql_史上最全的MYSQL备份方法
再谈exception——异常抛出时会发生什么?
中国广电5G套餐来了,比三大运营商低,却没预期那么低
NFT digital collection system development (3D modeling economic model development case)
嵌入式设计与开发项目-液位检测告警系统
How to solve the problem that the computer wireless network does not display the network list
N皇后问题
你的代碼會說話嗎?(上)
单元测试 CI/CD