当前位置:网站首页>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

边栏推荐
- PCB懂王,你是吗?我不是
- 2022年中国运维安全产品市场规模及发展趋势预测分析
- Pytorch main modules
- [understanding of opportunity -32]: Guiguzi - Dui [x ī] Five attitudes towards danger and problems
- Why do more and more users give up swagger and choose apifox
- 你的代碼會說話嗎?(上)
- 《畅玩NAS》家庭 NAS 服务器搭建方案「建议收藏」
- Mobile web training -flex layout test question 1
- Class structure in C language - dot
- My hematemesis collection integrates script teaching from various classic shell books. As Xiaobai, come quickly
猜你喜欢
![(original) [Maui] realize](/img/76/d79b9cf4ed44870bb20a189315def9.jpg)
(original) [Maui] realize "floating action button" step by step

895. longest ascending subsequence

Hematemesis recommends 17 "wheels" to improve development efficiency

Websocket automatically disconnects in 1 minute

Mobile web training -flex layout test question 1

你的代码会说话吗?(上)

PostgreSQL超越MySQL

PCB懂王,你是吗?我不是

Align content attribute in flex layout

Introduction to PWN (1) binary Basics
随机推荐
嵌入式设计与开发项目-液位检测告警系统
为什么越来越多的用户放弃 Swagger,选择Apifox
如何备份mysql_史上最全的MYSQL备份方法
Kubernetes in-depth understanding of kubernetes (I)
如何设计数据可视化平台
Talk about exception again -- what happens when an exception is thrown?
Kubernetes 深入理解Kubernetes(二) 声明组织对象
Solution to directory access of thinkphp6 multi-level controller
Electronic components distribution 1billion Club [easy to understand]
yii2连接websocket服务实现服务端主动推送消息给客户端
Pytorch model parameter adjustment and training related contents
If a programmer goes to prison, will he be assigned to write code?
1015. picking flowers
恒生电子:金融分布式数据库LightDB通过中国信通院多项测评
Introduction to PWN (1) binary Basics
En parlant d'exception - que se passe - t - il lorsque l'exception est lancée?
How vscade sets auto save code
2022年中国运维安全产品市场规模及发展趋势预测分析
抢做意大利岛主?刘强东两月套现66亿 疑一次性5.6亿“紧急转账”急购欧洲海上皇宫
Is it safe for Huatai Securities to open an account? Is there any risk in opening an account